lpme
: R Packge for Dealing with Latent Predictor Measurement Error Under Identification Restrictions
Installation | Key Functions | References
lpme
is an R package that provides tools for analyzing latent variable models with measurement error correction, using bootstrapping techniques for inference.
Within an R
session, you can install the development version of lpme
from GitHub with:
# Install from GitHub
# install.packages("devtools")
devtools::install_github("cjerzak/lpme/lpme-software")
lpme_OneRun
performs a single run of latent variable analysis with measurement error correction (no bootstrapping; 1 split sample partition):
# Generate data
Yobs <- rnorm(1000)
ObservablesMat <- matrix(sample(c(0,1), 1000*10, replace = T), ncol = 10)
# One run of latent error correction method
lpme::lpme_onerun(Y = Yobs,
observables_mat = ObservablesMat)
lpme
implements a bootstrap analysis for latent variable models with measurement error correction. We average over nPartition
split sample partitions.
# Generate data
Yobs <- rnorm(1000)
ObservablesMat <- matrix(sample(c(0,1), 1000*10, replace = T), ncol = 10)
# Latent error correction method, with partitioning and bootstrap
results <- lpme::lpme(
Y = Yobs,
observables_mat = ObservablesMat,
n_boot = 32L,
n_partition = 10L
)
# View the corrected IV coefficient and its standard error
print(results)
Contributions to latenterror are welcome! Feel free to submit a pull request or open an issue.
We thank Guilherme Duarte, Jeff Lewis, Umberto Mignozzetti, Aaron Pancost, Erik Snowberg, Chris Tausanovitch, and participants of a panel at an MPSA panel for very helpful comments. We thank Major Valls for excellent research assistance.
Connor T. Jerzak, Stephen A. Jessee. Measurement Error in Latent Predictors: The Role of Identification Restrictions. Working Paper.