[R] plot.gam help
Bert Gunter
bgunter.4567 at gmail.com
Sun Nov 15 06:48:42 CET 2015
Please always cc the list to assure a better chance of getting a good answer.
I dunno. I assume you could control scaling through xlim and/or ylim
arguments as "..." arguments. See ?plot.default and linked Help if you
don't know about graphical parameters. If you don't know what "..."
arguments are about, time to do some homework and read an R tutorial
or two (the Intro to R tutorial that ships with R is pretty good on
this). You may have to do some experimentation to get what you want,
which is rather obscure to me from your comment.
Note, however, that you should probably be using lm() and not gam() to
begin with, for which the associated plotting might be better.
Cheers,
Bert
Bert Gunter
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
-- Clifford Stoll
On Sat, Nov 14, 2015 at 9:31 PM, Pollyanna Fisher <pollyannaf at yahoo.com> wrote:
> Thank you Bert,
> This fixed the issue and I can now see my plots,
> However, they appear to be in an very skewed scale where it is showing me
> the prediction line starting at 0 and the plotted values way below it, in a
> way that is not quite understandable. Is there a way to scale the plot
> differently?
>
> ________________________________
> From: Bert Gunter <bgunter.4567 at gmail.com>
> To: Andrew Crane-Droesch <andrewcd at gmail.com>
> Cc: Pollyanna Fisher <pollyannaf at yahoo.com>; "r-help at r-project.org"
> <r-help at r-project.org>
> Sent: Saturday, November 14, 2015 12:22 PM
> Subject: Re: [R] plot.gam help
>
> Yes. And see the "all.terms" parameter of plot.gam(), which by default
> is FALSE, yielding the error message reported.
>
> Cheers,
> Bert
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> -- Clifford Stoll
>
>
> On Sat, Nov 14, 2015 at 2:16 PM, Andrew Crane-Droesch
> <andrewcd at gmail.com> wrote:
>> 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.
>
>
>
>>
>>
>> ______________________________________________
>> 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