Learn R Programming

Morpho (version 2.1)

exVar: calculate variance of a distribution stemming from prediction models

Description

calculates a quotient of the overall varriance within a predicted distribution to that from the original one. This function calculates a naive extension of the univariate R^2-value by dividing the variance in the predicted dat by the variance of the original data. No additional adjustments are made!!

Usage

exVar(model, ...)

## S3 method for class 'lm': exVar(model, ...)

## S3 method for class 'mvr': exVar(model, ncomp, val = FALSE, ...)

Arguments

model
a model of classes "lm" or "mvr" (from the package "pls")
ncomp
How many latent variables to use (only for mvr models)
val
use cross-vaildated predictions (only for mvr models)
...
currently unused additional arguments.

Value

  • returns the quotient.

References

Langsrud O, Juergensen K, Ofstad R, Naes T. 2007. Analyzing Designed Experiments with Multiple Responses Journal of Applied Statistics 34:1275-1296.

Examples

Run this code
lm1 <- lm(as.matrix(iris[,1:4]) ~ iris[,5])
exVar(lm1)

Run the code above in your browser using DataLab