getBetaVcovDfList: Get a list of beta, vcov, df and sigma from a protLM object

Description Usage Arguments Value References Examples

View source: R/getBetaVcovDfList.R

Description

This function returns a list with length equal to a protLM object supplied as input. Each element of this list corresponds to a model in the protLM object and contains in itself a list holding the parameter estimates beta, the variance-covariance matrix vcov, the residual degrees of freedom df and the residual standard deviation sigma for this model. For mixed models, 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

1
2
getBetaVcovDfList(protLM, exp_unit = NULL, pars_between = NULL,
  printProgress = FALSE, shiny = FALSE, message = NULL)

Arguments

protLM

An object of class protLM.

exp_unit

The effect that in all models 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 models 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 models will be asumed to be between-treatment effects (this is not adviced as the result will mostly be too conservative).

printProgress

A logical indicating whether the R should print a message before calculating the contrasts for each accession. Defaults to FALSE.

shiny

A logical indicating whether this function is being used by a Shiny app. Setting this to TRUE only works when using this function in a Shiny app and allows for dynamic progress bars. Defaults to FALSE.

message

Only used when printProgress=TRUE and shiny=TRUE. A single-element character vector: the message to be displayed to the user, or NULL to hide the current message (if any).

Value

A list with length equal to the models object containing list with four elements: (1) a named column matrix beta containing the parameter estimates, (2) a named square variance-covariance matrix vcov, (3) a numeric value df equal to the residual degrees of freedom, (4) a numeric value sigma equal to the residual standard deviation of the model and (5) NULL if exp_unit is left to its default value NULL, else: a conservative estimate of the degrees of freedom based on the number of experimental units and the degrees of freedom lost due to between-treatment effects..

References

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

Examples

1
2
3
4
#Load the protLM object protmodel:
data(modelRRCPTAC, package="MSqRob")
betaVcovDfList <- getBetaVcovDfList(getModels(modelRRCPTAC[1:10], simplify=FALSE))
betaVcovDfList

statOmics/MSqRob documentation built on Nov. 24, 2018, 6:52 a.m.