cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
ChrisMuenzer
Level II

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 II

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?