Learn R Programming

compositions (version 1.10-1)

varmlm: Residual variance of a model

Description

Computes the unbiased estimate for the variance of the residuals of a model.

Usage

var.mlm(x,...) 
var.lm(x,...)

Arguments

x
a linear model object
...
Unused, for generic purposes only.

Value

  • var.lmreturns a scalar giving the estimated variance of the residuals
  • var.mlmreturns a the estimated variance covariance matrix of the residuals

Details

The difference of this command to var(resid(X)) is that this command correctly adjusts for the degrees of freedom of the model.

See Also

vcov

Examples

Run this code
data(Orange)
var(lm(circumference~age,data=Orange))
var(lm(cbind(circumference,age)~age,data=Orange))

Run the code above in your browser using DataLab