I have a dataframe like this one, with 10 columns Alcohol (from alcohol1 to alcohol10)
ID Status matching Alcohol1 Alcohol2
1 1 1 1 0
2 0 1 0 1
3 0 2 0 1
4 1 2 0 0
I have many logistic regression models to run using the alcohol columns as explanatory variables. I have created a function that performs this.
And now I would like to summarize the results of all my models in one data frame. I need my estimated coefficient, the lower bound of my 95% confidence interval, the upper bound and the pvalue. I managed to get my estimated coefficient and the pvalue but I can't get the confidence interval (or the variance which would also fit) (which is normally obtained with a summary)
Here are the functions I used:
library(broom)
library(purrr)
f1 <- function(column) {
tidy(clogit(
as.formula(
paste("status ~", column, "+ strata(matching)")),
data = table
))
}
model_results <- map_dfr(
set_names(names(table)[4:14]),
f1
)
The expected result would be something like this
term estimate lower.95 upper.95 pvalue
Alcohol1
Alcohol2
…
thank you in advance for the help