[R] adding a cubic spline to a model

Ellen Janssen ellen_jans_ at hotmail.com
Fri Mar 18 12:53:34 CET 2011















@font-face {
  font-family: "MS 明朝";
}@font-face {
  font-family: "Verdana";
}@font-face {
  font-family: "Verdana";
}@font-face {
  font-family: "Monaco";
}p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: Verdana; }.MsoChpDefault { font-family: Cambria; }div.WordSection1 { page: WordSection1; }




Greetings,

 

I am trying
to add a cubic spline to an NLME biological growth model. After looking in the
R-help archive, I’ve tried the functions ns() and bs() from the splines-package
and rcs() from the Design-package:

 

M7.W<-nlme(model= RW ~ (R*(RPrevYear/K)^m)*ns(Year,4)*exp(m*((1-RPrevYear^2/K^2)/2)), data=data, fixed=R+K+m~1, random= R+K~1|IDPlot, start= c(R=3, K=90, m=0.1), correlation=corARMA(p=2, q=0, form= ~Year))

 

All of them
give the same error-message: 

 

Error in
X[, fmap[[nm]]] <- gradnm : 

  number of items to replace is not a multiple
of replacement length

 

Am I using
the ns() function wrongly or should I use another function?

 

Thanks for
any hints,

 

Ellen,

Msc
student, KULeuven, Belgium


 		 	   		  


More information about the R-help mailing list