qdo: Manipulating the output of 'mqgam'

Description Usage Arguments Value Author(s) Examples

View source: R/qdo.R

Description

Contrary to qgam, mqgam does not output a standard gamObject, hence methods such as predict.gam or plot.gam cannot be used directly. qdo provides a simple wrapper for such methods.

Usage

1
qdo(obj, qu = NULL, fun = I, ...)

Arguments

obj

the output of a mqgam call.

qu

A vector whose elements must be in (0, 1). Each element indicates a quantile of interest, which should be an element of names(obj$fit). If left to NULL the function fun will be applied to each of the quantile fits in obj.

fun

The method or function that we want to use on the gamObject corresponding to quantile qu. For instance predict, plot or summary. By default this is the identity function (I), which means that the fitted model for quantile qu is returned.

...

Additional arguments to be passed to fun.

Value

A list where the i-th entry is the output of fun (whatever that is) corresponding to quantile qu[i].

Author(s)

Matteo Fasiolo <matteo.fasiolo@gmail.com>.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(qgam); library(MASS)

quSeq <- c(0.4, 0.6)
set.seed(737)
fit <- mqgam(accel~s(times, k=20, bs="ad"), data = mcycle, qu = quSeq)

qdo(fit, 0.4, summary)
invisible(qdo(fit, 0.4, plot, pages = 1))

# Return the object for qu = 0.6 and then plot it
tmp <- qdo(fit, 0.6)
plot(tmp)

qgam documentation built on Nov. 23, 2021, 1:07 a.m.