markmfredrickson / optmatch

Functions for optimal matching in R
https://markmfredrickson.github.io/optmatch
Other
47 stars 14 forks source link

permit ISM binary ops on ISMs of different dimension? #143

Closed benthestatistician closed 3 years ago

benthestatistician commented 7 years ago

In some workflows one ISM ("aISM", say) might be built in the process of whittling down the sample toward a subsample that will be used for fitting an index score (eg propensity score) model, which will in turn be used to create another ISM ("bISM") for matching. (See statement of #142 for a bit more description.) In this context it would be helpful if when ismOpHandler saw ISMs e1 and e2 of different dimension, rather than quitting it just got rid of the rows and columns not common to both ISMs. Or something along those lines. As opposed to this:

> aglm = glm(formula = pr ~ . - cost, family = binomial, data = nuclearplants)
> mo1 <- caliper(aglm, width=1, data=nuclearplants)
> nuke.nopt <- subset(nuclearplants, pt==0)
> bglm <- update(aglm, data=nuke.nopt)
> mo2 <- match_on(bglm, caliper=1, within=mo1, data=nuke.nopt)
Error in ismOpHandler("+", e1, e2) : non-conformable matrices

(Speaking of #142, addressing this seems likely to require addressing it also.)

benthestatistician commented 3 years ago

Closing because: