[R] plot.gam help

Andrew Crane-Droesch andrewcd at gmail.com
Sat Nov 14 23:16:46 CET 2015


Your problem is that you've specified a parametric linear model. Your 
output is a set of parametric coefficients.  You can replace `gam` with 
`lm` in your example, and you'll get identical results. If you wish to 
specify one of the terms nonparametrically, you'd use s(chlag), for 
example (assuming you're using mgcv).



On 11/13/2015 10:59 PM, Pollyanna Fisher via R-help wrote:
>   Hello, I've created a list of gams and for my last step I'd like to plot them but I keep getting an error method. Here is an example of one of themI appreciate your help
>
> Gam1s=gam(E1~chlag +chla + waveMax + SST + IRR + site + day +chlag:site, family=gaussian)
> summary(Gam1s)
>
> Family: gaussian
> Link function: identity
>
> Formula:
> E1 ~ chlag + chla + waveMax + SST + IRR + site + day + chlag:site
>
> Parametric coefficients:
>                  Estimate Std. Error t value Pr(>|t|)
> (Intercept)    1.059e+02  6.153e-01 172.154  < 2e-16 ***
> chlag         -3.112e+01  4.356e+00  -7.144 1.25e-12 ***
> chla          -1.380e+01  1.650e+00  -8.359  < 2e-16 ***
> waveMax        6.718e-03  8.450e-04   7.950 3.02e-15 ***
> SST            2.627e-02  9.210e-03   2.853  0.00438 **
> IRR           -4.702e-02  6.665e-03  -7.055 2.33e-12 ***
> siteJOH       -6.356e+00  7.508e-01  -8.465  < 2e-16 ***
> siteKUR       -4.291e+00  4.497e-01  -9.540  < 2e-16 ***
> day            1.208e-03  4.348e-04   2.777  0.00554 **
> chlag:siteJOH  3.582e+01  7.436e+00   4.817 1.56e-06 ***
> chlag:siteKUR  3.083e+01  4.602e+00   6.699 2.68e-11 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
> R-sq.(adj) =  0.294   Deviance explained = 29.8%
> GCV = 3.9675  Scale est. = 3.9469    n = 2126
>
> plot(Gam1s)
> Error in plot.gam(Gam1s) :
>    No terms to plot - nothing for plot.gam() to do.
>> plot.gam(Gam1s)
> Error in plot.gam(Gam1s) :
>    No terms to plot - nothing for plot.gam() to do.
>> plot.gam(E1~chlag +chla + waveMax + SST + IRR + site + day +chlag:site, family=gaussian)
> Error in if (se && x$Vp[1, 1] < 0) { :
>    missing value where TRUE/FALSE needed
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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