plot.tramME: Plotting method for tramME objects

View source: R/predict.R

plot.tramMER Documentation

Plotting method for tramME objects

Description

Plot the conditional distribution evaluated at a grid of possible response values and a set of covariate and random effects values on a specified scale.

Usage

## S3 method for class 'tramME'
plot(
  x,
  newdata = model.frame(x),
  ranef = NULL,
  fix_smooth = TRUE,
  type = c("trafo", "distribution", "survivor", "density", "logdensity", "hazard",
    "loghazard", "cumhazard", "odds", "logodds", "quantile"),
  ...
)

Arguments

x

A tramME object.

newdata

an optional data frame of observations

ranef

Random effects (either in named list format or a numeric vector) or the word "zero". See Details.

fix_smooth

If FALSE, the random effects coefficients of the smooth terms are refitted to newdata. It's probably not what you want to do.

type

The scale on which the predictions are evaluated:

  • trafo: The prediction evaluated on the scale of the transformation function.

  • distribution: The prediction evaluated on the scale of the conditional CDF.

  • survivor: The prediction evaluated on the scale of the (conditional) survivor function.

  • density, logdensity: The prediction evaluated on the scale of the conditional (log-)PDF.

  • hazard, loghazard, cumhazard: The prediction evaluated on the hazard/log-hazard/cumulative hazard scale.

  • odds, logodds: The prediction evaluated on the (log-)odds scale.

  • quantile: Return the quantiles of the conditional outcome distribution corresponding to newdata. For more information, see Details.

...

Additional arguments, passed to plot.mlt.

Details

When ranef is equal to "zero", a vector of zeros with the right size is substituted. For more details, see predict.tramME.

For more information on how to control the grid on which the functions are evaluated, see the documentation of predict.mlt.

Value

A numeric matrix of the predicted values invisibly.

Examples

data("sleepstudy", package = "lme4")
fit <- BoxCoxME(Reaction ~ Days + (Days | Subject), data = sleepstudy)
plot(fit, K = 100, type = "density")

tramME documentation built on July 9, 2023, 7:10 p.m.