I 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
![txnelson_0-1677798048185.png txnelson_0-1677798048185.png](https://community.jmp.com/t5/image/serverpage/image-id/50681i81A9827F58D6DCCF/image-size/medium?v=v2&px=400)
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];
)
Jim