knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
With the psfmi
package you can pool logistic regression models by using
the following pooling methods: RR (Rubin's Rules), D1, D2, D3 and MPR
(Median R Rule).
You can also use forward or backward selection from the pooled model.
This vignette show you examples of how to apply these procedures.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + Function + JobControl + JobDemands + SocialSupport, method="D1") pool_lr$RR_model
Back to [Examples]
Pooling Logistic regression models over 5 imputed datasets with backward selection using a p-value of 0.05 and as method D1 and forcing the predictor "Smoking" in the models during backward selection.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + Function + JobControl + JobDemands + SocialSupport, keep.predictors = "Smoking", method="D1", p.crit=0.05, direction="BW") pool_lr$RR_model_final pool_lr$multiparm_final pool_lr$predictors_out
Back to [Examples]
Pooling Logistic regression models over 5 imputed datasets with backward selection using a p-value of 0.05 and as method D1 and forcing the predictor "Smoking" in the models during backward selection.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + Function + JobControl + JobDemands + SocialSupport, keep.predictors = "Smoking", method="MPR", p.crit=0.05, direction="BW") pool_lr$RR_model_final pool_lr$multiparm_final pool_lr$predictors_out
Back to [Examples]
Pooling Logistic regression models over 5 imputed datasets with BS using a p-value of 0.05 and as method D2. Several interaction terms, including a categorical predictor, are part of the selection procedure.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + Function + JobControl + factor(Carrying) + factor(Satisfaction) + factor(Carrying):Smoking + Gender:Smoking, method="D2", p.crit=0.05, direction="BW") pool_lr$RR_model_final pool_lr$multiparm_final pool_lr$predictors_out
Back to [Examples]
Same as above but now forcing several predictors, including interaction terms, in the model during BS.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + Function + JobControl + factor(Carrying) + factor(Satisfaction) + factor(Carrying):Smoking + Gender:Smoking, keep.predictors = c("Smoking*Carrying", "JobControl"), method="D1", p.crit=0.05, direction="BW") pool_lr$RR_model_final pool_lr$multiparm_final pool_lr$predictors_out
Back to [Examples]
Pooling Logistic regression models over 5 imputed datasets with BS using a p-value of 0.05 and as method D1. A spline predictor and interaction term are part of the selection procedure.
library(psfmi) pool_lr <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", formula = Chronic ~ Gender + Smoking + JobControl + factor(Carrying) + factor(Satisfaction) + factor(Carrying):Smoking + rcs(Function, 3), method="D1", p.crit=0.05, direction="BW") pool_lr$RR_model_final pool_lr$multiparm_final pool_lr$predictors_out
Back to [Examples]
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.