So I have this code in R ...
Tabla2 <- tbl_svysummary(data = Beta18.1Pond, by = CTBC, missing = "no",
digits = list(all_continuous() ~ c(2,2)),
include = c(SR, QS23, QS23R, QSSEXO, QS500, QS501U, QS501C, QS50328,
QS505A, QS505B, QS505C, QS505D, QS506, QS2425N, QS25AA,
QS26, QS27R, QS102, QS109, HV270, Region, HV025, HV009, HV115,
CTBC)) %>%
add_p(test = list(all_continuous() ~
"svy.t.test", all_categorical() ~
"svy.adj.chisq.test"), include = everything()) %>%
modify_header(label ~ "**Variable**") %>%
modify_spanning_header(c("stat_1", "stat_2") ~
"**Conocimiento sobre tuberculosis pulmonar**") %>%
modify_caption("**Tabla 2. Análisis descriptivo**")
Tabla2
And i want to add a comand to calculate the confidence interval for a chi-square (in this case a confidence interval for the difference in proportions) and t-test in my table. Anyone knows how could i do it?
Thanks for your responses.
For t-tests, you can simply use add_ci() since it's designed to handle continuous data. For categorical data, I think you need some to transform your chi-square test results into a measure that allows for confidence interval computation, such as converting the chi-square test into a test for proportions if applicable :