fitted_terms: Plotting fitted additive terms

fitted_termsR Documentation

Plotting fitted additive terms

Description

The function fitted_terms() is doing what the function term.plot() is doing for GAMLSS models but it uses ggplot2 package. The function pe_terms() is synonymous to fitted_terms()

Usage

fitted_terms(object, 
          what = c("mu", "sigma", "nu", "tau"), 
          parameter = NULL, data = NULL, terms = NULL,
          envir = environment(formula(object)), 
          partial = FALSE, rug = FALSE, rug.sides = "b", 
          rug.col = "gray",  alpha = 0.2, 
          ylim = c("common", "free"), xlabs = NULL, 
          ylabs = NULL, main = NULL, term.col = "darkred", 
          resid.col = "lightblue", resid.alpha = 0.8, 
          resid.size = 1, nrow = NULL, ncol = NULL, 
          plots.per.page = 9, one.by.one = FALSE, 
          surface.gam = FALSE, polys = NULL, 
          polys.scheme = "topo", col.ribbon = "darksalmon",
          col.shaded = "gray", ...)

pe_terms(object, 
          what = c("mu", "sigma", "nu", "tau"), 
          parameter = NULL, data = NULL, terms = NULL,
          envir = environment(formula(object)), 
          partial = FALSE, rug = FALSE, rug.sides = "b", 
          rug.col = "gray",  alpha = 0.2, 
          ylim = c("common", "free"), xlabs = NULL, 
          ylabs = NULL, main = NULL, term.col = "darkred", 
          resid.col = "lightblue", resid.alpha = 0.8, 
          resid.size = 1, nrow = NULL, ncol = NULL, 
          plots.per.page = 9, one.by.one = FALSE, 
          surface.gam = FALSE, polys = NULL, 
          polys.scheme = "topo", col.ribbon = "darksalmon",
          col.shaded = "gray", ...)          
          

Arguments

object

a gamlss fitted model

what

which distribution parameters, i.e. "mu"

parameter

which distribution parameters (equivalent to what)

data

data frame in which variables in object can be found

terms

which terms to plot (default NULL means all terms); a vector passed to lpred(..., type = "terms", terms =*)

envir

environment in which variables in object can be found

partial

logical; should partial residuals be plotted?

rug

add rug plots to the axes

rug.sides

which side the rug "b"=bottom

rug.col

the colour for the rug

alpha

the alpha for the shade

ylim

there are two options here a) "common" and b) "free". The "common"" option plots all figures with the same ylim range and therefore allows the viewer to check the relative contribution of each terms compate to the rest. In the ‘free’ option the limits are computed for each plot seperatly.

xlabs

the x label

ylabs

the y label

main

title NOT WORKING

term.col

the colour of the line for term

resid.col

the colour of the partial residuals

resid.alpha

The alpha for the partial residuals

resid.size

the size of the partial residuals

nrow

the number or rows in a mupliple plot

ncol

the number of rows in a mupliple plot

plots.per.page

the number of plots per page in multiple plots

one.by.one

whether to plot the terms one by one

surface.gam

whether to use surface plot if a ga() term is fitted

polys

for GRMF models

polys.scheme

The polygone information file for MRF models

col.ribbon

he colour of the ribbon

col.shaded

he colour of the shaded area

...

for extra argument

Value

A multiple plot

Author(s)

Mikis Stasinopoulos

References

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, https://www.jstatsoft.org/v23/i07/.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

(see also https://www.gamlss.com/).

See Also

term.plot

Examples

data(aids)
a<-gamlss(y~pb(x)+qrt,data=aids,family=NBI)
fitted_terms(a, pages=1)
rm(a)

gamlss.ggplots documentation built on Sept. 3, 2023, 5:08 p.m.