cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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? 

Recommended Articles