ngreifer / WeightIt

WeightIt: an R package for propensity score weighting
https://ngreifer.github.io/WeightIt/
102 stars 12 forks source link

error message - "treatment & covariates must have the same number of units" #28

Closed anon94041 closed 2 years ago

anon94041 commented 2 years ago

I just installed WeightIt and am getting an error; minimal example code provided below. What's going wrong?

t1 <- data.frame(treat=c(rep(0, 500), rep(1, 500)), cov=rnorm(1000, 1, .4)) w.out <- weightit(treat ~ cov, data=t1, estimand="ATE") Error: The treatment and covariates must have the same number of units.

The treatment and covariate have the same length, so what's behind the error? Thanks.

ngreifer commented 2 years ago

This was a bug that has been fixed in the development version of WeightIt. Install it using devtools::install_github("ngreifer/WeightIt") and try again. I'll submit the updated version to CRAN soon.