quadra-methods: ~~ Methods for Function 'quadra' in Package 'Gmm' ~~

Description Usage Arguments Methods Examples

Description

~~ Computes the quadratic form, where the center matrix is a class gmmWeights object ~~

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'gmmWeights,missing,missing'
quadra(w, x, y)

## S4 method for signature 'gmmWeights,matrixORnumeric,missing'
quadra(w, x, y)

## S4 method for signature 'gmmWeights,matrixORnumeric,matrixORnumeric'
quadra(w, x, y)

Arguments

w

An object of class "gmmWeights"

x

A matrix or numeric vector

y

A matrix or numeric vector

Methods

signature(w = "gmmWeights", x = "matrixORnumeric", y = "matrixORnumeric")

It computes x'Wy, where W is the weighting matrix.

signature(w = "gmmWeights", x = "matrixORnumeric", y = "missing")

It computes x'Wx, where W is the weighting matrix.

signature(w = "gmmWeights", x = "missing", y = "missing")

It computes W, where W is the weighting matrix. When W is the inverse of the covariance matrix of the moment conditions, it is saved as either a QR decompisition, a Cholesky decomposition or a covariance matrix into the gmmWeights object. The quadra method with no y and x is therefore a way to invert it. The same applies to system of equations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(simData)

theta <- c(beta0=1,beta1=2)
model1 <- gmmModel(y~x1, ~z1+z2, data=simData)

gbar <- evalMoment(model1, theta)
gbar <- colMeans(gbar)

### Onjective function of GMM with identity matrix
wObj <- evalWeights(model1, w="ident")
quadra(wObj, gbar)

### Onjective function of GMM with efficient weights
wObj <- evalWeights(model1, theta)
quadra(wObj, gbar)

gmm4 documentation built on Dec. 6, 2019, 3:01 a.m.