<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { margin-top: 0 ; margin-bottom: 0 }
--></style><title>cross-validation</title></head><body>
<div><br></div>
<div><br></div>
<div><font face="Courier"><br></font></div>
<div><font face="Courier">Dear R-users,</font></div>
<div><font face="Courier">I have the following problem:</font></div>
<div><font face="Courier">The function crossval (in library
bootstrap)</font></div>
<div><font face="Courier">works well for the first degree polynomial
model,</font></div>
<div><font face="Courier">but in the case of the second degree model I
got</font></div>
<div><font face="Courier">an error message (see below). What went
wrong?</font></div>
<div><font face="Courier" size="+1" color="#000000"><br>
> library(bootstrap)<br>
><br>
> x<-c(22,23.4,24.9,28.5,29.8,31.6,34.2,36.4,37.7,39)<br>
> y<-c(96,88,105,111,107,113,132,122,135,131)<br>
><br>
> theta.fit<-function(x,y){lsfit(x,y)$coef}<br>
> theta.predict<-function(fit,x){<br>
+ cbind(1,x) %*% fit}<br>
<br>
> results <-
crossval(cbind(x,x^2),y,theta.fit,theta.predict)<br>
Error in cbind(1, x) %*% fit : non-conformable arguments</font><br>
</div>
<div><font face="Courier" size="+1" color="#000000">Tapio
Nummi</font></div>
<div><font face="Courier" size="+1" color="#000000">University of
Tampere</font></div>
<div><font face="Courier" size="+1"
color="#000000">Finland</font></div>
</body>
</html>