plot-predict-simulate {mlt}R Documentation

Plots, Predictions and Samples from mlt Objects

Description

Plot, predict and sample from objects of class mlt

Usage

## S3 method for class 'ctm'
plot(x, newdata, type = c("distribution", "survivor", "density", 
     "logdensity", "hazard", "loghazard", "cumhazard", "logcumhazard", "odds",
     "logodds", "quantile", "trafo"),
     q = NULL, prob = 1:(K - 1) / K, K = 50, col = rgb(.1, .1, .1, .1), lty = 1, 
     add = FALSE, ...)
## S3 method for class 'mlt'
plot(x, ...)
## S3 method for class 'ctm'
predict(object, newdata, type = c("trafo", "distribution", 
         "survivor", "density", "logdensity", "hazard", "loghazard", "cumhazard", 
         "logcumhazard", "odds", "logodds", "quantile"), 
         terms = c("bresponse", "binteracting", "bshifting"), 
         q = NULL, prob = NULL, K = 50, interpolate = TRUE, ...)
## S3 method for class 'mlt'
predict(object, newdata = object$data, ...)
## S3 method for class 'ctm'
simulate(object, nsim = 1, seed = NULL, newdata, K = 50, q = NULL,
         interpolate = TRUE, bysim = TRUE, ...)
## S3 method for class 'mlt'
simulate(object, nsim = 1, seed = NULL, newdata = object$data, bysim = TRUE, ...)

Arguments

object

a fitted conditional transformation model as returned by mlt or an unfitted conditional transformation model as returned by ctm

x

a fitted conditional transformation model as returned by mlt

newdata

an optional data frame of observations

type

type of prediction or plot to generate

q

quantiles at which to evaluate the model

prob

probabilities for the evaluation of the quantile function (type = "quantile")

terms

terms to evaluate for the predictions, corresponds to the argument response, interacting and shifting in ctm

K

number of grid points to generate (in the absence of q)

col

color for the lines to plot

lty

line type for the lines to plot

add

logical indicating if a new plot shall be generated (the default)

interpolate

logical indicating if quantiles shall be interpolated linearily

nsim

number of samples to generate

seed

optional seed for the random number generator

bysim

logical, if TRUE a list with nsim elements is returned, each element is of length nrow(newdata) and contains one sample from the conditional distribution for each row of newdata. If FALSE, a list of length nrow(newdata) is returned, its ith element of length nsim contains nsim samples from the conditional distribution given newdata[i,].

...

additional arguments

Details

plot evaluates the transformation function over a grid of q values for all observations in newdata and plots these functions (according to type). predict evaluates the transformation function over a grid of q values for all observations in newdata and returns the result as a matrix (where _columns_ correspond to _rows_ in newdata). Note that the predict method for ctm objects requires all model coefficients to be specified in this unfitted model. simulate draws samples from object by numerical inversion of the quantile function.

Note that offsets are ALWAYS IGNORED when computing predictions. If you want the methods to pay attention to offsets, specify them as a variable in the model with fixed regression coefficient using the fixed argument in mlt.


[Package mlt version 1.2-1 Index]