[R] varIdent error using gam function in mgcv

niallllll n.mcginty1 at nuigalway.ie
Fri Jun 18 19:35:24 CEST 2010


Hello,

As I am relatively new to the R environment this question may be either
a) Really simple to answer
b) Or I am overlooking something relatively simple.

I am trying to add a VarIdent structure to my gam model which is fitting
smoothing functions to the time variables year and month for a particular
species. When I try to add the varIdent weights to variable Month I get this
error returned. 

Error in model.frame.default(formula = Chel ~ 1 + M + YM + M + YM, weights =
Vf1,  : 
  variable lengths differ (found for '(weights)')

Here is the simple code I am using.
library(mgcv); library(lattice)
library(nlme)
Vf1=varIdent(form=~M)
Chel2=gam(Chel~s(M, fx=F, bs="tp")+ s(YM, fx=F, bs="tp")+s(M,YM, fx=F,
bs="tp"), family=poisson(link="log"), weights=Vf1) # second GAM  with
interaction

M=Month
YM=Year

Regards,
Niall
-- 
View this message in context: http://r.789695.n4.nabble.com/varIdent-error-using-gam-function-in-mgcv-tp2260556p2260556.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list