tram  R Documentation 
Likelihoodinference for stratified linear transformation models, including linear shiftscale transformation models.
tram(formula, data, subset, weights, offset, cluster, na.action = na.omit,
distribution = c("Normal", "Logistic", "MinExtrVal", "MaxExtrVal",
"Exponential", "Cauchy", "Laplace"),
transformation = c("discrete", "linear", "logarithmic", "smooth"),
LRtest = TRUE, prob = c(0.1, 0.9), support = NULL,
bounds = NULL, add = c(0, 0), order = 6,
negative = TRUE, remove_intercept = TRUE,
scale = TRUE, scale_shift = FALSE, extrapolate = FALSE,
log_first = FALSE, sparse_nlevels = Inf,
model_only = FALSE, constraints = NULL, ...)
tram_data(formula, data, subset, weights, offset, cluster, na.action = na.omit)
formula 
an object of class 
data 
an optional data frame, list or environment (or object
coercible by 
subset 
an optional vector specifying a subset of observations to be used in the fitting process. 
weights 
an optional vector of case weights to be used in the fitting
process. Should be 
offset 
this can be used to specify an _a priori_ known component to
be included in the linear predictor during fitting. This
should be 
cluster 
optional factor with a cluster ID employed for computing clustered covariances. 
na.action 
a function which indicates what should happen when the data
contain 
distribution 
character specifying how the transformation function is mapped into probabilities. Available choices include the cumulative distribution functions of the standard normal, the standard logistic and the standard minimum extreme value distribution. 
transformation 
character specifying the complexity of the responsetransformation. For discrete responses, one parameter is assigned to each level (except the last one), for continuous responses linear, loglinear and smooth (parameterised as a Bernstein polynomial) function are implemented. 
LRtest 
logical specifying if a likelihoodratio test for the null of all coefficients in the linear predictor being zero shall be performed. 
prob 
two probabilities giving quantiles of the response defining the support of a smooth
Bernstein polynomial (if 
support 
a vector of two elements; the support of a smooth
Bernstein polynomial (if 
bounds 
an interval defining the bounds of a real sample space. 
add 
add these values to the support before generating a grid via

order 
integer >= 1 defining the order of the Bernstein polynomial
(if 
negative 
logical defining the sign of the linear predictor. 
remove_intercept 
logical defining if the intercept shall be removed
from the linear shift predictor in favour of an (typically implicit) intercept
in the baseline transformation. If 
scale 
logical defining if variables in the linear predictor shall be scaled. Scaling is internally used for model estimation, rescaled coefficients are reported in model output. 
scale_shift 
a logical choosing between two different model types in
the presence of a 
extrapolate 
logical defining the behaviour of the Bernstein transformation
function outside 
sparse_nlevels 
integer; use a sparse model matrix if the number
of levels of an ordered factor is at least as large as

log_first 
logical; if 
model_only 
logical, if 
constraints 
additional constraints on regression coefficients in
the linear predictor of the form 
... 
additional arguments. 
The model formula is of the form y  s ~ x  z
where y
is an at
least ordered response variable, s
are the variables defining strata
and x
defines the linear predictor. Optionally, z
defines a
scaling term (see ctm
). y ~ x
defines a model
without strata (but responsevarying intercept function) and y  s ~
0
setsup responsevarying coefficients for all variables in s
.
The two functions tram
and tram_data
are not intended
to be called directly by users. Instead,
functions Coxph
(Cox proportional hazards models),
Survreg
(parametric survival models),
Polr
(models for ordered categorical responses),
Lm
(normal linear models),
BoxCox
(nonnormal linear models) or
Colr
(continuous outcome logistic regression) allow
direct access to the corresponding models.
The model class and the specific models implemented in tram are explained in the package vignette of package tram. The underlying theory of most likely transformations is presented in Hothorn et al. (2018), computational and modelling aspects in more complex situations are discussed by Hothorn (2018).
An object of class tram
inheriting from mlt
.
Torsten Hothorn, Lisa Moest, Peter Buehlmann (2018), Most Likely Transformations, Scandinavian Journal of Statistics, 45(1), 110–134, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/sjos.12291")}.
Torsten Hothorn (2020), Most Likely Transformations: The mlt Package, Journal of Statistical Software, 92(1), \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v092.i01")}.
Sandra Siegfried, Lucas Kook, Torsten Hothorn (2023), DistributionFree LocationScale Regression, The American Statistician, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00031305.2023.2203177")}.
data("BostonHousing2", package = "mlbench")
### unconstrained regression coefficients
### BoxCox calls tram internally
m1 < BoxCox(cmedv ~ chas + crim + zn + indus + nox +
rm + age + dis + rad + tax + ptratio + b + lstat,
data = BostonHousing2)
### now with two constraints on regression coefficients
m2 < BoxCox(cmedv ~ chas + crim + zn + indus + nox +
rm + age + dis + rad + tax + ptratio + b + lstat,
data = BostonHousing2,
constraints = c("crim >= 0", "chas1 + rm >= 1.5"))
coef(m1)
coef(m2)
K < matrix(0, nrow = 2, ncol = length(coef(m2)))
colnames(K) < names(coef(m2))
K[1, "crim"] < 1
K[2, c("chas1", "rm")] < 1
m3 < BoxCox(cmedv ~ chas + crim + zn + indus + nox +
rm + age + dis + rad + tax + ptratio + b + lstat,
data = BostonHousing2,
constraints = list(K, c(0, 1.5)))
all.equal(coef(m2), coef(m3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.