Learn R Programming

gamlr (version 0.1)

pve: Proportion of Variance Explained and model dispersion

Description

Proportion of Variance Explained, and estimated dispersion parameters, for arbitrary fit and response in linear, binomial (logistic) and poisson (log) linear models.

Usage

pve(y, f, family="linear")	
disp(y, f, family="linear", df=1)

Arguments

y
A vector of response values.
f
A vector of linear model fits (i.e. on logit scale for "binomial", on log scale for "poisson").
family
Regression family name.
df
For dispersion, the degrees of freedom used in estimating y.

Value

  • PVE on a [0,1] scale or dispersion.

Details

pve returns $1 - var(y-E[y|f])/var(y)$, and disp returns $[var(y-E[y|f])/var(y|f)]*[n/(n-df)]$. See the functions for formulas.

See Also

gamlr

Examples

Run this code
x <- rnorm(1000)
y <- x + rnorm(1000,sd=1/2)
f <- lm(y~x)$fitted
pve(y,f)
disp(y,f)

Run the code above in your browser using DataLab