Methods for Stratified Linear Transformation Models
Methods for objects inheriting from class tram
## S3 method for class 'tram' as.mlt(object) ## S3 method for class 'tram' model.frame(formula, ...) ## S3 method for class 'tram' model.matrix(object, data = object$data, with_baseline = FALSE, ...) ## S3 method for class 'tram' coef(object, with_baseline = FALSE, ...) ## S3 method for class 'Lm' coef(object, as.lm = FALSE, ...) ## S3 method for class 'Survreg' coef(object, as.survreg = FALSE, ...) ## S3 method for class 'tram' vcov(object, with_baseline = FALSE, complete = FALSE, ...) ## S3 method for class 'tram' logLik(object, parm = coef(as.mlt(object), fixed = FALSE), ...) ## S3 method for class 'tram' estfun(object, parm = coef(as.mlt(object), fixed = FALSE), ...) ## S3 method for class 'tram' predict(object, newdata = model.frame(object), type = c("lp", "trafo", "distribution", "survivor", "density", "logdensity", "hazard", "loghazard", "cumhazard", "quantile"), ...) ## S3 method for class 'tram' plot(x, newdata = model.frame(x), which = c("QQ-PIT", "baseline only", "distribution"), confidence = c("none", "interval", "band"), level = 0.95, K = 50, cheat = K, col = "black", fill = "lightgrey", lwd = 1, ...)
object, formula, x |
a fitted stratified linear transformation model inheriting
from class |
data |
an optional data frame. |
with_baseline |
logical, if |
as.lm |
logical, return parameters in the |
as.survreg |
logical, return parameters in the |
parm |
model parameters, including baseline parameters. |
complete |
currently ignored |
newdata |
an optional data frame of new observations. |
type |
type of prediction, current options include
linear predictors ( |
which |
type of plot, either a QQ plot of the probability-integral
transformed observations ( |
confidence |
type of uncertainty assessment. |
level |
confidence level. |
K |
number of grid points in the response, see
|
cheat |
reduced number of grid points for the computation
of confidence bands, see |
col |
line color. |
fill |
fill color. |
lwd |
line width. |
... |
additional arguments to the underlying methods for class
|
coef
can be used to get (and set) model parameters,
logLik
evaluates the log-likelihood (also for
parameters other than the maximum likelihood estimate);
vcov
returns the estimated variance-covariance matrix (possibly
taking cluster
into account) and
and estfun
gives the score contribution by each observation.
predict
and plot
can be used to inspect the model on
different scales.
Torsten Hothorn, Lisa Moest, Peter Buehlmann (2018), Most Likely Transformations, Scandinavian Journal of Statistics, 45(1), 110–134, doi: 10.1111/sjos.12291.
data("BostonHousing2", package = "mlbench") ### fit non-normal Box-Cox type linear model with two ### baseline functions (for houses near and off Charles River) BC_BH_2 <- BoxCox(cmedv | 0 + chas ~ crim + zn + indus + nox + rm + age + dis + rad + tax + ptratio + b + lstat, data = BostonHousing2) logLik(BC_BH_2) ### classical likelihood inference summary(BC_BH_2) ### coefficients of the linear predictor coef(BC_BH_2) ### plot linear predictor (mean of _transformed_ response) ### vs. observed values plot(predict(BC_BH_2, type = "lp"), BostonHousing2$cmedv) ### all coefficients coef(BC_BH_2, with_baseline = TRUE) ### compute predicted median along with 10% and 90% quantile for the first ### observations predict(BC_BH_2, newdata = BostonHousing2[1:3,], type = "quantile", prob = c(.1, .5, .9)) ### plot the predicted density for these observations plot(BC_BH_2, newdata = BostonHousing2[1:3, -1], which = "distribution", type = "density", K = 1000) ### evaluate the two baseline transformations, with confidence intervals nd <- model.frame(BC_BH_2)[1:2, -1] nd$chas <- factor(c("0", "1")) library("colorspace") col <- diverge_hcl(2, h = c(246, 40), c = 96, l = c(65, 90)) fill <- diverge_hcl(2, h = c(246, 40), c = 96, l = c(65, 90), alpha = .3) plot(BC_BH_2, which = "baseline only", newdata = nd, col = col, confidence = "interval", fill = fill, lwd = 2, xlab = "Median Value", ylab = expression(h[Y])) legend("bottomright", lty = 1, col = col, title = "Near Charles River", legend = c("no", "yes"), bty = "n")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.