kernapply-methods: A kernel smoothing utility for '"momentModel"' classes

kernapply-methodsR Documentation

A kernel smoothing utility for "momentModel" classes

Description

It either generates the optimal bandwidth and kernel weights or the smoothed moments of moment based models.

Usage


## S4 method for signature 'momentModel'
kernapply(x, theta=NULL, smooth=TRUE, ...)

Arguments

x

An object of class "momentModel".

theta

An optional vector of coefficients. For smooth=FALSE, it is used to obtain the optimal bandwidth. If NULL, the bandwidth is obtained using one step GMM with the identity matrix as weights. For smooth=TRUE, the coefficient is required since the function returns the smoothed moments at a given vector of coefficients.

smooth

By default, it returns the smoothed moment matrix. If FALSE, it computes the optimal bandwidth and kernel weights.

...

Other arguments to pass. Currently not used

Value

It return an object of class "sSpec".

References

Anatolyev, S. (2005), GMM, GEL, Serial Correlation, and Asymptotic Bias. Econometrica, 73, 983-1002.

Kitamura, Yuichi (1997), Empirical Likelihood Methods With Weakly Dependent Processes. The Annals of Statistics, 25, 2084-2102.

Smith, R.J. (2011), GEL Criteria for Moment Condition Models. Econometric Theory, 27(6), 1192–1235.

Examples

data(simData)
theta <- c(beta0=1,beta1=2)

## A linearModel
model1 <- momentModel(y~x1, ~z1+z2, data=simData,vcov="HAC",vcovOptions=list(kernel="Bartlett"))

### get the bandwidth
### Notice that the kernel name is the not the same
### That's because a Truncated kernel for smoothing
### lead to a Bartlett kernel for the HAC of the moments
### See Smith (2011)
kernapply(model1, smooth=FALSE)


### Adding the kernel option to the model

model2 <- momentModel(y~x1, ~z1+z2,
data=simData,vcov="HAC",vcovOptions=list(kernel="Bartlett"), smooth=TRUE)

kernapply(model2, theta)$smoothx[1:5,]


momentfit documentation built on Sept. 20, 2023, 3:01 a.m.