Displaying 2 results from an estimated 2 matches for "polymodel".
Did you mean:
colmodel
2011 Nov 09
3
Help with tryCatch with a for loop
...ocation.code == locs[s],]
plot(abund~year, data=sub.ECDO, main=locs[s])
#To plot the linear model for the specified location:
lmodel<-lm(abund~year, data=sub.ECDO)
abline(lmodel$coefficients[1],lmodel$coefficients[2],lty=2)
#To plot the polynomial model for the specified location:
polymodel<-lm(abund~year+I(year^2), data=sub.ECDO)
xv<-seq(min(sub.ECDO$year),max(sub.ECDO$year),0.1)
yv<-predict(polymodel,list(year=xv))
lines(xv,yv)
#To plot the logistic model
#####tryCatch
logis<-nls(abund~SSlogis(year,a,b,c),data=sub.ECDO)
yv<-predict(logis,list(year=xv))...
2010 Dec 04
2
Problem storing lm() model in a list
Hi all,
I recently wrote some code to store a number of polynomial models in a list and return this list. The model is returned fine, but when I make a subsequent call to predict(), I have an error. The code for polyModel selection is listed at the end of the email. Here is an example of the error:
> poly.fit <- polyModelSelection(x,y,10,F)
> for (d in 1:4) {
+ lm.model <- poly.fit$models[[d]]
+ curve(predict(lm.model,data.frame(x)),add=T,lty=d+1)
+ }
Error: variable 'poly(x, d, raw = T)'...