Skip to content

Commit 9e66b35

Browse files
class
1 parent e5a9ec0 commit 9e66b35

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

R/est_s_t_y.R

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ SIM <- function(X, Y, kernel, method, single_index_method, use_mave){
120120
#' @param coef_M_R1.fit Optional starting coefficients for missingness model fit
121121
#' in `R = 1` stratum.
122122
#'
123-
#' @return A named list of estimates and uncertainty summaries for each value in
123+
#' @return A named list of class `est_psi` that contains estimates and uncertainty summaries for each value in
124124
#' `gamma`. Core elements include point estimates (`est`, `est_R1`, `est_R0`), variance
125125
#' estimates (`var`, `var_R1`, `var_R0`), and confidence interval bounds (`lowerCI*`, `upperCI*`).
126126
#' Additional components depend on `simple_trunc` and `IF_output`:
@@ -144,6 +144,7 @@ SIM <- function(X, Y, kernel, method, single_index_method, use_mave){
144144
#' # simple_trunc = TRUE, quant = 0.99, kernel="dnorm",
145145
#' # single_index_method="norm1coef", method="optim")
146146
#' @export
147+
#' @rdname est_psi
147148
est_psi <- function(Y, M, R, X, t, trt, gamma, fold, seed, IF_output,
148149
simple_trunc, quant, kernel, single_index_method, method="optim",
149150
use_mave=TRUE, s_t_y=NULL, coef_g.fit=NULL, coef_t_R0.fit=NULL,
@@ -616,21 +617,25 @@ est_psi <- function(Y, M, R, X, t, trt, gamma, fold, seed, IF_output,
616617
}
617618
}else{
618619
if(simple_trunc){
619-
result <- list(est=r_est, est_R1=r_est_R1, est_R0=r_est_R0,
620-
var=r_var, var_R1=r_var_R1, var_R0=r_var_R0,
621-
lowerCI=r_lowerCI, lowerCI_R1=r_lowerCI_R1, lowerCI_R0=r_lowerCI_R0,
622-
upperCI=r_upperCI, upperCI_R1=r_upperCI_R1, upperCI_R0=r_upperCI_R0,
623-
id_list=containers$id_list, fold_index_l=fold_index_l)
620+
result <- structure(
621+
list(est=r_est, est_R1=r_est_R1, est_R0=r_est_R0,
622+
var=r_var, var_R1=r_var_R1, var_R0=r_var_R0,
623+
lowerCI=r_lowerCI, lowerCI_R1=r_lowerCI_R1, lowerCI_R0=r_lowerCI_R0,
624+
upperCI=r_upperCI, upperCI_R1=r_upperCI_R1, upperCI_R0=r_upperCI_R0,
625+
id_list=containers$id_list, fold_index_l=fold_index_l),
626+
class = c("est_psi"))
624627
}else{
625-
result <- list(est=r_est, est_R1=r_est_R1, est_R0=r_est_R0,
626-
est_trunc=r_est_trunc, est_trunc_R1=r_est_trunc_R1, est_trunc_R0=r_est_trunc_R0,
627-
var=r_var, var_R1=r_var_R1, var_R0=r_var_R0,
628-
var_trunc=r_var_trunc, var_trunc_R1=r_var_trunc_R1, var_trunc_R0=r_var_trunc_R0,
629-
lowerCI=r_lowerCI, lowerCI_R1=r_lowerCI_R1, lowerCI_R0=r_lowerCI_R0,
630-
upperCI=r_upperCI, upperCI_R1=r_upperCI_R1, upperCI_R0=r_upperCI_R0,
631-
lowerCI_trunc=r_lowerCI_trunc, lowerCI_trunc_R1=r_lowerCI_trunc_R1, lowerCI_trunc_R0=r_lowerCI_trunc_R0,
632-
upperCI_trunc=r_upperCI_trunc, upperCI_trunc_R1=r_upperCI_trunc_R1, upperCI_trunc_R0=r_upperCI_trunc_R0,
633-
id_list=containers$id_list, fold_index_l=fold_index_l)
628+
result <- structure(
629+
list(est=r_est, est_R1=r_est_R1, est_R0=r_est_R0,
630+
est_trunc=r_est_trunc, est_trunc_R1=r_est_trunc_R1, est_trunc_R0=r_est_trunc_R0,
631+
var=r_var, var_R1=r_var_R1, var_R0=r_var_R0,
632+
var_trunc=r_var_trunc, var_trunc_R1=r_var_trunc_R1, var_trunc_R0=r_var_trunc_R0,
633+
lowerCI=r_lowerCI, lowerCI_R1=r_lowerCI_R1, lowerCI_R0=r_lowerCI_R0,
634+
upperCI=r_upperCI, upperCI_R1=r_upperCI_R1, upperCI_R0=r_upperCI_R0,
635+
lowerCI_trunc=r_lowerCI_trunc, lowerCI_trunc_R1=r_lowerCI_trunc_R1, lowerCI_trunc_R0=r_lowerCI_trunc_R0,
636+
upperCI_trunc=r_upperCI_trunc, upperCI_trunc_R1=r_upperCI_trunc_R1, upperCI_trunc_R0=r_upperCI_trunc_R0,
637+
id_list=containers$id_list, fold_index_l=fold_index_l),
638+
class = c("est_psi"))
634639
}
635640
}
636641

0 commit comments

Comments
 (0)