getBetaVcovDf-lmerMod-method: Get beta, vcov, df and sigma from a linear mixed model

getBetaVcovDf,lmerMod-methodR Documentation

Get beta, vcov, df and sigma from a linear mixed model

Description

This function returns a list containing the parameter estimates beta, the variance-covariance matrix vcov, the residual degrees of freedom df and the residual standard deviation sigma based on a mixed effects model fitted by the lmer function from the lme4 package. This function will only rarely be called by the end-user. When calculating these values for protLM objects, we recommend using the function getBetaVcovDfList. The variance covariance matrix is bias-adjusted, the degrees of freedom are calculated as the trace of the Hat matrix (Ruppert et al., 2003).

Usage

## S4 method for signature 'lmerMod'
getBetaVcovDf(model, exp_unit = NULL,
  pars_between = NULL, Ginvoffset = 1e-18)

Arguments

model

A linear mixed effects model object of class lmerMod.

exp_unit

The effect in the model that corresponds to the experimental unit. Only needed when one would like to calculate a more conservative way of estimating the degrees of freedom. The default way of estimating the degrees of freedom (exp_unit=NULL) subtracts the total number of observations by the trace of the Hat matrix. However, often, observations are not completely independent. A more conservative way (df_exp) is defining on which level the treatments were executed and substracting all degrees of freedom lost due to between-treatement effects (pars_between) from the number of treatments.

pars_between

Only used if exp_unit is not NULL. Character vector indicating all parameters in the model that are between-treatment effects in order to calculate a more conservative degrees of freedom (df_exp). If left to default (NULL), all parameters in the model will be asumed to be between-treatment effects (this is not adviced as the result will mostly be too conservative).

Ginvoffset

A numeric value indicating the offset added the the diagonal of the G matrix to prevent near-singularity. Defaults to 1e-18.

Value

A list containing (1) a named column matrix beta containing the parameter estimates, (2) a named square variance-covariance matrix, (3) a numeric value equal to the residual degrees of freedom and (4) a numeric value equal to the residual standard deviation of the model.

References

David Ruppert, M.P. Want and R.J. Carroll. Semiparametric Regression. Cambridge University Press, 2003.

Examples

data(proteinsCPTAC, package="MSqRob")
mixedmodel <- lmer(formula="value ~ 1 + (1|conc) + (1|instrlab) + (1|Sequence)",data=getData(proteinsCPTAC[2]))
getBetaVcovDf(mixedmodel)

ludgergoeminne/MSqRob documentation built on Jan. 11, 2023, 1:32 p.m.