theta: Estimate the symmetric second moment array of values.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/theta.r

Description

Given rows of observations of some vector (or multidimensional data), estimates the second moment by taking a simple mean, returning a madness object.

Usage

1
theta(X, vcov.func=vcov, xtag=NULL)

Arguments

X

a multidimensional array (or a data frame) of observed values.

vcov.func

a function which takes an object of class lm, and computes a variance-covariance matrix. If equal to the string "normal", we assume multivariate normal returns.

xtag

an optional string tag giving the name of the input data. defaults to figuring it out from the input expression.

Details

Given a n x k_1 x k_2 ... x k_l array whose 'rows' are independent observations of X, computes the k_1 x k_2 x ... x k_l x k_1 x k_2 ... k_l array of the mean of outer(X,X) based on n observations, returned as a madness object. The variance-covariance is also estimated, and stored in the object.

One may use the default method for computing covariance, via the vcov function, or via a 'fancy' estimator, like sandwich:vcovHAC, sandwich:vcovHC, etc.

Value

A madness object representing the mean of the outer product of the tail dimensions of X.

Author(s)

Steven E. Pav shabbychef@gmail.com

See Also

twomoments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(123)
X <- matrix(rnorm(1000*3),ncol=3)
th <- theta(X)

## Not run: 
if (require(sandwich)) {
 th2 <- theta(X,vcov.func=vcovHC)
}

## End(Not run)
# works on data frames too:
set.seed(456)
X <- data.frame(a=runif(100),b=rnorm(100),c=1)
th <- theta(X)

shabbychef/madness documentation built on April 11, 2021, 11:03 p.m.