Summarizes covariate values within the estimated subgroups

summarize.subgroups(x, ...)

# S3 method for default
summarize.subgroups(x, subgroup, ...)

# S3 method for subgroup_fitted
summarize.subgroups(x, ...)

Arguments

x

a fitted object from fit.subgroup() or a matrix of covariate values

...

optional arguments to summarize.subgroups methods

subgroup

vector of indicators of same length as the number of rows in x if x is a matrix. A value of 1 in the ith position of subgroup indicates patient i is in the subgroup of patients recommended the treatment and a value of 0 in the ith position of subgroup indicates patient i is in the subgroup of patients recommended the control. If x is a fitted object returned by fit.subgroup(), subgroup is not needed.

See also

fit.subgroup for function which fits subgroup identification models and print.subgroup_summary for arguments for printing options for summarize.subgroups().

Examples

library(personalized) set.seed(123) n.obs <- 1000 n.vars <- 50 x <- matrix(rnorm(n.obs * n.vars, sd = 3), n.obs, n.vars) # simulate non-randomized treatment xbetat <- 0.5 + 0.5 * x[,21] - 0.5 * x[,41] trt.prob <- exp(xbetat) / (1 + exp(xbetat)) trt01 <- rbinom(n.obs, 1, prob = trt.prob) trt <- 2 * trt01 - 1 # simulate response delta <- 2 * (0.5 + x[,2] - x[,3] - x[,11] + x[,1] * x[,12]) xbeta <- x[,1] + x[,11] - 2 * x[,12]^2 + x[,13] xbeta <- xbeta + delta * trt # continuous outcomes y <- drop(xbeta) + rnorm(n.obs, sd = 2) # create function for fitting propensity score model prop.func <- function(x, trt) { # fit propensity score model propens.model <- cv.glmnet(y = trt, x = x, family = "binomial") pi.x <- predict(propens.model, s = "lambda.min", newx = x, type = "response")[,1] pi.x } subgrp.model <- fit.subgroup(x = x, y = y, trt = trt01, propensity.func = prop.func, loss = "sq_loss_lasso", nfolds = 5) # option for cv.glmnet comp <- summarize.subgroups(subgrp.model) print(comp, p.value = 0.01)
#> Avg (recom 0) Avg (recom 1) 0 - 1 pval 0 - 1 SE (recom 0) SE (recom 1) #> V1 -0.4560 0.6550 -1.1111 3.078e-09 0.1253 0.1370 #> V2 -1.3392 1.8912 -3.2305 2.105e-74 0.1127 0.1166 #> V3 1.3295 -1.7318 3.0612 2.593e-70 0.1088 0.1158 #> V5 -0.3309 0.1854 -0.5163 6.601e-03 0.1295 0.1386 #> V11 0.3759 -0.2796 0.6555 5.801e-04 0.1306 0.1378 #> V13 -0.6363 0.3487 -0.9850 2.472e-07 0.1275 0.1402 #> V21 0.3060 -0.4939 0.7998 3.513e-05 0.1221 0.1487 #> V41 -0.2198 0.3934 -0.6132 1.080e-03 0.1291 0.1354
# or we can simply supply the matrix x and the subgroups comp2 <- summarize.subgroups(x, subgroup = 1 * (subgrp.model$benefit.scores > 0)) print(comp2, p.value = 0.01)
#> Avg (recom 0) Avg (recom 1) 0 - 1 pval 0 - 1 SE (recom 0) SE (recom 1) #> V1 -0.4560 0.6550 -1.1111 3.078e-09 0.1253 0.1370 #> V2 -1.3392 1.8912 -3.2305 2.105e-74 0.1127 0.1166 #> V3 1.3295 -1.7318 3.0612 2.593e-70 0.1088 0.1158 #> V5 -0.3309 0.1854 -0.5163 6.601e-03 0.1295 0.1386 #> V11 0.3759 -0.2796 0.6555 5.801e-04 0.1306 0.1378 #> V13 -0.6363 0.3487 -0.9850 2.472e-07 0.1275 0.1402 #> V21 0.3060 -0.4939 0.7998 3.513e-05 0.1221 0.1487 #> V41 -0.2198 0.3934 -0.6132 1.080e-03 0.1291 0.1354