slim {slim}R Documentation

Fit Singular Linear Models

Description

Fit a singular linear model to longitudinal data.

Usage

slim(formula, data, covariance = "randomwalk", limit = ~1,
  contrasts = NULL)

Arguments

formula

a model formula for the fixed effects

data

a 'data.table' with two keys, respectively identifying subjects and observation times

covariance

an R object for which a 'list_covariances' method exists. Options include a character string such as "identity", "randomwalk" (the default), "brownian" or "pascal"; a list of covariance matrices; a function to be used in 'outer' and applied to the observation times; or a 'jmcmMod' or 'lmerMod' model fit.

limit

a one-sided model formula for the (thin) Cholesky factor of the limiting covariance matrix (default ~ 1, so the limiting covariance matrix is the matrix of ones)

contrasts

an optional list. See the 'contrasts.arg' argument of 'model.matrix.default'.

Value

an object of class 'slim'

Examples

slim_fit <- slim(renalfn ~ group + month, dialysis)
summary(slim_fit)

if(require("lme4")) {
  lmer_fit <- lmer(renalfn ~ group + month + (1 + month | id), dialysis)
  slim_fit <- slim(renalfn ~ 1 + group + month, dialysis, covariance = lmer_fit)
  summary(slim_fit)
  summary(slim_fit, empirical = FALSE)
}

if(require("jmcm")) {
  jmcm_fit <- jmcm(renalfn | id | month ~ group | 1, dialysis,
    triple = rep(2L, 3), cov.method = "mcd")
  slim_fit <- slim(renalfn ~ group + month, dialysis, covariance = jmcm_fit)
  summary(slim_fit)
  summary(slim_fit, empirical = FALSE)
}

[Package slim version 0.1.1 Index]