Pearson Product-Moment Correlation CoefficientHi Everyone,
Is there a function I can use in a JSL script that calculates the Pearson Product-Moment Correlation Coefficient? Basically what I am looking for is RSQ() function in Excel but for JSL?
I know that it's calculated in the Multivariate platform, but I'd actually like to use a function instead.
Thanks, Natalie
Re: Pearson Product-Moment Correlation Coefficient. . . and in JMP 13 you could use data table subscripting:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Print(Correlation(dt[0,4]||dt[0,5]));
Re: Pearson Product-Moment Correlation CoefficientHi Natalie,
There is the matrix function, Correlation().
Names Default To Here( 1 );
Correlation( [1 3 5, 3 2 6, 5 6 1] );
You would need to first create a matrix from your data, if it is not already a matrix. You could potentially do that with Get As Matrix():
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
m = dt << Get As Matrix();
Show( m );
x = dt << GetAsMatrix( {4, 5} );
Show( x );
Maybe there is a simpler way that does not involve matrices.
Regards,
Phil