[R] Plot with residuals in mgcv

Simon Wood s.wood at bath.ac.uk
Thu Nov 29 12:47:55 CET 2012


Hi Silje,

Thanks for this. I guess RUTE is a numeric variable in this model and 
hence only has one associated random coefficient? This then causes a 
problem when calling predict.gam as part of processing 'residuals=T'. 
I've fixed the problem for the next release, but did you really want a 
single random slope for RUTE, or should it really have been declared as 
a factor variable? btw gamma doesn't do anything with ML and REML 
smoothness selection (it's only used in prediction error criteria 
smoothness selection to increase the penalization per effective degrees 
of freedom).

best,
Simon

On 28/11/12 13:02, silje skår wrote:
> Hi,
>
> I am using the mgcv package (version 1.7-22.) running the model works fine,
> but when I want to have a plot with residuals I get an error.
>
> fit29<-gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method="ML")
>
>
> plot(fit29,residuals=T)
> Error in X[, first:last] %*% object$coefficients[first:last] :
>    non-conformable arguments
>
> does some one know what this error means? the subsf matrix is 35x27.
>
> Silje
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.




More information about the R-help mailing list