外部學生殘餘大家好!
我有一個客戶希望訪問用於最小二乘回歸中的學生殘差圖的外部學生化殘差。 任何人都有辦法在平台之外計算或知道如何獲得這些值?
最好,
中號
回复:外部學生殘留在我看來,像保存列>學生化殘差是在該圖上繪製的值。
霍勒迪
回复:外部學生殘留我也這麼認為,但是在醫生說他們是不同的( https://www.jmp.com/support/help/14-2/row-diagnostics.shtml )。
中號
回复:外部學生殘留我沒有查看任何數字,但您可以直接從報告中的標記段獲取值:
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Fit Model
fm = dt << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 0 ), Analysis of Variance( 0 ),
Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 1 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )}
),
SendToReport(
Dispatch(
{"Response height", "Whole Model"},
"Regression Plot",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response height", "Whole Model"},
"Actual by Predicted Plot",
OutlineBox,
{Close( 1 )}
)
)
);
// Get values directly from the marker seg . . .
fmRep = Report(fm);
frame = fmRep[FrameBox(4)];
mySeg = (frame << Find Seg( Marker Seg( 1 ) ));
xVals = mySeg << Get X Values;
yVals = mySeg << Get Y Values;
dt2 = asTable(xVals||yVals, << columnNames({"Row Number", "Studentized Residual"}));
dt2 << setName("Residuals");回复:外部學生殘留這太有趣了。我嘗試右鍵單擊並在繪圖中選擇“自定義”以查看可用的內容。沒有什麼我可以使用,所以我沒有想到細分。
回复:外部學生殘留FWIW,這種方法從未讓我失望(但是。。。)。
回复:外部學生殘留真棒!謝謝, @ian_jmp !
得到了他們!
此外,我昨晚對此感到困惑,偶然發現了一個將學生化殘差轉換為外部學生殘差的方程式。 您只需要提供模型中的多個因子。 該等式超出了Weisburg的應用線性回歸。它是在第4版的第216頁。 我在腳本的末尾添加了一個腳本,以便一切都在一個地方。
最好,
中號
</CODE></P>
<PRE><CODE class=" language-jsl">Names Default To Here( 1 );
Clear Log();
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Fit Model
fm = dt << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 1 ), Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )}
),
SendToReport(
Dispatch( {"Response height", "Whole Model"}, "Regression Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response height", "Whole Model"}, "Actual by Predicted Plot", OutlineBox, {Close( 1 )} )
)
);
/*METHOD 1
Pull Externally Studentized Residuals from the plot */
// Grab the report object
fmRep = Report( fm );
// Grab the ESR plot frame box
frame = fmRep[FrameBox( 4 )];
// Grab the marker segment in the frame box and pull the values
mySeg = (frame << Find Seg( Marker Seg( 1 ) ));
yVals = mySeg << Get Y Values;
/*METHOD 2
Convert Studentized Residuals to Externally Studentized Residuals (Applied Linear Regression, 4th Ed, 2014 - pg 216)
note the denominator removes one df for the intercept so p should be the df from the model ANOVA*/
// define the total number of terms in the model from the model ANOVA
p = 1;
//export the studentized residuals to the data table and gather table information
fm << Studentized Residuals;
r = Column( N Cols() );
n = N Rows( dt );
// create a blank matrix for the values
ESR = [];
// loop through the residuals matrix (last column in the dt) and calculate the ESR.
For( i = 1, i <= n, i++,
// calculation per reference above
k = r[i] * Sqrt( (n - p - 2) / (n - p - 1 - (r[i] ^ 2)) );
// insert the ESR value into the matrix
ESR = V Concat( ESR, k );
);
// create a new column in the data table with the values (from both methods and method 2 as a formula column)
dt << New Column( "Externally Studentized Residuals (From Report)", Set Values( yVals ) );
dt << New Column( "Externally Studentized Residuals", Set Values( ESR ) );
dt << New Column( "Externally Studentized Residuals (Formula)",
Formula(
Parameter(
{p = 1},
:Studentized Resid height * Sqrt( (N Rows() - p - 2) / (N Rows() - p - 1 - :Studentized Resid height ^ 2) )
)
)
);