cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
lehaofeng
Level IV

一组数据的正态性检验的PValue如何求?

我有一个表,有2000多行,每行数据都要检验正态性,把PValue放到每行数据的最后,请问有公式吗?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: 一组数据的正态性检验的PValue如何求?

Create the new column in your data table.  Make sure you go into the Col Info, and set the format for the column to "PValue".

Then open the Formula Editor for the new column and paste the below column into it

dt = Current Data Table();
// change the Index value for the starting column number of the columns to be analyzed
theRow = dt[Row(), Index( 5, N Col( dt ) - 1 )];
// Create a temporary working data table to calculate the normality on
dtTemp = New Table( "temp", private, New Column( "x", values( theRow ) ) );
// Run the Distribution Platform to calculate the normality
dis = Distribution( invisible, Continuous Distribution( Column( :x ), Fit Normal( Goodness of Fit( 1 ) ) ) );
// Retrieve the P Value of the Normality statistic
pval = (Report( dis )["Goodness-of-Fit Test", Number Col Box( 2 )] << get)[1];
// Clean up the behind the scenes working table and display
dis << close window;
Close( dtTemp, nosave );
// Apply the pvalue to the current row
pval;

This formula will take several minutes to run on a 2000 row table.

The comments in the above formula will not be saved as part of the formula(it;s a JMP efficiency, to keep only the executable part of the formula).

Normally, JMP data is formatted 90 degrees from the way your data are structured.  The column contain the data to be analyzed, and the rows represent the different instances for the given measurment.

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: 一组数据的正态性检验的PValue如何求?

Create the new column in your data table.  Make sure you go into the Col Info, and set the format for the column to "PValue".

Then open the Formula Editor for the new column and paste the below column into it

dt = Current Data Table();
// change the Index value for the starting column number of the columns to be analyzed
theRow = dt[Row(), Index( 5, N Col( dt ) - 1 )];
// Create a temporary working data table to calculate the normality on
dtTemp = New Table( "temp", private, New Column( "x", values( theRow ) ) );
// Run the Distribution Platform to calculate the normality
dis = Distribution( invisible, Continuous Distribution( Column( :x ), Fit Normal( Goodness of Fit( 1 ) ) ) );
// Retrieve the P Value of the Normality statistic
pval = (Report( dis )["Goodness-of-Fit Test", Number Col Box( 2 )] << get)[1];
// Clean up the behind the scenes working table and display
dis << close window;
Close( dtTemp, nosave );
// Apply the pvalue to the current row
pval;

This formula will take several minutes to run on a 2000 row table.

The comments in the above formula will not be saved as part of the formula(it;s a JMP efficiency, to keep only the executable part of the formula).

Normally, JMP data is formatted 90 degrees from the way your data are structured.  The column contain the data to be analyzed, and the rows represent the different instances for the given measurment.

Jim
lehaofeng
Level IV

Re: 一组数据的正态性检验的PValue如何求?

 Amazing! 谢谢您的解答!!!