plotVarReg: Plots graphics for a mean and variance regression model

View source: R/plotVarReg.R

plotVarRegR Documentation

Plots graphics for a mean and variance regression model

Description

plotVarReg to produce graphics for models fit in this package.

Usage

plotVarReg(
  x,
  knot.lines = FALSE,
  ci = FALSE,
  ci.type = c("im", "boot"),
  bootreps = 1000,
  xlab = "x",
  ylab = "y",
  control = list(...),
  ...
)

Arguments

x

Object of class VarReg (see semiVarReg).

knot.lines

Logical to indicate if knot lines should be shown on graphics (if model is type "semi"). Default is FALSE

ci

Logical indicate if 95% CI should be shown on the plots. Default is FALSE and ci.type="im".

ci.type

Text to indicate the type of CI to plot. Either "im" (information matrix) or "boot" (bootstrapped). Default is "im".

bootreps

Integer to indicate the number of bootstrap replications to be performed if ci.type="boot". Default is 1000.

xlab

Text for the label to be placed on the x axis of graphics (covariate)

ylab

Text for the label to be placed on the y axis of graphics (outcome)

control

list of control parameters to be used in bootstrapping. See VarReg.control.

...

arguments to be used to form the default control argument if it is not supplied directly

Value

This function returns a 2x2 plot, with slightly different plots given, depending on the outcome data. For uncensored data, the plots are:

  • the mean function over the x-variable, with or without 95% CI, and with or without the knot lines indicated

  • the variance function over the x-variable, with or without 95% CI and with or without the knot lines indicated

  • a Q-Q plot of the residuals from the model

  • a histogram of the residuals from the model

If the outcome data is censored, the last two plots are no longer appropriate. Given the censored residuals from the model, we can compare the squared standardised residuals (given in black) with their censoring indicator to the chi-squared distribution with one degree of freedom (given in red). This is one of the plots given for censored data, and the other is a plot of the data, coloured by the censoring status. The triangles with the point at the top are bottom censored and the triangles with the point at the bottom are top censored.

See Also

semiVarReg, VarReg.control

Examples

data(mcycle)
linmodel<-semiVarReg(mcycle$accel, mcycle$times, meanmodel="linear", varmodel="linear",
maxit=10000)
plotVarReg(linmodel)
plotVarReg(linmodel, ci=TRUE, ci.type="im", ylab="Range", xlab="Time in seconds")
##not run
##plotVarReg(linmodel, ci=TRUE, ci.type="boot", bootreps=10,ylab="Acceleration",
##xlab="Time in seconds")

##not run
##semimodel<-semiVarReg(mcycle$accel, mcycle$times, meanmodel="semi", varmodel="semi",
##knots.m=4, knots.v=2, maxit=10000)
##plotVarReg(semimodel, ci=TRUE, ci.type="boot",bootreps=10,ylab="Acceleration",
##xlab="Time in seconds", maxit=10000)

VarReg documentation built on May 31, 2023, 8:44 p.m.