# NOT RUN {
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)
# }
Run the code above in your browser using DataLab