Learn R Programming

madness (version 0.2.4)

vcov.madness: Calculate Variance-Covariance Matrix for a model.

Description

Returns the variance-covariance matrix of the parameters computed by a madness object.

Usage

# S3 method for madness
vcov(object, ...)

Arguments

object

a madness object. A varx matrix must have been set on the object, otherwise an error will be thrown.

...

additional arguments for method functions. Ignored here.

Value

A matrix of the estimated covariances between the values being estimated by the madness object. While \(Y\) may be multidimensional, the return value is a square matrix whose side length is the number of elements of \(Y\)

Details

Let \(X\) represent some quantity which is estimated from data. Let \(\Sigma\) be the (known or estimated) variance-covariance matrix of \(X\). If \(Y\) is some computed function of \(X\), then, by the Delta method (which is a first order Taylor approximation), the variance-covariance matrix of \(Y\) is approximately $$\frac{\mathrm{d}Y}{\mathrm{d}{X}} \Sigma \left(\frac{\mathrm{d}Y}{\mathrm{d}{X}}\right)^{\top},$$ where the derivatives are defined over the 'unrolled' (or vectorized) \(Y\) and \(X\).

Note that \(Y\) can represent a multidimensional quantity. Its variance covariance matrix, however, is two dimensional, as it too is defined over the 'unrolled' \(Y\).

See Also

vcov.

Examples

Run this code
# NOT RUN {
y <- array(rnorm(2*3),dim=c(2,3))
dy <- matrix(rnorm(length(y)*2),ncol=2)
dx <- crossprod(matrix(rnorm(ncol(dy)*100),nrow=100))
obj <- madness(val=y,dvdx=dy,varx=dx)
print(vcov(obj))

# }

Run the code above in your browser using DataLab