avar: Asymptotic variance of Estimator

Description Usage Arguments Value Examples

View source: R/avar.R

Description

avar calculated the asymptotic variance of the regression estimation

Usage

1
avar(X, e, group = NULL, J = NULL)

Arguments

X

A matrix or vector of independent variable(s)

e

The residuals from the regression

group

(optional) The cluster identifier (hhid from projdummies)

J

(optional) This is assumed to be X'X, and can be input if pre-calculated

Value

A matrix of the covariates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
hhid <- c("a","b","c","a","b","c" ,"a","b","c" ,"a","b","c" ,"a","b","c")
tid <- c("1","1" ,"1" ,"2","2" ,"3","3","3" ,"4","4","5" ,"5","6","6" ,"6")
w <- rep(1, 15)
x1 <- rnorm(15, mean=50, sd=10)   
x2 <- rnorm(15, mean=50, sd=10)
y <- x1 + rnorm(15, mean=50, sd=10)

struc <- projdummies(hhid, tid, w)
projvar_list <- projvar(x1, struc)
x1p <- projvar_list$var
projvar_list <- projvar(x2, struc)
x2p <- projvar_list$var
projvar_list <- projvar(y, struc)
yp <- projvar_list$var

reg <- regress1(yp, data.frame(x1p,x2p))
matCov <- avar(data.frame(x1p, x2p), reg$res, struc$hhid, reg$XX)

xtreg2way documentation built on Aug. 11, 2020, 9:06 a.m.