rug_model: Add rug to plot, based on model.

View source: R/plot.R

rug_modelR Documentation

Add rug to plot, based on model.

Description

Add rug based on model data.

Usage

rug_model(
  model,
  view,
  cond = NULL,
  data.rows = NULL,
  rm.ranef = NULL,
  print.summary = getOption("itsadug_print"),
  ...
)

Arguments

model

gam or bam object.

view

Text string containing the name of the smooth to be displayed. Note that variables coerced to factors in the model formula won't work as view variables.

cond

A named list of the values to use for the other predictor terms (not in view). Used for choosing between smooths that share the same view predictors.

data.rows

Vector of numbers (indices of rows in data) or vector of logical vales (same length as rows in data) for selecting specific data points.

rm.ranef

Logical: whether or not to remove random effects. Default is TRUE.

print.summary

Logical: whether or not to print information messages. Default set to the print info messages option (see infoMessages).

...

Optional graphical parameters (see rug).

Author(s)

Jacolien van Rij

See Also

Other Functions for plotting: fadeRug()

Examples

plot(cars$speed, cars$dist, pch=16, col=alpha(1))
lm1 <- lm(dist ~ speed, dat=cars)
abline(lm1, col='red', lwd=2)
rug_model(lm1, view='speed')
rug_model(lm1, view='dist', side=2)

## Not run: 
library(itsadug)
data(simdat)
m1 <- bam(Y ~ Group + te(Time, Trial, by=Group), data=simdat)
# plot:
fvisgam(m1, view=c('Time', 'Trial'), cond=list(Group='Adults'))
rug_model(m1, view='Time', cond=list(Group='Adults'))
rug_model(m1, view='Trial', cond=list(Group='Adults'), side=2)

## End(Not run)

itsadug documentation built on June 17, 2022, 5:05 p.m.