From 9c41bd18e616a44b91ab4162d5587816ad1f8f47 Mon Sep 17 00:00:00 2001 From: LukaszChrostowski Date: Thu, 30 May 2024 17:30:42 +0100 Subject: [PATCH] fix for calibrated estimation regarding #50 --- R/summary.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/summary.R b/R/summary.R index 05b37ef..f80ea35 100644 --- a/R/summary.R +++ b/R/summary.R @@ -102,6 +102,11 @@ summary.nonprobsvy <- function(object, } else { se_mean <- NULL } + if (class(object)[2] %in% c("nonprobsvy_dr", "nonprobsvy_ipw")) { + est_totals <- object$selection$est_totals + } else { + est_totals <- "no value for the selected method" + } res <- structure( list( call = object$call, @@ -126,7 +131,7 @@ summary.nonprobsvy <- function(object, likelihood = ifelse(class(object)[2] %in% c("nonprobsvy_dr", "nonprobsvy_ipw"), object$selection$log_likelihood, "no value for the selected method"), df_residual = ifelse(class(object)[2] %in% c("nonprobsvy_dr", "nonprobsvy_ipw"), object$selection$df_residual, "no value for the selected method"), weights = summary(object$weights), - est_totals = ifelse(class(object)[2] %in% c("nonprobsvy_dr", "nonprobsvy_ipw"), object$selection$est_totals, "no value for the selected method"), + est_totals = est_totals, coef = cf, std_err = se, w_val = wald_test_stat,