added regression for meds with death outcome

This commit is contained in:
Tanushree Tunstall 2020-11-23 18:24:30 +00:00
parent 4800f804e4
commit 9158866dda

View file

@ -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")
}