외부 학생 잔류 물안녕!
Least Squares Regression의 학생 잔차 그림에 사용되는 외부 학생 잔차에 액세스하려는 고객이 있습니다. 누구나 플랫폼 외부에서 그것을 계산하거나 그 값을 얻는 방법을 알고 있습니까?
베스트,
엠
재 : 외부 학생 잔류 물저에게 열 저장> 학생 화 된 잔차가 해당 그래프에 그려진 값인 것처럼 보입니다.
레디
재 : 외부 학생 잔류 물나도 그렇게 생각했지만 의사의 말에서 그들은 다르다 ( 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");재 : 외부 학생 잔류 물그것 참 흥미 롭네. 사용 가능한 항목을 보려면 플롯에서 마우스 오른쪽 버튼을 클릭하고 사용자 정의를 선택했습니다. 내가 사용할 수있는 것은 없으므로 세그먼트를 생각하지 않았습니다.
재 : 외부 학생 잔류 물그러나이 방법은 결코 실패하지 않았습니다 (아직. . . ).
재 : 외부 학생 잔류 물대박! 감사, ian !
알았어!
또한, 나는 지난 밤에이 문제에 대해 수수께끼를 떨고 있었고 학생 화 된 잔차를 외부 학생 화 된 잔차로 변환하는 방정식을 발견했습니다. 모델의 요소 수만 제공하면됩니다. 이 방정식은 Weisburg의 Applied Linear Regression에서 벗어났습니다. 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) )
)
)
);