term.plot {gamlss}R Documentation

Plot regression terms for a specified parameter of a GAMLSS object

Description

Plots regression terms against their predictors, optionally with standard errors and partial residuals added. It is almost identical to the R function termplot suitably changed to apply to GAMLSS objects.

Usage

term.plot(object, what = c("mu", "sigma", "nu", "tau"), data = NULL, 
          envir = environment(formula(object)), 
          partial.resid = FALSE, rug = FALSE, 
          terms = NULL, se = TRUE, xlabs = NULL, ylabs = NULL, 
          main = NULL, col.term = 2, lwd.term = 1.5, 
          col.se = "orange", lty.se = 2, lwd.se = 1, 
          col.res = "gray", cex = 1, pch = par("pch"), 
          col.smth = "darkred", lty.smth = 2, 
          span.smth = 2/3, 
          ask = interactive() && nb.fig < n.tms && .Device != "postscript", 
          use.factor.levels = TRUE, smooth = NULL,  ylim  = "common", ...)

Arguments

object

a GAMLSS object

what

the required parameter of the GAMLSS distribution

data

data frame in which variables in object can be found

envir

environment in which variables in object can be found

partial.resid

logical; should partial residuals be plotted?

rug

add rug plots (jitter 1-d histograms) to the axes?

terms

which terms to plot (default 'NULL' means all terms)

se

plot point-wise standard errors?

xlabs

vector of labels for the x axes

ylabs

vector of labels for the y axes

main

logical, or vector of main titles; if 'TRUE', the model's call is taken as main title, 'NULL' or 'FALSE' mean no titles.

col.term, lwd.term

colour and width for the "term curve", see 'lines'.

col.se, lty.se, lwd.se

colour, line type and line width for the "twice-standard-error curve" when 'se = TRUE'.

col.res, cex, pch

colour, plotting character expansion and type for partial residuals, when 'partial.resid = TRUE', see 'points'.

lty.smth,col.smth, span.smth

Passed to 'smooth'

ask

logical; if 'TRUE', the user is asked before each plot, see 'par(ask=.)'.

use.factor.levels

Should x-axis ticks use factor levels or numbers for factor terms?

smooth

'NULL' or a function with the same arguments as 'panel.smooth' to draw a smooth through the partial residuals for non-factor terms

ylim

an optional range for the y axis, or "common" when a range sufficient for all the plot will be computed, or "free" when limits are computed for each plot.

...

other graphical parameters

Details

The function uses the lpred function of GAMLSS. The 'data' argument should rarely be needed, but in some cases 'termplot' may be unable to reconstruct the original data frame. Using 'na.action=na.exclude' makes these problems less likely. Nothing sensible happens for interaction terms.

Value

a plot of fitted terms.

Author(s)

Mikis Stasinopoulos based on the existing termplot() function

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.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

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, http://www.jstatsoft.org/v23/i07.

See Also

termplot

Examples

data(aids)
a<-gamlss(y~pb(x)+qrt,data=aids,family=NBI)
term.plot(a, se=TRUE)
rm(a)

[Package gamlss version 4.3-0 Index]