Learn R Programming

tram (version 1.4-0)

mtram: Transformation Models for Clustered Data

Description

Marginally interpretable transformation models for clustered data.

Usage

mtram(object, formula, data,
      grd = SparseGrid::createSparseGrid(type = "KPU", 
                dimension = length(rt$cnms[[1]]), k = 10), 
      tol = .Machine$double.eps, optim = mltoptim(hessian = TRUE),
      ...)

Value

An object of class tram with coef() and logLik()

methods.

Arguments

object

A tram object.

formula

A formula specifying the random effects.

data

A data frame.

grd

A sparse grid used for numerical integration to get the likelihood.

tol

numerical tolerance.

optim

a list of optimisers as returned by mltoptim

...

Additional argument.

Details

A Gaussian copula with a correlation structure obtained from a random intercept or random intercept / random slope model (that is, clustered or longitudinal data can by modelled only) is used to capture the correlations whereas the marginal distributions are described by a transformation model. The methodology is described in tram::Barbanti:Hothorn:2023 and examples are given in the mtram package vignette.

Only coef() and logLik() methods are available at the moment, see vignette("mtram", package = "tram") for worked examples.

References

*

See Also

vignette("mtram", package = "tram")

Examples

Run this code

  if (require("lme4")) {
      ### linear mixed model
      sleep_lmer <- lmer(Reaction ~ Days + (Days | Subject), 
                         data = sleepstudy, REML = FALSE)

      ### marginal transformation model
      sleep_LM <- Lm(Reaction ~ Days, data = sleepstudy)
      sleep_LMmer <- mtram(sleep_LM, ~ (Days | Subject), data = sleepstudy)

      ### the same
      logLik(sleep_lmer)
      logLik(sleep_LMmer)

      ### Lm / mtram estimate standardised effects
      sdinv <- 1 / summary(sleep_lmer)$sigma
      fixef(sleep_lmer) * c(-1, 1) * sdinv
      coef(sleep_LMmer)[c("(Intercept)", "Days")]
  }

Run the code above in your browser using DataLab