library("gamlss2")
data("film90", package = "gamlss.data")
## model formula
<- ~ s(lboopen) + s(lnosc)
f <- rep(list(f), 4)
f 1]] <- update(f[[1]], lborev1 ~ .)
f[[
## estimate model
<- gamlss2(f, data = film90, family = BCCG)
b1
## plot effects (default)
plot(b1)
## plot specific effect
plot(b1, parameter = "sigma")
plot(b1, model = "sigma")
plot(b1, model = "nu", term = 1)
plot(b1, model = "nu", term = 2)
plot(b1, model = "nu", term = "lnosc")
plot(b1, term = "lnosc")
## plot all residual diagnostics
plot(b1, which = "resid")
## single diagnostic plots
plot(b1, which = "hist-resid")
plot(b1, which = "qq-resid")
plot(b1, which = "wp-resid")
plot(b1, which = "scatter-resid")
## estimate another model
<- gamlss2(f, data = film90, family = BCPE)
b2
## compare estimated effects
plot(c(b1, b2))
plot(c(b1, b2), term = "lboopen",
col = c(1, 4), lwd = 3, lty = 1,
pos = c("topleft", "topright", "bottomleft", "bottomright"))
plot(c(b1, b2), model = "sigma")
plot(c(b1, b2), model = "sigma", term = 2)
plot(c(b1, b2), model = c("mu", "nu"))
Plotting GAMLSS
Description
Plotting methods for objects of class “gamlss2”
and “gamlss2.list”
, which can be used for effect plots of model terms or residual plots. Note that effect plots of model terms with more than two covariates are not supported, for this purpose use the predict
method.
Usage
## S3 method for class 'gamlss2'
plot(x, parameter = NULL,
which = "effects", terms = NULL,
scale = TRUE, spar = TRUE, ...)
## S3 method for class 'gamlss2.list'
plot(x, parameter = NULL, which = "effects",
terms = NULL, spar = TRUE, legend = TRUE, ...)
Arguments
x
|
An object of class “gamlss2” or “gamlss2.list” , which can be created by using the c() method combining “gamlss2” objects. See th examples.
|
parameter
|
Character or integer. For which parameter/model/what should the plots be created? Note that instead of argument parameter plots can also be specified passing argument model and what to ….
|
which
|
Character or integer, selects the type of plot: “effects” produces effect plots of (special) model terms, “hist-resid” shows a histogram of residuals, “qq-resid” shows a quantile-quantile plot of residuals, “scatter-resid” shows a scatter plot of residuals with fitted values for the distribution mean (or median, if available in the family object).
|
terms
|
Character or integer. For which model term should the plot(s) be created? |
scale
|
If set to 1 , effect plots all have the same scale on the y-axis. If set to 0 each effect plot has its own scale for the y-axis.
|
spar
|
Should graphical parameters be set? |
legend
|
Should a legend be added using multiple model plots? |
…
|
Arguments such as lwd , lty , col , legend = TRUE (for multiple model plots), a.o., depending on the type of plot. See the examples.
|
See Also
gamlss2
.