plot.pblm: Plotting terms for a 'pblm' object

View source: R/pblm_0.1-12.R

plot.pblmR Documentation

Plotting terms for a pblm object

Description

Plotting fixed or smooth terms for a pblm object

Usage

## S3 method for class 'pblm'
plot(x, which.eq=1:3, which.var=1:x$maxNpred, add.bands=TRUE,
                    type="l",col.line=list("blue"), col.bands=NULL, 
                    dashed.bands=FALSE, pause = FALSE, ylim, xlim, ylab, xlab, 
                    main, overlaid_pvc=TRUE,...)

Arguments

x

An object of class pblm.

which.var

Index of the smoother term, indicating its position in the model formula.

which.eq

Equation index identifying the component (marginal or association) where the smoother is applied.

add.bands

Logical. Should confidence bands for the smoother be added to the plot?

col.bands

Color to be used for the confidence bands.

col.line

Color to be used for the smoother line. Different colors are allowed when using pvc().

type

Graphical parameter specifying the plot type.

dashed.bands

Logical. If TRUE (and add.bands is also TRUE), dashed confidence bands will be drawn instead of filled color bands.

pause

Logical. If TRUE, the user will be prompted to press a key before each plot is displayed.

ylim

Graphical parameter defining the limits of the y-axis.

xlim

Graphical parameter defining the limits of the x-axis.

ylab

Graphical parameter specifying the label for the y-axis.

xlab

Graphical parameter specifying the label for the x-axis.

main

Graphical parameter specifying the main title of the plot.

overlaid_pvc

Logical. Under development, currently ignored.

...

Further graphical parameters to be passed to the plotting functions.

Details

This function works similarly to the termplot function for many statistical models, and is based on the predict method. The argument overlaid_pvc is currently ignored because, although implemented, the smoother function pvc() for fitting penalized varying coefficient models is still experimental and not included in this version of the package.

Value

Returns the plots of the partial effects for the terms specified in the model formula, or for a specific term identified by which.equation and which.term.

In addition, a variable-length list is returned, containing one object for each term included in the model formula or selected via which.equation and which.term. Each object is named by concatenating the equation type and the term name, and consists of a data frame with as many rows as the original dataset and four columns: the x-axis values, the y-axis values, the 95% lower bounds, and the 95% upper bounds.

For example, consider a variable named v included in the model for both marginals and the association. The returned list would include:

mar1:v

A data frame containing the plotting data for variable v in the first marginal.

mar2:v

A data frame containing the plotting data for variable v in the second marginal.

ass12:v

A data frame containing the plotting data for variable v in the association component.

...

Additional data frames, depending on the number of terms involved.

Author(s)

Marco Enea

See Also

pb, pbs

Examples

#NOT RUN 
# an artificial data set: 
set.seed(123)
da <- expand.grid("Y1"=1:3,"Y2"=1:3,"v1"=0:4,"fat2"=0:1)
da$Freq <- sample(0:20,3*3*5*2,replace=TRUE)
da$x1 <- rnorm(90)
#the bivariate additive proportional-odds model
m7 <- pblm(fo1=cbind(Y1,Y2) ~ v1 + fat2 + pb(x1), data=da, weights=Freq)
plot(m7)

pblm documentation built on June 19, 2025, 5:08 p.m.