From 9158866dda661df5841330985625aac488594ad3 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Mon, 23 Nov 2020 18:24:30 +0000 Subject: [PATCH] added regression for meds with death outcome --- logistic_regression.R | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/logistic_regression.R b/logistic_regression.R index e7f7a8f..932935b 100644 --- a/logistic_regression.R +++ b/logistic_regression.R @@ -234,6 +234,10 @@ my_reg_data_med = merge(clinical_df_ics, my_med_sig , by = intersect(names(clinical_df_ics), names(my_med_sig)) ) +#----------------------------- +# outcome: death + obesity +# data: fp adults +#----------------------------- #my_reg_params_meds = c(my_reg_params, sig_npa_cols) my_reg_params_meds = colnames(my_reg_data_med) my_reg_params_meds1 = my_reg_params_meds[!my_reg_params_meds%in%c("mosaic", "flustat" @@ -255,4 +259,30 @@ for(i in my_reg_params_meds1) { #print (PseudoR2(model_reg)) print(nobs(model_reg)) cat("=================================================================================\n") +} + + +#----------------------------- +# outcome: death +# data: fp adults +#----------------------------- +my_reg_params_meds1v2 = my_reg_params_meds[!my_reg_params_meds%in%c("mosaic" + , "flustat" + , "onset_2_initial" + , "onsfindeath" + , "ia_exac_copd" + , "death")] + + + +for(i in my_reg_params_meds1v2) { + #print (i) + p_form = as.formula(paste("death ~ ", i ,sep = "")) + print(p_form) + model_reg = glm(p_form , family = binomial, data = my_reg_data_med) + print(summary(model_reg)) + print(exp(cbind(OR = coef(model_reg), confint(model_reg)))) + #print (PseudoR2(model_reg)) + print(nobs(model_reg)) + cat("=================================================================================\n") } \ No newline at end of file