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
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