- using R Under development (unstable) (2026-11-28 r91005)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
gcc-16 (Debian 16.2.0-5) 16.2.0
GNU Fortran (Debian 16.2.0-5) 16.2.0
- running under: Debian GNU/Linux forky/sid
- using session charset: UTF-8
* current time: 2026-11-29 13:37:20 UTC
- checking for file ‘MRStdCRT/DESCRIPTION’ ... OK
- checking extension type ... Package
- this is package ‘MRStdCRT’ version ‘0.1.3’
- package encoding: UTF-8
- checking CRAN incoming feasibility ... [2s/2s] OK
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking serialization versions ... OK
- checking whether package ‘MRStdCRT’ can be installed ... OK
See the install log for details.
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking ‘build’ directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [3s/3s] OK
- checking whether the package can be loaded with stated dependencies ... [2s/3s] OK
- checking whether the package can be unloaded cleanly ... [2s/3s] OK
- checking whether the namespace can be loaded with stated dependencies ... [2s/2s] OK
- checking whether the namespace can be unloaded cleanly ... [2s/3s] OK
- checking loading without being on the library search path ... [2s/3s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [13s/17s] OK
- checking Rd files ... [0s/0s] OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of ‘data’ directory ... OK
- checking data for non-ASCII characters ... [0s/0s] OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking installed files from ‘inst/doc’ ... OK
- checking files in ‘vignettes’ ... OK
- checking examples ... [2s/3s] OK
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [34s/44s] ERROR
Running ‘estimand-specific.R’ [3s/4s]
Running ‘input-encoding.R’ [2s/3s]
Running ‘log-inference.R’ [14s/17s]
Running ‘regression.R’ [13s/17s]
Running ‘weighted-models.R’ [3s/3s]
Running the tests in ‘tests/estimand-specific.R’ failed.
Complete output:
> library(MRStdCRT)
> source(file.path("helpers", "weighted-reference.R"))
>
> specific_unweighted_reference <- function(data, method, family, corstr,
+ probability, interactions = FALSE) {
+ d <- reference_data(data, probability)
+ fixed <- outcome ~ intervention + within_x + between_x + H
+ if (interactions) fixed <- update(fixed, . ~ . + intervention:within_x +
+ intervention:between_x)
+ mixed <- update(fixed, . ~ . + (1 | reference_id))
+ model <- switch(method,
+ GEE = geepack::geeglm(fixed, d, id = reference_id,
+ family = family, corstr = corstr),
+ LMM = nlme::lme(fixed, random = ~ 1 | reference_id, data = d),
+ GLMM = if (family$family == "gaussian")
+ lme4::lmer(mixed, data = d, REML = FALSE) else
+ lme4::glmer(mixed, data = d, family = family))
+ beta <- if (method == "GEE") coef(model) else lme4::fixef(model)
+ tau2 <- if (method == "GLMM")
+ as.data.frame(lme4::VarCorr(model))$vcov[1] else NA_real_
+ predictions <- vapply(c(1, 0), function(a) {
+ nd <- d
+ nd$intervention <- a
+ design <- model.matrix(fixed, nd)
+ stopifnot(setequal(colnames(design), names(beta)))
+ lp <- drop(design[, names(beta), drop = FALSE] %*% beta)
+ if (method == "GEE") family$linkinv(lp)
+ else if (method == "LMM" || family$family == "gaussian") lp
+ else if (family$family == "binomial")
+ plogis(lp / sqrt(1 + 3 * tau2 / pi^2))
+ else exp(lp + tau2 / 2)
+ }, numeric(nrow(d)))
+ reference_aggregate(list(data = d, predictions = predictions))
+ }
>
> specific_reference <- function(data, method, family, corstr, scale,
+ probability = NULL, interactions = FALSE) {
+ if (is.null(probability)) {
+ assignments <- data$intervention[!duplicated(data$cluster)]
+ probability <- rep(mean(assignments), nrow(data))
+ }
+ weighted <- reference_aggregate(reference_fitting(data, method, family,
+ corstr, interactions = interactions, probability = probability))
+ unweighted <- specific_unweighted_reference(data, method, family, corstr,
+ probability, interactions)
+ means <- rbind(cATE = weighted$means["cATE", ],
+ iATE = unweighted$means["iATE", ])
+ list(effect = reference_effect(means, scale), means = means)
+ }
>
> specific_deleted_reference <- function(data, method, family, corstr, scale,
+ probability = NULL,
+ interactions = FALSE) {
+ t(vapply(unique(data$cluster), function(id) {
+ keep <- data$cluster != id
+ specific_reference(data[keep, ], method, family, corstr, scale,
+ if (is.null(probability)) NULL else probability[keep], interactions)$effect
+ }, numeric(3)))
+ }
>
> specific_check <- function(data, corstr, scale, probability = NULL,
+ row_probability = probability,
+ interactions = FALSE) {
+ family <- gaussian()
+ alpha <- .10
+ full <- specific_reference(data, "GEE", family, corstr, scale,
+ row_probability, interactions)
+ deleted <- specific_deleted_reference(data, "GEE", family, corstr, scale,
+ row_probability, interactions)
+ expected <- reference_inference(full$effect, deleted, scale, alpha)
+ formula <- if (interactions) outcome ~ intervention * x + H else
+ outcome ~ intervention + x + H
+ fit <- MRStdCRT_fit(formula, data, "cluster", "intervention", probability,
+ family = family, method = "GEE", corstr = corstr, scale = scale,
+ alpha = alpha, model_weights = "estimand_specific")
+ assert_close(fit$estimate, expected$estimate)
+ assert_close(fit$ics, expected$ics)
+ stopifnot(identical(names(fit$ics), c("statistic", "p.value")),
+ identical(fit$model_weights, "estimand_specific"),
+ identical(rownames(fit$estimate), c("cATE", "iATE")),
+ fit$m == length(unique(data$cluster)))
+ # The paired difference retains covariance between the two model fits.
+ naive_se <- sqrt(sum(expected$se[1:2]^2))
+ stopifnot(abs(expected$se[3] - naive_se) > 1e-4)
+ if (scale == "RR") {
+ logged <- MRStdCRT_fit(formula, data, "cluster", "intervention", probability,
+ family = family, method = "GEE", corstr = corstr, scale = scale,
+ alpha = alpha, model_weights = "estimand_specific", inference_scale = "log")
+ m <- nrow(deleted)
+ log_deleted <- log(deleted[, 1:2, drop = FALSE])
+ log_se <- sqrt((m - 1) / m *
+ colSums(sweep(log_deleted, 2, colMeans(log_deleted))^2))
+ cutoff <- qt(1 - alpha / 2, m - 1)
+ assert_close(logged$log_se, log_se)
+ assert_close(logged$estimate[["CI lower"]],
+ exp(log(full$effect[1:2]) - cutoff * log_se))
+ assert_close(logged$estimate[["CI upper"]],
+ exp(log(full$effect[1:2]) + cutoff * log_se))
+ assert_close(logged$estimate[["p-value"]],
+ 2 * pt(abs(log(full$effect[1:2]) / log_se), m - 1, lower.tail = FALSE))
+ stopifnot(identical(logged$ics, fit$ics),
+ identical(logged$estimate[, 1:2], fit$estimate[, 1:2]))
+ }
+ invisible(fit)
+ }
>
> # Named probabilities follow cluster IDs despite shuffled rows and names.
> d <- weighted_fixture()
> d$outcome <- d$continuous + .25 * d$intervention * d$x
> set.seed(1892)
> d <- d[sample(nrow(d)), ]
> p <- setNames(seq(.4, .65, length.out = 12), as.character(1:12))
> specific_check(d, "exchangeable", "RR", probability = p[12:1],
+ row_probability = unname(p[as.character(d$cluster)]),
+ interactions = TRUE)
Error: 'passing a bare name as 'component' to model.extract()' is deprecated.
Use 'the string "id"' instead.
See help("Deprecated")
Execution halted
Running the tests in ‘tests/input-encoding.R’ failed.
Complete output:
> library(MRStdCRT)
> source(file.path("helpers", "weighted-reference.R"))
>
> # Encodings and user column labels must not change the statistical analysis.
> # In particular, passing character IDs directly to geeglm can silently coerce
> # them to NA; comparison of both point estimates and paired inference catches
> # that problem rather than merely checking whether the call succeeds.
> encoding_no_warning <- function(expr) {
+ withCallingHandlers(force(expr), warning = function(w) {
+ stop("Unexpected input-encoding warning: ", conditionMessage(w),
+ call. = FALSE)
+ })
+ }
>
> encoding_point <- function(data, weights, method = "GEE", family = gaussian(),
+ formula = outcome ~ intervention * x + H,
+ cluster = "cluster") {
+ point <- getFromNamespace(if (weights == "estimand_specific")
+ "mrs_estimand_specific_point" else "MRStdCRT_point", "MRStdCRT")
+ args <- list(formula = formula, data = data, cluster = cluster,
+ trt = "intervention", trtprob = rep(.5, nrow(data)),
+ family = family, corstr = "exchangeable", method = method,
+ scale = "RD")
+ if (weights != "estimand_specific") args$model_weights <- weights
+ encoding_no_warning(do.call(point, args))[[3L]]
+ }
>
> encoding_weights <- c("none", "inverse_cluster_size", "estimand_specific")
> encoding_data <- weighted_fixture()
> encoding_configs <- list(
+ list(method = "GEE", family = gaussian(), outcome = "continuous"),
+ list(method = "GEE", family = binomial(), outcome = "binary"),
+ list(method = "LMM", family = gaussian(), outcome = "continuous"),
+ list(method = "GLMM", family = gaussian(), outcome = "continuous"),
+ list(method = "GLMM", family = binomial(), outcome = "binary"))
>
> # TRUE/FALSE is an explicitly supported representation of the 0/1 assignment.
> # Exercise prediction as well as fitting, including treatment interactions.
> for (config in encoding_configs) {
+ numeric_data <- encoding_data
+ numeric_data$outcome <- numeric_data[[config$outcome]]
+ logical_data <- numeric_data
+ logical_data$intervention <- as.logical(logical_data$intervention)
+ for (weights in encoding_weights) {
+ expected <- encoding_point(numeric_data, weights, config$method,
+ config$family)
+ actual <- encoding_point(logical_data, weights, config$method,
+ config$family)
+ assert_close(actual, expected, label = paste(config$method, weights,
+ "logical treatment"))
+ }
+ }
Error: Unexpected input-encoding warning: 'passing a bare name as 'component' to model.extract()' is deprecated.
Use 'the string "id"' instead.
See help("Deprecated")
Execution halted
Running the tests in ‘tests/weighted-models.R’ failed.
Complete output:
> library(MRStdCRT)
> source(file.path("helpers", "weighted-reference.R"))
>
> d <- weighted_fixture()
> configurations <- list(
+ list(method = "GEE", family = gaussian(), outcome = "continuous"),
+ list(method = "GEE", family = binomial(), outcome = "binary"),
+ list(method = "GEE", family = poisson(), outcome = "count"),
+ list(method = "LMM", family = gaussian(), outcome = "continuous"),
+ list(method = "GLMM", family = gaussian(), outcome = "continuous"),
+ list(method = "GLMM", family = binomial(), outcome = "binary"),
+ list(method = "GLMM", family = poisson(), outcome = "count"))
> for (config in configurations) {
+ d$outcome <- d[[config$outcome]]
+ correlations <- if (config$method == "GEE")
+ c("independence", "exchangeable") else "exchangeable"
+ for (correlation in correlations) {
+ ref <- reference_fitting(d, config$method, config$family, correlation)
+ compare_internal_predictions(ref, config$method, config$family, correlation)
+ aggregation <- reference_aggregate(ref)
+ actual <- package_point(d, config$method, config$family, correlation)
+ assert_close(actual, reference_effect(aggregation$means), 1e-7, 1e-7)
+ stopifnot(max(abs(aggregation$correction)) > 1e-6)
+ }
+ }
Error: 'passing a bare name as 'component' to model.extract()' is deprecated.
Use 'the string "id"' instead.
See help("Deprecated")
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes ... OK
- checking re-building of vignette outputs ... [18s/23s] ERROR
Error(s) in re-building vignettes:
...
--- re-building ‘introduction.Rmd’ using rmarkdown
Quitting from introduction.Rmd:475-482 [weighted-gee-example]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error:
! Full-data fit [weighted GEE, gaussian(identity)]: GEE backend warning: 'passing a bare name as 'component' to model.extract()' is deprecated.
Use 'the string "id"' instead.
See help("Deprecated")
---
Backtrace:
▆
1. └─MRStdCRT::MRStdCRT_fit(...)
2. └─base::tryCatch(...)
3. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
4. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. └─value[[3L]](cond)
6. └─MRStdCRT (local) point_error(e, "Full-data fit")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'introduction.Rmd' failed with diagnostics:
Full-data fit [weighted GEE, gaussian(identity)]: GEE backend warning: 'passing a bare name as 'component' to model.extract()' is deprecated.
Use 'the string "id"' instead.
See help("Deprecated")
--- failed re-building ‘introduction.Rmd’
SUMMARY: processing the following file failed:
‘introduction.Rmd’
Error: Vignette re-building failed.
Execution halted
- checking PDF version of manual ... [4s/5s] OK
- checking HTML version of manual ... [0s/1s] OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 2 ERRORs