Learn R Programming

clusterSEs (version 1.2)

cluster.bs.mlogit: Pairs Cluster Bootstrapped p-Values For mlogit

Description

This software estimates p-values using pairs cluster bootstrapped t-statistics for multinomial logit models (Cameron, Gelbach, and Miller 2008). The data set is repeatedly re-sampled by cluster, a model is estimated, and inference is based on the sampling distribution of the pivotal (t) statistic.

Usage

cluster.bs.mlogit(mod, dat, cluster, ci.level = 0.95, boot.reps = 1000,
  stratify = FALSE, cluster.se = TRUE, report = TRUE, prog.bar = TRUE)

Arguments

mod
A model estimated using mlogit.
dat
The data set used to estimate mod, but in standard (not mlogit.data) form..
cluster
A formula of the clustering variable.
ci.level
What confidence level should CIs reflect?
boot.reps
The number of bootstrap samples to draw.
stratify
Sample clusters only (= FALSE) or clusters and observations by cluster (= TRUE).
cluster.se
Use clustered standard errors (= TRUE) or ordinary SEs (= FALSE) for bootstrap replicates.
report
Should a table of results be printed to the console?
prog.bar
Show a progress bar of the bootstrap (= TRUE) or not (= FALSE).

Value

  • A list with the elements
  • p.valuesA matrix of the estimated p-values.
  • ciA matrix of confidence intervals.

References

Cameron, A. Colin, Jonah B. Gelbach, and Douglas L. Miller. 2008. "Bootstrap-Based Improvements for Inference with Clustered Errors." The Review of Economics and Statistics 90(3): 414-427.

Examples

Run this code
# predict method of hospital admission
require(VGAMdata)
data(vtinpat)

# to save time, take a sample of this data
set.seed(32149)
idx <- sample(1:dim(vtinpat)[1], 5000, replace=F)
vtinpat <- vtinpat[idx,]

vtinpat$hos.num <- as.numeric(vtinpat$hospital)
vtinpat$age <- as.numeric(vtinpat$age.group)
vtinpat.mlogit <- mlogit.data(vtinpat, choice = "admit", shape="wide")
vt.mod <- mlogit(admit ~ 0 | age + sex, data = vtinpat.mlogit)
summary(vt.mod)

# compute cluster bootstrapped p-values (takes a while)
clust.p <- cluster.bs.mlogit(vt.mod, dat=vtinpat, cluster = ~ hos.num, report=TRUE)

Run the code above in your browser using DataLab