search for: vcovcl

Displaying 2 results from an estimated 2 matches for "vcovcl".

Did you mean: vcov
2010 Jun 08
2
how to ignore rows missing arguments of a function when creating a function?
...m = TRUE, fm, cluster){ attach( dat , warn.conflicts = F) library(sandwich) library(lmtest) M <- length(unique(cluster)) N <- length(cluster) K <- fm$rank dfc <- (M/(M-1))*((N-1)/(N-K)) uj <- data.frame(apply(estfun(fm),2, function(x) data.frame(tapply(x, cluster, sum)) ) ); vcovCL <- dfc*sandwich(fm, meat=crossprod(uj)/N) coeftest(fm, vcovCL) } When I run my function, I get the message: Error in tapply(x, cluster, sum) : arguments must have same length If I specify instead attach(na.omit(dat), warn.conflicts = F) and don't have the "na.rm=TRUE" argu...
2017 Aug 03
0
Results of vcovCL (sandwich) and of cluster() in Stata
...ilter the data cities <- filter(cities, !is.na(pop1500)) cities <- filter(cities, city != "Z?rich" & city != "Mainz" & city != "Wittenberg") # the model m1 <- lm(prot1530 ~ press - 1, data = cities) # the clustered standard errors coeftest(m1, vcov. = vcovCL(m1, cluster=cities$territory)) I tried different types (HC1, HC2, etc), but always the value for the SE is not the same as in the table. Any ideas? Many thanks in advance. -- :: Igor Sosa Mayor :: joseleopoldo1792 at gmail.com :: :: GnuPG: 0x1C1E2890 :: http://www.gnupg.org/ :: :: j...