plot_gam: Plot a generalized additive model

Description Usage Arguments Examples

Description

Plot a generalized additive model

Usage

1
2
3
4
5
plot_gam(x, y, g = NULL, data, fittype = c("gam", "lm"), kgam = 4,
  R = NULL, randommethod = c("gamm", "aggregate"), log = "",
  axes = TRUE, fitoneline = FALSE, pointcols = NULL, linecols = NULL,
  xlab = NULL, ylab = NULL, band = TRUE, bandcolor = alpha("lightgrey",
  0.7), plotit = TRUE, add = FALSE, npred = 101, lwd = 2, ...)

Arguments

x

Variable for X axis (unquoted)

y

Variable for Y axis (unquoted)

g

Variable for grouping (unquoted); optional

data

Dataframe containing x and y

kgam

the k parameter for smooth terms in gam.

R

An optional random effect (quoted)

randommethod

If 'gamm', passes the random effect variable to gamm, otherwise simply averages the data by the random effect variable.

log

Whether to add log axes for x or y (but no transformations are done).

fitoneline

Whether to fit only one curve to the entire dataset, regardless of whether a grouping variable was defined

pointcols

Colours of the points, can be a vector

linecols

Colours of the linces, can be a vector

xlab

X-axis label

ylab

Y-axis label

band

Logical. If true, plots the confidence band (as a transparent polygon).

Examples

1
2
3
4
5
6
7
8
data(Loblolly)
plot_gam(age, height, data=Loblolly)
plot_gam(age, height, Seed, data=Loblolly, band=FALSE, linecols="black")
plot_gam(age, height, Seed, data=Loblolly, band=FALSE, linecols="black", fittype="lm")

data(ChickWeight)
library(wesanderson)
plot_gam(Time, weight, Diet, R="Chick", data=ChickWeight, linecols=wes_palette("Rushmore"))

RemkoDuursma/plover documentation built on May 9, 2019, 9:39 a.m.