calcVarPart {variancePartition} | R Documentation

## Compute variance statistics

### Description

Compute fraction of variation attributable to each variable in regression model. Also interpretable as the intra-class correlation after correcting for all other variables in the model.

### Usage

    calcVarPart(fit, adjust = NULL, adjustAll = FALSE, showWarnings = TRUE, ...)

    ## S4 method for signature 'lm'
    calcVarPart(fit, adjust = NULL, adjustAll = FALSE, showWarnings = TRUE, ...)

    ## S4 method for signature 'lmerMod'
    calcVarPart(fit, adjust = NULL, adjustAll = FALSE, showWarnings = TRUE, ...)

### Arguments

`fit` | model fit from lm() or lmer()
`adjust` | remove variation from specified variables from the denominator. This computes the adjusted ICC with respect to the specified variables
`adjustAll` | adjust for all variables. This computes the adjusted ICC with respect to all variables
`showWarnings` | show warnings about model fit (default TRUE)
`...` | additional arguments (not currently used)

### Value

fraction of variance explained / ICC for each variable in the model

### Examples

    library(lme4)
    data(varPartData)

    # Linear mixed model
    fit <- lmer( geneExpr[1,] ~ (1|Tissue) + Age, info)
    calcVarPart( fit )

    # Linear model
    # Note that the two models produce slightly different results
    # This is expected: they are different statistical estimates
    # of the same underlying value
    fit <- lm( geneExpr[1,] ~ Tissue + Age, info)
    calcVarPart( fit )

[Package variancePartition version 1.18.3 Index]