Re: Calculation a p-value in a data table (regression) using row formulaeI think you can get what you want from the Linear Regression() function. Take a look in the Scripting Guide for the definition and example of how to use it. Below, I created 2 new columns, "New Slope" and "PValue". I set the format for the PValue column to "PVALUE". I then set the formula for the PValue column to
If( Row() > 7,
dt = Current Data Table();
x = dt[Index( Row() - 7, Row() ), 2];
y = dt[Index( Row() - 7, Row() ), 3];
{Estimates, Std_Error, Diagnostics} = Linear Regression( y, x );
:New Slope[Row()] = estimates[2];
diagnostics["p_value"][1];
);
Here is the display

If( Row() > 7,
dt = Current Data Table();
x = dt[Index( Row() - 7, Row() ), 2];
y = dt[Index( Row() - 7, Row() ), 3];
{Estimates, Std_Error, Diagnostics} = Linear Regression( y, x );
:new slope[Row()] = estimates[2];
diagnostics["p_value"][1];
)
Re: Calculation a p-value in a data table (regression) using row formulaetxnelson... thanks so much. This was exactly what I was looking for. I sincerely appreciate this.
Calculation a p-value in a data table (regression) using row formulaeBackground: Suppose I have rows of x, y data (SN_C, Value [Sigma Units]) as shown in attached file but also pasted below.

Slope_8 is calculated from the previous 8 [x.y] values.
I want to compare the slope_8 value to the null hypothesis for linear regression (slope =0) and provide a p-value. Is there an easy way to do this?
The formula for the slope 8 was taken from these discussion boards (@txnelson, @Mark_Bailey)and does exactly what I want after I did simple modification to use N=8
If( Row() > 7,
x = J( 8, 1, 1 ) || :SN_C[Index( Row() - 7, Row() )]`;
y = :"Value (Sigma Units)"n[Index( Row() - 7, Row() )]`;
(Inv( x` * x ) * x` * y)[2];
)
I know I should know how to do this and my apologies for being too stupid to figure it out. Its been 30 years since I've taken matrix algebra 
Advanced Statistical ModelingConsumer and Market ResearchData Exploration and VisualizationDesign of ExperimentsMass CustomizationPredictive Modeling and Machine LearningQuality and Process Engineering