CRAN Package Check Results for Package estimatr

Last updated on 2019-01-22 02:48:45 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.14 79.43 80.63 160.06 OK
r-devel-linux-x86_64-debian-gcc 0.14 83.11 62.97 146.08 OK
r-devel-linux-x86_64-fedora-clang 0.14 239.80 NOTE
r-devel-linux-x86_64-fedora-gcc 0.14 223.40 OK
r-devel-windows-ix86+x86_64 0.14 178.00 180.00 358.00 OK
r-patched-linux-x86_64 0.14 96.78 77.17 173.95 OK
r-patched-solaris-x86 0.14 182.50 ERROR
r-release-linux-x86_64 0.14 96.38 77.40 173.78 OK
r-release-windows-ix86+x86_64 0.14 188.00 177.00 365.00 OK
r-release-osx-x86_64 0.14 NOTE
r-oldrel-windows-ix86+x86_64 0.14 187.00 213.00 400.00 OK
r-oldrel-osx-x86_64 0.14 NOTE

Check Details

Version: 0.14
Check: installed package size
Result: NOTE
     installed size is 28.7Mb
     sub-directories of 1Mb or more:
     libs 28.4Mb
Flavors: r-devel-linux-x86_64-fedora-clang, r-release-osx-x86_64, r-oldrel-osx-x86_64

Version: 0.14
Check: examples
Result: ERROR
    Running examples in ‘estimatr-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: lm_robust
    > ### Title: Ordinary Least Squares with Robust Standard Errors
    > ### Aliases: lm_robust
    >
    > ### ** Examples
    >
    > library(fabricatr)
    > dat <- fabricate(
    + N = 40,
    + y = rpois(N, lambda = 4),
    + x = rnorm(N),
    + z = rbinom(N, 1, prob = 0.4)
    + )
    >
    > # Default variance estimator is HC2 robust standard errors
    > lmro <- lm_robust(y ~ x + z, data = dat)
    >
    > # Can tidy() the data in to a data.frame
    > tidy(lmro)
     term estimate std.error statistic p.value conf.low conf.high
    1 (Intercept) 4.3163773 0.4003476 10.781574 5.670980e-13 3.505196 5.1275585
    2 x -0.3516848 0.3361432 -1.046235 3.022395e-01 -1.032776 0.3294059
    3 z -0.7931232 0.5837682 -1.358627 1.824907e-01 -1.975950 0.3897036
     df outcome
    1 37 y
    2 37 y
    3 37 y
    > # Can use summary() to get more statistics
    > summary(lmro)
    
    Call:
    lm_robust(formula = y ~ x + z, data = dat)
    
    Standard error type: HC2
    
    Coefficients:
     Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper DF
    (Intercept) 4.3164 0.4003 10.782 5.671e-13 3.505 5.1276 37
    x -0.3517 0.3361 -1.046 3.022e-01 -1.033 0.3294 37
    z -0.7931 0.5838 -1.359 1.825e-01 -1.976 0.3897 37
    
    Multiple R-squared: 0.05919 , Adjusted R-squared: 0.008332
    F-statistic: 1.855 on 2 and 37 DF, p-value: 0.1707
    > # Can also get coefficients three ways
    > lmro$coefficients
    (Intercept) x z
     4.3163773 -0.3516848 -0.7931232
    > coef(lmro)
    (Intercept) x z
     4.3163773 -0.3516848 -0.7931232
    > tidy(lmro)$estimate
    [1] 4.3163773 -0.3516848 -0.7931232
    > # Can also get confidence intervals from object or with new 1 - `alpha`
    > lmro$conf.low
    (Intercept) x z
     3.505196 -1.032776 -1.975950
    > confint(lmro, level = 0.8)
     10 % 90 %
    (Intercept) 3.7939819 4.83877257
    x -0.7903027 0.08693306
    z -1.5548557 -0.03139065
    >
    > # Can recover classical standard errors
    > lmclassic <- lm_robust(y ~ x + z, data = dat, se_type = "classical")
    > tidy(lmclassic)
     term estimate std.error statistic p.value conf.low conf.high
    1 (Intercept) 4.3163773 0.3684438 11.7151574 5.176692e-14 3.569839 5.0629153
    2 x -0.3516848 0.3829118 -0.9184487 3.643328e-01 -1.127538 0.4241682
    3 z -0.7931232 0.7057899 -1.1237382 2.683624e-01 -2.223189 0.6369431
     df outcome
    1 37 y
    2 37 y
    3 37 y
    >
    > # Can easily match Stata's robust standard errors
    > lmstata <- lm_robust(y ~ x + z, data = dat, se_type = "stata")
    > tidy(lmstata)
     term estimate std.error statistic p.value conf.low conf.high
    1 (Intercept) 4.3163773 0.4045562 10.669412 7.617926e-13 3.496668 5.1360860
    2 x -0.3516848 0.3275306 -1.073747 2.898893e-01 -1.015325 0.3119552
    3 z -0.7931232 0.5820959 -1.362530 1.812672e-01 -1.972561 0.3863151
     df outcome
    1 37 y
    2 37 y
    3 37 y
    >
    > # Easy to specify clusters for cluster-robust inference
    > dat$clusterID <- sample(1:10, size = 40, replace = TRUE)
    >
    > lmclust <- lm_robust(y ~ x + z, data = dat, clusters = clusterID)
    > tidy(lmclust)
     term estimate std.error statistic p.value conf.low conf.high
    1 (Intercept) 4.3163773 0.2867150 15.0545894 2.243044e-06 3.630759 5.00199510
    2 x -0.3516848 0.3665616 -0.9594154 3.759382e-01 -1.258188 0.55481869
    3 z -0.7931232 0.3584326 -2.2127542 6.865379e-02 -1.669090 0.08284407
     df outcome
    1 6.634546 y
    2 5.749474 y
    3 6.030830 y
    >
    > # Can also match Stata's clustered standard errors
    > lm_robust(
    + y ~ x + z,
    + data = dat,
    + clusters = clusterID,
    + se_type = "stata"
    + )
     Estimate Std. Error t value Pr(>|t|) CI Lower
    (Intercept) 4.3163773 0.2824469 15.2820833 9.594651e-08 3.677438
    x -0.3516848 0.3611623 -0.9737584 3.556200e-01 -1.168691
    z -0.7931232 0.3509169 -2.2601451 5.016470e-02 -1.586952
     CI Upper DF
    (Intercept) 4.9553165700 9
    x 0.4653210999 9
    z 0.0007060834 9
    >
    > # Works just as LM does with functions in the formula
    > dat$blockID <- rep(c("A", "B", "C", "D"), each = 10)
    >
    > lm_robust(y ~ x + z + factor(blockID), data = dat)
     Estimate Std. Error t value Pr(>|t|) CI Lower
    (Intercept) 4.4869953 0.6441440 6.9658264 4.938723e-08 3.177937
    x -0.3360910 0.3527742 -0.9527084 3.474622e-01 -1.053014
    z -0.6596083 0.6604598 -0.9987106 3.249900e-01 -2.001824
    factor(blockID)B 0.1514635 0.9500493 0.1594270 8.742758e-01 -1.779269
    factor(blockID)C -0.7121090 0.9421099 -0.7558662 4.549347e-01 -2.626707
    factor(blockID)D -0.2728199 0.8516822 -0.3203306 7.506781e-01 -2.003646
     CI Upper DF
    (Intercept) 5.7960534 34
    x 0.3808325 34
    z 0.6826076 34
    factor(blockID)B 2.0821959 34
    factor(blockID)C 1.2024887 34
    factor(blockID)D 1.4580066 34
    >
    > # Weights are also easily specified
    > dat$w <- runif(40)
    >
    > lm_robust(
    + y ~ x + z,
    + data = dat,
    + weights = w,
    + clusters = clusterID
    + )
     Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper
    (Intercept) 4.2280720 0.2639921 16.0159007 8.035192e-05 3.499313 4.95683070
    x -0.2945147 0.3954964 -0.7446709 4.876101e-01 -1.289058 0.70002844
    z -0.7829764 0.3246450 -2.4117927 6.703346e-02 -1.649838 0.08388542
     DF
    (Intercept) 4.059263
    x 5.397510
    z 4.445011
    >
    > # Subsetting works just as in `lm()`
    > lm_robust(y ~ x, data = dat, subset = z == 1)
     Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper
    (Intercept) 3.5962129 0.4629105 7.768701 2.795996e-05 2.549037 4.64338907
    x -0.7251238 0.3604019 -2.011987 7.508697e-02 -1.540410 0.09016196
     DF
    (Intercept) 9
    x 9
    >
    > # One can also choose to set the significance level for different CIs
    > lm_robust(y ~ x + z, data = dat, alpha = 0.1)
     Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper
    (Intercept) 4.3163773 0.4003476 10.781574 5.670980e-13 3.6409534 4.9918011
    x -0.3516848 0.3361432 -1.046235 3.022395e-01 -0.9187899 0.2154202
    z -0.7931232 0.5837682 -1.358627 1.824907e-01 -1.7779948 0.1917485
     DF
    (Intercept) 37
    x 37
    z 37
    >
    > # We can also specify fixed effects
    > # Speed gains with fixed effects are greatests with "stata" or "HC1" std.errors
    > tidy(lm_robust(y ~ x + z, data = dat, fixed_effects = ~ blockID, se_type = "HC1"))
    
     *** caught segfault ***
    address fcd4b149, cause 'memory not mapped'
    
    Traceback:
     1: demeanMat(Y = as.matrix(model_data[["outcome"]]), X = model_data[["design_matrix"]], Zmat = model_data[["instrument_matrix"]], fes = model_data[["fixed_effects"]], weights = if (is.numeric(model_data[["weights"]])) model_data[["weights"]] else rep(1, nrow(model_data[["design_matrix"]])), has_int = attr(model_data$terms, "intercept"), eps = 1e-08)
     2: demean_fes(model_data)
     3: lm_robust(y ~ x + z, data = dat, fixed_effects = ~blockID, se_type = "HC1")
     4: tidy(lm_robust(y ~ x + z, data = dat, fixed_effects = ~blockID, se_type = "HC1"))
    An irrecoverable exception occurred. R is aborting now ...
Flavor: r-patched-solaris-x86

Version: 0.14
Check: tests
Result: ERROR
     Running ‘sleep.R’
     Comparing ‘sleep.Rout’ to ‘sleep.Rout.save’ ... OK
     Running ‘testthat.R’ [22s/35s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(estimatr)
     >
     > test_check("estimatr")
    
     *** caught segfault ***
     address fcd1b149, cause 'memory not mapped'
    
     Traceback:
     1: demeanMat(Y = as.matrix(model_data[["outcome"]]), X = model_data[["design_matrix"]], Zmat = model_data[["instrument_matrix"]], fes = model_data[["fixed_effects"]], weights = if (is.numeric(model_data[["weights"]])) model_data[["weights"]] else rep(1, nrow(model_data[["design_matrix"]])), has_int = attr(model_data$terms, "intercept"), eps = 1e-08)
     2: demean_fes(model_data)
     3: iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, data = dat, se_type = se_type)
     4: eval(code, test_env)
     5: eval(code, test_env)
     6: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error)
     7: doTryCatch(return(expr), name, parentenv, handler)
     8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     9: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     10: doTryCatch(return(expr), name, parentenv, handler)
     11: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]])
     12: tryCatchList(expr, classes, parentenv, handlers)
     13: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { })
     14: test_code(desc, code, env = parent.frame())
     15: test_that("FE matches with multiple FEs and covars", { for (se_type in se_types) { ro <- iv_robust(Y ~ X1 + X2 + factor(B) + factor(B2) | Z + X2 + factor(B) + factor(B2), data = dat, se_type = se_type) rfo <- iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, data = dat, se_type = se_type) expect_equivalent(tidy(ro)[ro$term %in% c("X1", "X2"), ], tidy(rfo)[rfo$term %in% c("X1", "X2"), ]) expect_equivalent(ro$fitted.values, rfo$fitted.values) expect_equal(ro[c("r.squared", "adj.r.squared")], rfo[c("r.squared", "adj.r.squared")]) ro <- iv_robust(Y ~ X1 + X2 + factor(B) + factor(B2) | Z + X2 + factor(B) + factor(B2), data = dat, weights = w, se_type = se_type) rfo <- iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, data = dat, weights = w, se_type = se_type) expect_equivalent(tidy(ro)[ro$term %in% c("X1", "X2"), ], tidy(rfo)[rfo$term %in% c("X1", "X2"), ]) expect_equivalent(ro$fitted.values, rfo$fitted.values) expect_equal(ro[c("r.squared", "adj.r.squared")], rfo[c("r.squared", "adj.r.squared")]) } for (se_type in cr_se_types) { ro <- iv_robust(Y ~ X1 + X2 + factor(B) + factor(B2) | Z + X2 + factor(B) + factor(B2), clusters = cl, data = dat, se_type = se_type) rfo <- iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, clusters = cl, data = dat, se_type = se_type) expect_equivalent(tidy(ro)[ro$term %in% c("X1", "X2"), ], tidy(rfo)[rfo$term %in% c("X1", "X2"), ]) expect_equivalent(ro$fitted.values, rfo$fitted.values) expect_equal(ro[c("r.squared", "adj.r.squared")], rfo[c("r.squared", "adj.r.squared")]) if (se_type %in% c("CR2", "CR3")) { expect_error(rfo <- iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, clusters = cl, data = dat, weights = w, se_type = se_type), "Cannot use `fixed_effects` with weighted CR2") } else { ro <- iv_robust(Y ~ X1 + X2 + factor(B) + factor(B2) | Z + X2 + factor(B) + factor(B2), clusters = cl, data = dat, weights = w, se_type = se_type) rfo <- iv_robust(Y ~ X1 + X2 | Z + X2, fixed_effects = ~B + B2, clusters = cl, data = dat, weights = w, se_type = se_type) expect_equivalent(tidy(ro)[ro$term %in% c("X1", "X2"), ], tidy(rfo)[rfo$term %in% c("X1", "X2"), ]) expect_equivalent(ro$fitted.values, rfo$fitted.values) expect_equal(ro[c("r.squared", "adj.r.squared")], rfo[c("r.squared", "adj.r.squared")]) } }})
     16: eval(code, test_env)
     17: eval(code, test_env)
     18: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error)
     19: doTryCatch(return(expr), name, parentenv, handler)
     20: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     21: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     22: doTryCatch(return(expr), name, parentenv, handler)
     23: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]])
     24: tryCatchList(expr, classes, parentenv, handlers)
     25: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { })
     26: test_code(NULL, exprs, env)
     27: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     28: force(code)
     29: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, { lister$start_file(basename(path)) source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap) end_context() })
     30: FUN(X[[i]], ...)
     31: lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     32: force(code)
     33: with_reporter(reporter = current_reporter, results <- lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap))
     34: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap)
     35: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap)
     36: test_package_dir(package = package, test_path = test_path, filter = filter, reporter = reporter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap)
     37: test_check("estimatr")
     An irrecoverable exception occurred. R is aborting now ...
Flavor: r-patched-solaris-x86