Open Ink-Mo opened 3 months ago
svycoxph
svycoxph
& use survey::regTermTest
This is interaction code in forestcox.R
(jstable)
pv_int <- tryCatch(
{
pvs_int <- possible_svycoxph(as.formula(gsub(xlabel, paste0(xlabel, "*", var_subgroup), deparse(formula))), design = data) %>%
summary() %>%
coefficients()
pv_int <- round(pvs_int[nrow(pvs_int), ncol(pvs_int)], decimal.pvalue)
pv_int
},
error = function(e) {
return(NA)
}
)
## interaction 여러개인 경우 pv_int 구하기
model.int <- possible_svycoxph(as.formula(gsub(xlabel, paste0(xlabel, "*", var_subgroup), deparse(formula))), design = data)
if (any(is.na(model.int))) {
} else if (sum(grepl(":", names(coef(model.int)))) > 1) {
model.int$call$formula <- as.formula(gsub(xlabel, paste0(xlabel, "*", var_subgroup), deparse(formula)))
pv_anova <- survey::regTermTest(model.int, as.formula(paste0("~", xlabel, ":", var_subgroup)))
pv_int <- round(pv_anova$p[1], decimal.pvalue)
}
Hi Prof. Jinseob Kim,
Thank you for your excellent work. I noticed that the TableSubgroupMultiCox function generates a "P for interaction" value when analyzing survey data. I would like to understand the calculation process for this "P for interaction" value when analyzing survey data. Could you please share the code? Thank you!