PRESS Calculation After Linreg
-
Ken-Cogger
- Posts: 13
- Joined: Wed Feb 15, 2012 7:58 pm
PRESS Calculation After Linreg
Is there a simple procedure for validating a linear regression with the predicted regression error sum of squares (PRESS) statistic other than writing code like
make x
# x1 x2
compute h =x*inv(tr(x)*x)*tr(x)
compute press =0.0
do i=1,N
compute press =press+(%resids(i)/(1-h(i,i)))^2
end do i
display press
The PRESS statistic is based on the leave-one-out validation approach and was published by
Allen, D. M. (1974), "The Relationship Between Variable Selection and Data Augmentation and a Method for Prediction," Technometrics, 16, 125–127
Thanks,
Ken Cogger.
make x
# x1 x2
compute h =x*inv(tr(x)*x)*tr(x)
compute press =0.0
do i=1,N
compute press =press+(%resids(i)/(1-h(i,i)))^2
end do i
display press
The PRESS statistic is based on the leave-one-out validation approach and was published by
Allen, D. M. (1974), "The Relationship Between Variable Selection and Data Augmentation and a Method for Prediction," Technometrics, 16, 125–127
Thanks,
Ken Cogger.
Re: PRESS Calculation After Linreg
The diagonals of the H matrix can be produced using PRJ with the XVX option. So the calculation can be done with (using the data set from the ROBUST.RPF example):
(Do you mean to have the denominator squared in your formula?)
Code: Select all
linreg logy
# constant logk logl
prj(xvx=px)
sstats %regstart() %regend() %resids^2/(1-px)>>press
-
Ken-Cogger
- Posts: 13
- Joined: Wed Feb 15, 2012 7:58 pm
Re: PRESS Calculation After Linreg
Thanks, Tom.
I was not aware of prj or sstats. They simplify my code a lot.
And, yes, the denominator should be squared in the calculation of PRESS.
Best wishes,
Ken.
I was not aware of prj or sstats. They simplify my code a lot.
And, yes, the denominator should be squared in the calculation of PRESS.
Best wishes,
Ken.