The function crossval (in library bootstrap) works well for the first degree polynomial model, but in the case of the second degree model I got an error message (see below). I would be very greatfull if somebody could give some advices for the following:
library(bootstrap)
x<-c(22,23.4,24.9,28.5,29.8,31.6,34.2,36.4,37.7,39)
y<-c(96,88,105,111,107,113,132,122,135,131)
theta.fit<-function(x,y){lsfit(x,y)$coef}
theta.predict<-function(fit,x){
+ cbind(1,x) %*% fit}
results <- crossval(cbind(x,x^2),y,theta.fit,theta.predict)
Error in cbind(1, x) %*% fit : non-conformable arguments Tapio Nummi University of Tampere Finland -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010307/d825e038/attachment.html