plotQGAMs: Plot quantiles

Description Usage Arguments References Examples

View source: R/plotQGAMs.R

Description

Plot the results of a series of QGAM models (Fasiolo et al., 2017)

Usage

1
2
3
plotQGAMs(models, predictor, data, cols = c("#000080", "#1A1A9A",
  "#3333B3", "#4D4DCD", "#6666E6"), se = 2, xlab = NA, ylab = NA,
  main = NA, ylim = NA, ...)

Arguments

models

A list of QGAM models as generated by the mqgam() function in the qgam package.

predictor

The predictor to be plotted. This predictor needs to be present in the fitted models, as well as in data.

data

The data the QGAM models were fit to. Needs to include the response variable, as well as all predictors in these models.

cols

A vector of colors. The lines corresponding to the quantiles will be plotted in these colors.

se

The number of standard errors for the confidence intervals. Default: 2 (i.e., 95% confidence intervals)

References

Fasiolo M., Goude Y., Nedellec R., & Wood S. N. (2017). Fast calibrated additive quantile regression. URL: https://arxiv.org/abs/1707.03307.

Keuleers, E., Lacey, P., Rastle, K., & Brysbaert, M. (2012). The British Lexicon Project: Lexical decision data for 28,730 monosyllabic and disyllabic English words. Behavior Research Methods, 44(1), 287-304.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Remove outliers from the ld data set, which contains lexical 
# decision latencies from the British Lexicon Project (Keuleers 
# et al, 2012)
predictors = c("RT", "logFrequency", "Length", "logOLD20", "SND20")
ld = removeOutliers(ld, predictors)
ld = na.omit(ld)

# Tune learning rate for median
tune = tuneLearnFast(RT ~ s(logFrequency) + s(Length) + 
                          s(logOLD20) + s(SND20),
                     data = ld, qu = 0.5)
sigpar = tune$lsig

# Define quantiles
quants = c(0.10,0.25,0.50,0.75,0.90)

# Run qgam models
qgams = mqgam(RT ~ s(logFrequency) + s(Length) + s(logOLD20) + 
                   s(SND20),
                   data = ld, qu = quants, lsig = sigpar)

# Plot effect of frequency at quantiles
plotQGAMs(qgams, "logFrequency", ld)

PeterHendrix13/distWorkshop documentation built on Nov. 5, 2019, 2:51 p.m.