Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N <- 100;id <- 1:N;id <- c(id,id);gid <- 1:(N/2);
- gid <- c(gid,gid,gid,gid);T <- rep(0,N);T = c(T,T+1)
- a <- qnorm(runif(N),mean=0,sd=0.005)
- gp <- qnorm(runif(N/2),mean=0,sd=0.0005)
- u <- qnorm(runif(N*2),mean=0,sd=0.05)
- a <- c(a,a);gp = c(gp,gp,gp,gp)
- Ylatent <- -0.05*T + a + u
- Data <- data.frame(
- Y = ifelse(Ylatent > 0, 1, 0),
- id = id,gid = gid,T = T
- )
- library(clubSandwich)
- library(plm)
- fe.fit <- plm(formula = Y ~ T, data = Data, model = "within", index = "id",effect = "individual", singular.ok = FALSE)
- vcovCR(fe.fit,cluster=Data$id,type = "CR2") # doesn't work, but I can run this by not specifying cluster as in the next line
- vcovCR(fe.fit,type = "CR2")
- vcovCR(fe.fit,cluster=Data$gid,type = "CR2") # I ultimately want to run this
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement