[R] varIdent error using gam function in mgcv

Joris Meys jorismeys at gmail.com
Sat Jun 19 03:16:04 CEST 2010


How exactly do you want to define your weights? varIdent returns a
varFunc object, not a vector with the same length as the data
variables, as required by the gam function.

Cheers
Joris

On Fri, Jun 18, 2010 at 7:35 PM, niallllll <n.mcginty1 at nuigalway.ie> wrote:
>
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



More information about the R-help mailing list