clrobustse <- function(fit.model, clusterid) { rank=fit.model$rank N.obs <- length(clusterid) N.clust <- length(unique(clusterid)) dfc <- N.clust/(N.clust-1) vcv <- vcov(fit.model) estfn <- estfun(fit.model) uj <- apply(estfn, 2, function(x) tapply(x, clusterid, sum)) N.VCV <- N.obs * vcv ujuj.nobs <- crossprod(uj)/N.obs vcovCL <- dfc*(1/N.obs * (N.VCV %*% ujuj.nobs %*% N.VCV)) coeftest(fit.model, vcov=vcovCL) } clrobustse(UC.models[[1]], (contest.user.level.data %>% select(entered.contest,contest.format,total.prizes,contest.duration.hours,num.winners,max.prize,min.prize,binary.reads.cap,prize.sd,topic_id) %>% drop_na())$topic_id)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter