DeclareDesign / estimatr

estimatr: Fast Estimators for Design-Based Inference
https://declaredesign.org/r/estimatr
Other
131 stars 20 forks source link

Error when printing lh_robust with an specified alpha #373

Closed ramirogalvez closed 3 years ago

ramirogalvez commented 3 years ago

Hello, I've recently updated the library to the 0.30.2 version (and I am using the R 4.0.3). I am having trouble with using lh_robust with alpha values different than 0.05 (this didn't happened in previous versions).

Here are a few lines of codes which reproduce the error:

library(estimatr)
library(fabricatr)

dat <- fabricate(
    N = 40,
    y = rpois(N, lambda = 4),
    x = rnorm(N),
    z = rbinom(N, 1, prob = 0.4),
    clusterID = sample(1:4, 40, replace = TRUE)
)

lhro <- lh_robust(y ~ x + z, data = dat,
                 se_type = "stata",
                 linear_hypothesis = c("z + 2x = 0", "2x = 0"),
                 alpha = 0.10)

print(lhro)

The returned error is:

Error in UseMethod("vcov") : no applicable method for 'vcov' applied to an object of class "lh"

As you can check, the problem arises when specifying a custom value of alpha different than 0.05 (with 0.05 it runs fine).

Thanks for developing such a great library.

lukesonnet commented 3 years ago

Thanks for this report! Seems like Graeme and/or Alex solved this with this PR #383.

You can install from github for now to get around this, until we get the next version on CRAN, thanks!

graemeblair commented 3 years ago

On CRAN now