Skip to content

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

@MWYang

Description

@MWYang
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions