cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

how do I write a script to compute confidence intervals

learning_JSL
Level IV

Hi - I am still new at jsl scripting and am trying to write a script that creates and saves four new columns based on my linear regression fit:

- lower 95% mean confidence interval

- upper 95% mean confidence interval

- lower 95% individual confidence interval

- upper 95% individual confidence interval

obj = Fit Model(
	Y( :LOG_ECOLI_PEAR ),
	Effects( :LOG_TURB_PEAR_FNU),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(:LOG_ECOLI_PEAR 
	))	;
 
  obj << Prediction Formula;

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
SDF1
Super User


Re: how do I write a script to compute confidence intervals

Hi @learning_JSL ,

 

  It's actually really easy. All you need to do is add a few lines of code to your existing JSL and you're done. While you're at it, I highly suggest using the Scripting Index under the Help menu -- it's VERY useful.

 

  For the mean CI, you'll add the code: obj << Mean Confidence Interval; and for the individual CIs, you'll add obj << Indiv Confidence Interval;. The default is for an alpha of 0.05 (corresponding to your +/- 95%, but you can specify any alpha you want, for example: obj << Mean Confidence Interval(0.1) would correspond to +/-90% CIs.

 

  Below is some code you can try out using the Diabetes.jmp file.

 

Hope this helps!,

DS

Names default to here(1);

dt=Open("$SAMPLE_DATA/Diabetes.jmp");

obj_fit = Fit Model(
	Validation( :Validation ),
	Y( :Y ),
	Effects(
		:Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG,
		:Glucose
	),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:Y << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);

obj_fit << Prediction Formula;
obj_fit << Mean Confidence Interval;
obj_fit << Indiv Confidence Interval;

View solution in original post

2 REPLIES 2
SDF1
Super User


Re: how do I write a script to compute confidence intervals

Hi @learning_JSL ,

 

  It's actually really easy. All you need to do is add a few lines of code to your existing JSL and you're done. While you're at it, I highly suggest using the Scripting Index under the Help menu -- it's VERY useful.

 

  For the mean CI, you'll add the code: obj << Mean Confidence Interval; and for the individual CIs, you'll add obj << Indiv Confidence Interval;. The default is for an alpha of 0.05 (corresponding to your +/- 95%, but you can specify any alpha you want, for example: obj << Mean Confidence Interval(0.1) would correspond to +/-90% CIs.

 

  Below is some code you can try out using the Diabetes.jmp file.

 

Hope this helps!,

DS

Names default to here(1);

dt=Open("$SAMPLE_DATA/Diabetes.jmp");

obj_fit = Fit Model(
	Validation( :Validation ),
	Y( :Y ),
	Effects(
		:Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG,
		:Glucose
	),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:Y << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);

obj_fit << Prediction Formula;
obj_fit << Mean Confidence Interval;
obj_fit << Indiv Confidence Interval;
learning_JSL
Level IV


Re: how do I write a script to compute confidence intervals

Perfect.  Thank you!