外部スチューデント化された残差こんにちは、みんな!
最小二乗回帰のスチューデント化残差プロットに使用される外部スチューデント化残差にアクセスしたい顧客がいます。 誰もがプラットフォームの外でそれを計算する方法を持っているか、それらの値を取得する方法を知っていますか?
ベスト、
M
再:外部的に学生化された残差列の保存>スチューデント化残差は、そのグラフにプロットされる値のように見えます。
レディ
再:外部的に学生化された残差私もそう思いましたが、ドキュメントでは、彼らは違うと言います( https://www.jmp.com/support/help/14-2/row-diagnostics.shtml )。
M
再:外部的に学生化された残差私は数字を見ませんでしたが、レポートのマーカーセグメントから直接値を取得できます。
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 !
わかった!
また、私はこの昨夜に戸惑い、スチューデント化された残差を外部スチューデント化された残差に変換する方程式に偶然出会いました。 モデルの要素の数を指定するだけです。 この方程式は、ワイスブルクの応用線形回帰から外れています。第4版の216ページにあります。 すべてが1か所に収まるように、スクリプトの最後にスクリプトを追加しました。
ベスト、
M
</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) )
)
)
);