Regression P-Values in a Column based on the Values from other ColumnsHi... I am trying to find an alternative to Nelson Rule number 3 (6 points increasing or decreasing) that uses a regression based on a number of successive points an alpha value and a resultant p-value to help me flag when a signal is large enough to overcome noise. This is would be used for tool wear types of control charts.
Suppose I had a data set that looks like below (for simplicity) where;
X is my independent variable and Y is the dependent. I would like to calculate the P-value of the regression of successive points (N=3 in the example below) to help me understand when there is a signal large enough to overcome the noise in regression.
Obviously, the p-values are in the table below to be exemplary
I recognize that N will likely need to be larger (although, of course it depends on the size of signal) .
Can I create a script that will do this so that I can play with N and alpha to help me understand when regression is different than the null? I don't really care about the annotation on the control chart if I can have the p-value in the table.
Thanks
| X | Y | P-Value | Slope | SubGroup Size |
| 1 | 3 | | | |
| 2 | 6 | | | |
| 3 | 9 | 0.05 | | 3 |
| 4 | 12 | 0.05 | | 3 |
| 5 | 12 | 0.1 | | 3 |
| 6 | 12 | 0.54 | | 3 |
| 7 | 11 | 0.5 | | 3 |
| 8 | 13 | 0.1 | | 3 |
| 9 | 15 | 0.07 | | 3 |
| 10 | 17 | 0.05 | | 3 |
Data TableScriptingRe: Regression P-Values in a Column based on the Values from other ColumnsIt would be a simple matter to loop through a data table, and build one's x and y matrices and then perform a regression, using the Linear Regression() function. The decision of what values to place in the 2 matrices would be the item to vary.
Here is the example taken from the Scripting Index, for the Linear Regression() function
Names Default To Here( 1 );
/*Simple Linear Regression: y = intercept + beta * x + error*/
y = [3, 5, 7, 5];
X = [1, 2, 3, 4];
{Estimates, Std_Error, Diagnostics} =
Linear Regression( y, X, <<PRINTTOLOG></PRINTTOLOG>