CRAN Package Check Results for Maintainer ‘Alexander Coppock <acoppock at gmail.com>’

Last updated on 2025-12-28 03:51:55 CET.

Package ERROR NOTE OK
DeclareDesign 1 12
randomizr 10 3
ri2 13
vayr 13

Package DeclareDesign

Current CRAN status: ERROR: 1, OK: 12

Version: 1.1.0
Check: examples
Result: ERROR Running examples in 'DeclareDesign-Ex.R' failed The error most likely occurred in: > ### Name: declare_estimator > ### Title: Declare estimator > ### Aliases: declare_estimator declare_estimators label_estimator > ### method_handler > > ### ** Examples > > > # Setup for examples > design <- + declare_model( + N = 500, + gender = rbinom(N, 1, 0.5), + U = rnorm(N, sd = 0.25), + potential_outcomes(Y ~ rbinom( + N, 1, prob = pnorm(0.2 * Z + 0.2 * gender + 0.1 * Z * gender + U) + )) + ) + + declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0)) + + declare_sampling(S = complete_rs(N = N, n = 200)) + + declare_assignment(Z = complete_ra(N = N, m = 100)) + + declare_measurement(Y = reveal_outcomes(Y ~ Z)) > > run_design(design) inquiry estimand 1 ATE 0.138 > > # default estimator is lm_robust with tidy summary > design_0 <- + design + + declare_estimator(Y ~ Z, inquiry = "ATE") > > run_design(design_0) inquiry estimand estimator term estimate std.error statistic p.value 1 ATE 0.082 estimator Z 0.01 0.07025926 0.14233 0.8869641 conf.low conf.high df outcome 1 -0.1285525 0.1485525 198 Y > > # Linear regression using lm_robust and tidy summary > design_1 <- + design + + declare_estimator( + formula = Y ~ Z, + .method = lm_robust, + .summary = tidy, + term = "Z", + inquiry = "ATE", + label = "lm_no_controls" + ) > > run_design(design_1) inquiry estimand term estimator estimate std.error statistic p.value 1 ATE 0.106 Z lm_no_controls 0.01 0.06842381 0.146148 0.8839533 conf.low conf.high df outcome 1 -0.124933 0.144933 198 Y > > # Use glance summary function to view model fit statistics > design_2 <- + design + + declare_estimator(.method = lm_robust, + formula = Y ~ Z, + .summary = glance) > > run_design(design_2) inquiry estimand estimator r.squared adj.r.squared statistic p.value 1 ATE 0.062 estimator 0.00490049 -0.0001252651 0.9750754 0.3246228 df.residual nobs se_type 1 198 200 HC2 > > # Custom answer strategies > # A custom estimator should take data as an argument and return a data.frame > # with columns such as "estimate", "std.error", "p.value", "conf.low", "conf.high" > my_estimator <- function(data) { + data.frame(estimate = mean(data$Y)) + } > > # Add a custom estimator to the design, wrapping it in `label_estimator()` > # in order to pass label and inquiry arguments > > design_3 <- + design + + declare_inquiry(Y_bar = mean(Y)) + + declare_estimator(handler = label_estimator(my_estimator), + label = "mean", + inquiry = "Y_bar") > > run_design(design_3) inquiry estimand estimator estimate 1 Y_bar 0.570 mean 0.57 2 ATE 0.136 <NA> NA > > # Use `term` to select particular coefficients > design_4 <- + design + + declare_inquiry(difference_in_cates = mean(Y_Z_1[gender == 1] - Y_Z_0[gender == 1]) - + mean(Y_Z_1[gender == 0] - Y_Z_0[gender == 0])) + + declare_estimator(Y ~ Z * gender, + term = "Z:gender", + inquiry = "difference_in_cates", + .method = lm_robust) > > run_design(design_4) inquiry estimand term estimator estimate std.error 1 difference_in_cates 0.1443609 Z:gender estimator 0.1966622 0.1381796 2 ATE 0.1180000 <NA> <NA> NA NA statistic p.value conf.low conf.high df outcome 1 1.423236 0.1562576 -0.07584754 0.469172 196 Y 2 NA NA NA NA NA <NA> > > if(require("broom")) { + + # Use glm from base R + design_5 <- + design + + declare_estimator(Y ~ Z + gender, + family = "gaussian", + inquiry = "ATE", + .method = glm) + + run_design(design_5) + + # If we use logit, we'll need to estimate the average marginal effect with + # marginaleffects::avg_slopes. We wrap this up in a function we'll pass to + # .summary. + + if(require("marginaleffects")) { + + library(marginaleffects) # for predictions + library(broom) # for tidy + + tidy_avg_slopes <- function(x) { + tidy(avg_slopes(x)) + } + + design_6 <- + design + + declare_estimator( + Y ~ Z + gender, + .method = glm, + family = binomial("logit"), + .summary = tidy_avg_slopes, + term = "Z" + ) + + run_design(design_6) + + # Multiple estimators for one inquiry + + design_7 <- + design + + declare_estimator(Y ~ Z, + .method = lm_robust, + inquiry = "ATE", + label = "OLS") + + declare_estimator( + Y ~ Z + gender, + .method = glm, + family = binomial("logit"), + .summary = tidy_avg_slopes, + inquiry = "ATE", + term = "Z", + label = "logit" + ) + + run_design(design_7) + + } + + } Loading required package: broom Loading required package: marginaleffects Error: Error in step 6 (estimator): Error in `[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp): attempt access index 11/11 in VECTOR_ELT Execution halted Flavor: r-devel-windows-x86_64

Package randomizr

Current CRAN status: NOTE: 10, OK: 3

Version: 1.0.0
Check: compiled code
Result: NOTE File ‘randomizr/libs/randomizr.so’: Found non-API call to R: ‘SETLENGTH’ Compiled code should not call non-API entry points in R. See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual, and section ‘Moving into C API compliance’ for issues with the use of non-API entry points. Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64

Version: 1.0.0
Check: compiled code
Result: NOTE File 'randomizr/libs/x64/randomizr.dll': Found non-API call to R: 'SETLENGTH' Compiled code should not call non-API entry points in R. See 'Writing portable packages' in the 'Writing R Extensions' manual, and section 'Moving into C API compliance' for issues with the use of non-API entry points. Flavors: r-devel-windows-x86_64, r-release-windows-x86_64

Package ri2

Current CRAN status: OK: 13

Package vayr

Current CRAN status: OK: 13

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.