Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estimateEffects fails when the treatment variable is logical (rather than a 0-1 numeric) #31

Open
MWYang opened this issue Jun 6, 2018 · 2 comments

Comments

@MWYang
Copy link

MWYang commented Jun 6, 2018

data(lalonde)

lalonde.match.on <- c('age', 'black')
lalonde.match.form <- as.formula(re78 ~ treat + age + black)

# The following works

lalonde.frontier <- makeFrontier(dataset = lalonde,
                            treatment = 'treat',
                            match.on = lalonde.match.on)
lalonde.estimates <- estimateEffects(lalonde.frontier, 're78 ~ treat',
                                mod.dependence.formula = lalonde.match.form,
                                continuous.vars = c('age', 'education', 're74', 're75'),
                                prop.estimated = .1,
                                means.as.cutpoints = TRUE)

# However, it does not after running this line:
lalonde$treat <- lalonde$treat == 1

> lalonde.frontier <- makeFrontier(dataset = lalonde,
+                             treatment = 'treat',
+                             match.on = lalonde.match.on)
Calculating Mahalanobis distances...
Calculating theoretical frontier...
Calculating information for plotting the frontier...
> lalonde.estimates <- estimateEffects(lalonde.frontier, 're78 ~ treat',
+                                 mod.dependence.formula = lalonde.match.form,
+                                 continuous.vars = c('age', 'education', 're74', 're75'),
+                                 prop.estimated = .1,
+                                 means.as.cutpoints = TRUE)
Error in confint(results, level = alpha)[frontier.object$treatment, ] : 
  subscript out of bounds
@paugrau
Copy link

paugrau commented Oct 6, 2021

I am having the same problem and this was the only issue on the topic I could find online. Has anybody came out with a solution? I'm afraid I am having it because of the reduced number of points (58) in my makefrontier() but I would appreciate some help on the issue opened by @MWYang .

@ngreifer
Copy link
Collaborator

ngreifer commented Oct 6, 2021

MatchIngFrontier is undergoing a complete renewal with expanded functionality, and I aim to have it ready by the end of the month. Hold tight until then and let me know if you'd be interested in testing a beta version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants