Description Usage Arguments Value Author(s) References See Also Examples

A plot method for GAM objects, which can be used on GLM and LM objects as well. It focuses on terms (main-effects), and produces a suitable plot for terms of different types

1 2 3 4 |

`x` |
a |

`object` |
same as |

`residuals` |
if |

`rugplot` |
if |

`se` |
if |

`scale` |
a lower limit for the number of units covered by the limits on the ‘y’ for each plot. The default is |

`ask` |
if |

`newdata` |
if supplied to |

`terms` |
subsets of the terms can be selected |

`...` |
Additonal plotting arguments, not all of which will work (like xlim) |

a plot is produced for each of the terms in the object `x`

. The function currently knows how to plot all main-effect functions of one or two predictors. So in particular, interactions are not plotted. An appropriate ‘x-y’ is produced to display each of the terms, adorned with residuals, standard-error curves, and a rugplot, depending on the choice of options. The form of the plot is different, depending on whether the ‘x’-value for each plot is numeric, a factor, or a matrix.

When `ask=TRUE`

, rather than produce each plot sequentially, `plot.gam()`

displays a menu listing all the terms that can be plotted, as well as switches for all the options.

A `preplot.gam`

object is a list of precomputed terms. Each such
term (also a `preplot.gam`

object) is a list with components
`x`

, `y`

and others—the basic ingredients needed for each
term plot. These are in turn handed to the specialized plotting function
`gplot()`

, which has methods for different classes of the leading
`x`

argument. In particular, a different plot is produced if
`x`

is numeric, a category or factor, a matrix, or a
list. Experienced users can extend this range by creating more
`gplot()`

methods for other classes. Graphical parameters (see
`par`

) may also be supplied as arguments to this function.
This function is a method for the generic function `plot()`

for
class `"gam"`

.

It can be invoked by calling `plot(x)`

for an
object `x`

of the appropriate class, or directly by
calling `plot.gam(x)`

regardless of the
class of the object.

Written by Trevor Hastie, following closely the design in the "Generalized Additive Models" chapter (Hastie, 1992) in Chambers and Hastie (1992).

Hastie, T. J. (1992)
*Generalized additive models.*
Chapter 7 of *Statistical Models in S*
eds J. M. Chambers and T. J. Hastie, Wadsworth \& Brooks/Cole.

Hastie, T. and Tibshirani, R. (1990)
*Generalized Additive Models.*
London: Chapman and Hall.

1 2 3 4 5 |

```
Loading required package: splines
Loading required package: foreach
Loaded gam 1.14-4
$`s(x, 6)`
$x
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
$y
1 2 3 4 5 6
0.44379143 0.75360796 0.85468111 0.80512984 0.51279094 0.07523574
7 8 9 10
-0.42622549 -0.80005872 -0.96321574 -1.01594919
$se.y
NULL
$xlab
[1] "x"
$ylab
[1] "s(x, 6)"
attr(,"class")
[1] "preplot.gam"
$z
$x
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
$y
1 2 3 4 5 6
0.039428080 0.028567775 0.017707471 0.006847166 -0.004013139 -0.014873443
7 8 9 10
-0.025733748 -0.036594052 -0.047454357 -0.058314661
$se.y
NULL
$xlab
[1] "z"
$ylab
[1] "partial for z"
attr(,"class")
[1] "preplot.gam"
attr(,"class")
[1] "preplot.gam"
Warning message:
In newdata.predict.gam(object, newdata, type, dispersion, se.fit, :
No standard errors (currently) for gam predictions with newdata
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.