cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
ChrisMuenzer
Level I

For Loop Creating Multiple Distribution Platform Analysis

I have a code where I'm using the Distribution platform to perform normality checks on multiple columns.  Right now, I am using a for-loop to iterate through each column, open a distribution, and then extract the value of the normality test.  A subset of the code is shown below.  I have an issue where the Distribution platform just opens the same analysis for the first column over and over.

 

 

For( i = 1, i <= n, i++,
	dist = Distribution(
		Invisible,
		Continuous Distribution( Column( cols[1] ), Summary Statistics( 1 ), Fit normal( Goodness of Fit( 1 ) ) ),
		Histograms Only
	);

	r = Report( dist );

	p = r[Outline Box( "Fitted Normal Distribution" )][Outline Box( "Goodness-of-Fit Test" )][Table Box( 2 )][Number Col Box( 2 )] << get( 1 );
	
	norm = If( p >= 0.05, "Yes", "No" ) || " (p = " || Char( p ) || ")";

	dist << Close;
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: For Loop Creating Multiple Distribution Platform Analysis

In the line of code below

Continuous Distribution( Column( cols[1] ), Summary Statistics( 1 ), Fit normal( Goodness of Fit( 1 ) ) )

you have the number "1" in

cols[1]

and it should be

cols[i]
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: For Loop Creating Multiple Distribution Platform Analysis

In the line of code below

Continuous Distribution( Column( cols[1] ), Summary Statistics( 1 ), Fit normal( Goodness of Fit( 1 ) ) )

you have the number "1" in

cols[1]

and it should be

cols[i]
Jim
ChrisMuenzer
Level I

Re: For Loop Creating Multiple Distribution Platform Analysis

Thanks.  Sorry about missing a simple mistake.

 

Do you also know the correct way to close the distribution platform?