Skip to content

Instantly share code, notes, and snippets.

@andrigerber
andrigerber / Model selection farward elimination
Last active December 3, 2021 16:20
Mastherteshis analysis
### Model selection
Vorlagestudie:
* Variables with P < 0.20 from the univariate analyses were selected as candidates for inclusion in the multivariate model and were
retained in the final model if they were significant at P < 0.10 or if they altered any of the other estimates (i.e., odds ratio) by more than 10%
* Or from my proposal: Thereby, the predictors are selected based on previous research (Field, 2012). From there, a forward modeling strategy will be used to identify variables with a p-value of under 0,25 from the univariable t-test and included in the multivariable model. They will be included in the preliminary main effects model if they achieve the threshold (p < 0,05) in the partial likelihood ratio test of the nested model or if they change any variables coefficient (𝛥𝛽̂ > 20%) substantially (Behnke, 2014 pp. 105-111; Hosmer, 2013, pp. 90-94).
* Workflow: Nur variablen mit p<0.25 inkludieren aus "columne K des unadjusted model/univariate model", anschliessend "(Rao-Scott+F) LRT" durchfü
@andrigerber
andrigerber / tableone export helpers
Created November 24, 2021 11:09
Tableone_function_transfer
```{r}
### tableone export helpers
### Turn tableone output matrix into tidyverse data_frame
tableone_mat_to_data_frame <- function(mat) {
mat %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "Variable") %>%
tibble::as_data_frame()
}
@andrigerber
andrigerber / Codebook automated
Last active October 7, 2021 14:03
Codebook generator
---
title: "Codebook"
output:
html_document:
toc: true
toc_depth: 4
toc_float: true
code_folding: 'hide'
self_contained: true
pdf_document:
install.packages('tinytex')
tinytex::install_tinytex()
# to uninstall TinyTeX, run tinytex::uninstall_tinytex()
- upload RStudio over RStudio site
- or download MikTex for Tex and TexMaker