If an answer is illustrated with R code, it would be even more gratefully accepted.
Asked
Active
Viewed 3,356 times
3
whuber
- 322,774
1 Answers
7
For linear regression model, given the hat matrix
$$ H = X (X'X)^{-1} X' $$
and residuals $e_i$, PRESS can be calculated as (see also here):
$$ \mathrm{PRESS} = \sum_i \left( \frac{e_i}{1-h_{ii}}\right)^2$$
This can be easily translated to the simple function:
PRESS <- function(linear.model) {
pr <- residuals(linear.model)/(1 - lm.influence(linear.model)$hat)
sum(pr^2)
}
-
May I ask you to please take a look at https://stats.stackexchange.com/questions/476935/the-best-way-to-compute-the-press-statistic and at https://stats.stackexchange.com/questions/476913/what-assumptions-must-be-satisfied-to-use-r2-to-compute-the-f-statistic – BillB Jul 13 '20 at 23:04
vbutton on the left of the answer) or upvote it (the upper arrow button) so it is clear that you received an answer and are satisfied with it, see http://stats.stackexchange.com/tour to learn more. – Tim Nov 30 '16 at 09:55