Displaying 1 result from an estimated 1 matches for "handrecurse".
2004 Sep 15
1
adding observations to lm for fast recursive residuals?
...putes recursive residuals *quickly*?
PS: (I looked at package strucchange, but if I am not mistaken, the
recresid function there takes longer than iterating over the models
fresh from start to end.) I know the two functions do not do the same
thing, but the main part (OLS) is the same:
> handrecurse.test <- function( y, x ) { z<- rep(NA, T); for (i in
2:T) { z[i] <- coef(lm(y[1:i] ~ x[1:i]))[2]; }; return(z); }
> system.time(handrecurse.test(y,x))
[1] 0.69 0.00 0.70 0.00 0.00
> system.time(length(recresid( y~x )))
[1] 1.44 0.07 1.59 0.00 0.00
pointers appreciated...