Compare commits

..

3 Commits

Author SHA1 Message Date
AG Damsbo
5e58616026 ignore .csv 2022-09-15 08:25:52 +02:00
AG Damsbo
3a0d733616 Major revamp. new "00 master.R" and not using gtsummary 2022-09-14 14:34:34 +02:00
AG Damsbo
152668f778 New scripts for revised regression with gtsummary. Nice, but slow! 2022-08-03 13:52:23 +02:00
44 changed files with 2333 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

7
.gitignore vendored
View File

@ -45,3 +45,10 @@ docs/
# translation temp files
po/*~
# Customs
*.RTF
*.png
*.html
*.zip
*.pdf
*.csv

197
00 master.R Normal file
View File

@ -0,0 +1,197 @@
## =============================================================================
## Notes
## =============================================================================
# Regression analysis relies on the script biv_mul_man.R and two functions: function_reg_table.R and function_trans_table.R
#
# Tables are exported as csv-files. gtsummary has been tried, but performance and flexibility was not op to the task.
# Dependencies has been minimised to primarily use base-R and a tiny bit of dplyr.
#
# Focus has been on universal functions, and the amount of flags has accumulated...
#
# Only retransformation is performed on independent variables (these are not marked in the exported tables).
# Coefs and CIs are transformed according to this:
# https://stats.stackexchange.com/questions/93089/reporting-regression-statistics-after-logarithmic-transformation to allow for interpretation.
## =============================================================================
## Table 1
## =============================================================================
source("data_format.R")
source("table_1.R")
tbl_1
## =============================================================================
## Primary regression analysis
## =============================================================================
source("data_format.R")
outs<-c("mdi_1_enr","mdi_6_newobs_enr")
lbl_x <- NULL # Extra label in file name
inter_reg <- NULL # Interaction variables to include (only multivariate)
biv_mul <- TRUE # Sets flag for both bivariate and multivariate or only multivariate analysis
strat_var <- NULL # Variable to stratify by. Only one variable(!)
trans_vars <- TRUE # Transform variables? T/F
sqrt_vars<-"pase_0" # Variables to sqrt-transfom
log1p_vars<-"nihss_0" # Variables to log1p-transform, not outcome
log_vars <- NULL # Variables to log-transform
log1p_vars_all<-c(log1p_vars,outs) # All variables to log1p-transform, incl outcome
trans_back <- TRUE # Back transform variables? T/F
print_tbl <- TRUE # Print tables? T/F
# source("biv_mul.R")
source("biv_mul_man.R")
export
# bm_16_tbl
strat_var <- "active_treat" # Variable to stratify by. Only one variable(!)
# source("biv_mul.R")
source("biv_mul_man.R")
export
# bm_16_tbl
## =============================================================================
## Sensitivity regression analysis
## =============================================================================
source("data_format.R")
outs<-c("mdi_1","mdi_6")
lbl_x <- "_sens" # Extra label in file name
inter_reg <- NULL # Interaction variables to include (only multivariate)
biv_mul <- TRUE # Sets flag for both bivariate and multivariate or only multivariate analysis
strat_var <- NULL # Variable to stratify by. Only one variable(!)
trans_vars <- TRUE # Transform variables? T/F
sqrt_vars<-"pase_0" # Variables to sqrt-transfom
log1p_vars<-"nihss_0" # Variables to log1p-transform, not outcome
log_vars <- NULL # Variables to log-transform
log1p_vars_all<-c(log1p_vars,outs) # All variables to log1p-transform, incl outcome
trans_back <- TRUE # Back transform variables? T/F
print_tbl <- TRUE # Print tables? T/F
# source("biv_mul.R")
source("biv_mul_man.R")
# rbind("One month",bm_list[[1]][-1],"Six month",bm_list[[2]][-1])
# bm_16_tbl
strat_var <- "active_treat" # Variable to stratify by. Only one variable(!)
# source("biv_mul.R")
source("biv_mul_man.R")
# bm_16_tbl
## =============================================================================
## Interaction regression analysis
## =============================================================================
source("data_format.R")
outs<-c("mdi_1_enr","mdi_6_newobs_enr")
lbl_x <- "_inter" # Extra label in file name
inter_reg <- c("active_treat","pase_0") # Interaction variables to include (only multivariate)
biv_mul <- TRUE # Sets flag for both bivariate and multivariate or only multivariate analysis
trans_vars <- TRUE # Transform variables? T/F
strat_var <- NULL # Variable to stratify by. Only one variable(!)
sqrt_vars<-"pase_0" # Variables to sqrt-transfom
log1p_vars<-"nihss_0" # Variables to log1p-transform, not outcome
log_vars <- NULL # Variables to log-transform
log1p_vars_all<-c(log1p_vars,outs) # All variables to log1p-transform, incl outcome
trans_back <- TRUE # Back transform variables? T/F
print_tbl <- TRUE # Print tables? T/F
# source("regression_interaction.R")
source("biv_mul_man.R")
export
## =============================================================================
## NIHSS~PASE0 regression analysis
## =============================================================================
source("data_format.R")
vars<-c("pase_0", # New variables for analysis
"female",
"age",
"cohab",
"ever_smoker",
"diabetes",
"hypertension",
"afli",
"ami",
"tci",
"pad")
outs<-c("nihss_0")
lbl_x <- "_nihss-pase" # Extra label in file name
inter_reg <- NULL # Interaction variables to include (only multivariate)
biv_mul <- FALSE # Sets flag for both bivariate and multivariate or only multivariate analysis
trans_vars <- TRUE # Transform variables? T/F
strat_var <- NULL # Variable to stratify by. Only one variable(!)
sqrt_vars<-"pase_0" # Variables to sqrt-transfom
log1p_vars<-NULL # Variables to log1p-transform, not outcome
log_vars <- NULL # Variables to log-transform
log1p_vars_all<-c(outs) # All variables to log1p-transform, incl outcome
trans_back <- TRUE # Back transform variables? T/F
print_tbl <- TRUE # Print tables? T/F
# source("regression_nihss-pase.R")
source("biv_mul_man.R")
export

BIN
Archive/.DS_Store vendored Normal file

Binary file not shown.

70
Archive/biv_mul_strat.R Normal file
View File

@ -0,0 +1,70 @@
## =============================================================================
## Requirements
## =============================================================================
library(gtsummary)
## =============================================================================
## Loop
## =============================================================================
bm_list_strat<-list()
for (i in 1:length(outs)){
## Bivariate
biv<-dta |>
dplyr::select(all_of(c("active_treat",vars,outs[i]))) |>
tbl_strata(
strata = active_treat,
.tbl_fun =
~ .x %>%
tbl_uvregression(data=.,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars)
)|>
add_global_p()|>
bold_p() |>
bold_labels() |>
italicize_levels(),
.header = "**{strata}**, N = {n}"
)
## Multivariate
mul<-dta |>
dplyr::select(all_of(c("active_treat",vars,outs[i]))) |>
tbl_strata(
strata = active_treat,
.tbl_fun =
~ .x %>%
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = .) |>
tbl_regression(label = lab_sel(labels_all,vars)
)|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels(),
.header = "**{strata}**, N = {n}"
)
## Merge
biv_mul_strat<-tbl_merge(
tbls = list(biv, mul),
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
bm_list_strat[[i]]<-biv_mul_strat
}
## =============================================================================
## Big merge
## =============================================================================
bm_16_tbl_strat<-tbl_merge(
tbls = bm_list_strat,
tab_spanner = c("**One month follow up**",
"**Six months follow up**")
)

35
Archive/qq-tests.R Normal file
View File

@ -0,0 +1,35 @@
## Tests and visualisation
source("data_format.R")
## Box-Cox power transformation performs comparably to logarithmic transformation. The latter is much easier to explain.
library(MASS)
dta_bc<-dta_backup|>
dplyr::select(all_of(c("mdi_6_newobs_enr",vars)))|>
mutate(pase_0=sqrt(pase_0),
mdi_6_newobs_enr=mdi_6_newobs_enr+1)#|>
# na.omit()
bc<-boxcox(mdi_6_newobs_enr~.,data=dta_bc)
lambda <- bc$x[which.max(bc$y)]
## Q-Q plots to compare the two different approaches, and the non-transformed
q1 <- qqnorm(lm(((mdi_6_newobs_enr^lambda-1)/lambda) ~ .,data=dta_bc)$residuals)
q2 <- qqnorm(lm(log(mdi_6_newobs_enr) ~ .,data=dta_bc)$residuals)
library(patchwork)
plot(q1); plot(q2)
## Histograms for reference
h1 <- hist(dta_bc$pase_0,40); hist(sqrt(dta_bc$pase_0),40)
h2 <- hist(log(dta_bc$mdi_6_newobs_enr),40); hist((dta_bc$mdi_6_newobs_enr),40) ## Observed MDI, and log transformed MDI
plot(h1); plot(h2)

507
Archive/regression_rev.Rmd Normal file
View File

@ -0,0 +1,507 @@
---
title: "revised statistics"
author: "AGDamsbo"
date: "8/1/2022"
output: html_document
toc: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(REDCapR)
library(gtsummary)
theme_gtsummary_compact()
library(REDCapR)
library(gt)
library(lubridate)
library(dplyr)
library(tidyr)
```
# Import
```{r}
dta_all<-read.csv("/Volumes/Data/depression/dep_dataset.csv")
```
# Defining patients to include for analysis
Only including cases with complete pase_0 and MDI at 1 & 6 months
```{r}
dta<-dta_all[!is.na(dta_all$pase_0),]
# &!is.na(dta$mdi_1)&!is.na(dta$mdi_6)
```
## Formatting
```{r echo=FALSE}
dta$diabetes<-factor(dta$diabetes)
dta$pad<-factor(dta$pad)
dta$cohab<-ifelse(dta$civil=="partner","yes","no")|>
factor()
dta$hypertension<-factor(dta$hypertension)
dta$afli[dta$afli=="unknown"]<-NA
dta$afli<-factor(dta$afli)
dta$ever_smoker<-ifelse(dta$smoke_ever=="ever","yes","no")|>
factor()
dta$ami<-factor(dta$ami)
dta$tci<-factor(dta$tci)
dta$thrombolysis<-factor(dta$thrombolysis)
dta$thrombechtomy<-factor(dta$thrombechtomy)
dta$any_reperf<-ifelse(dta$rep_any=="rep","yes","no")|>
factor()
dta$pad<-factor(dta$pad)
dta$nihss_0<-as.numeric(dta$nihss_0)
dta$age<-as.numeric(dta$age)
dta$active_treat<-ifelse(dta$rtreat=="Active","yes","no")|>
factor()
# dta$rtreat<-factor(dta$rtreat)
dta$female<-ifelse(dta$sex=="female","yes","no")|>
factor()
dta$pase_0<-as.numeric(dta$pase_0)
dta$pase_6<-as.numeric(dta$pase_6)
dta$bmi<-as.numeric(dta$bmi)
dta$mdi_6<-as.numeric(dta$mdi_6)
dta$pase_0_bin<-factor(dta$pase_0_bin,levels=c("lower","higher"))
dta$nihss_0_isna<-is.na(dta$nihss_0)
```
```{r}
vars<-c("pase_0",
"female",
"age",
"cohab",
"ever_smoker",
"diabetes",
"hypertension",
"afli",
"ami",
"tci",
"pad",
"nihss_0",
"any_reperf")
# tbl1_vars<-c("thrombolysis", "thrombechtomy","inc_time")
labels_all<-list(active_treat~"Active trial treatment",
pase_0~"PASE score",
age~"Age",
female~"Female sex",
ever_smoker~"History of smoking",
cohab~"Cohabitation",
diabetes~"Known diabetes",
hypertension~"Known hypertension",
afli~"Known Atrialfibrillation",
ami~"Previos myocardial infarction",
tci~"Previos TIA",
pad~"Known peripheral arteriosclerotic disease",
nihss_0~"NIHSS score",
thrombolysis~"Thrombolytic therapy",
thrombechtomy~"Endovascular treatment",
any_reperf~"Any reperfusion treatment",
inc_time~"Study inclusion time",
'[Intercept]'~"Intercept")
lab_sel<-function(label_list,variables_vector){
## Helper function to select labels for gtsummary function from list of all labels based on selected variables.
## Long names in try to ease reading.
include_index<-c()
for (i in 1:length(label_list)) {
include_index[i]<-as.character(label_list[[i]])[2] %in% variables_vector
}
return(label_list[include_index])
}
dta_backup<-dta
```
# Table 1
```{r}
tbl1_vars<-c("active_treat",vars,"inc_time")
dta|>
tbl_summary(missing = "ifany",
include = all_of(tbl1_vars),
missing_text="(Missing)",
label = lab_sel(labels_all,tbl1_vars)
)|>
add_n()|>
as_gt() |>
# modify with gt functions
gt::tab_header("Baseline Characteristics") |>
gt::tab_options(
table.font.size = "small",
data_row.padding = gt::px(1))
```
# Regression - all
```{r}
outs<-c("mdi_1_enr","mdi_6_newobs_enr")
```
## Non-stratified
```{r}
source("biv_mul.R")
bm_16_tbl_rtf <- file("bm_16_tbl.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl.png"
)
```
## Stratified by treatment
```{r}
source("biv_mul_strat.R")
bm_16_tbl_strat_rtf <- file("bm_16_tbl_strat.RTF", "w")
writeLines(bm_16_tbl_strat%>%as_gt()%>%as_rtf(), bm_16_tbl_strat_rtf)
close(bm_16_tbl_strat_rtf)
bm_16_tbl_strat %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_strat.png"
)
```
# Regression - sensitivity
```{r}
outs<-c("mdi_1","mdi_6")
```
## Non-stratified
```{r}
source("biv_mul.R")
bm_16_sens_tbl_rtf <- file("bm_16_sens_tbl.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_sens_tbl_rtf)
close(bm_16_sens_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_sens.png"
)
```
## Stratified by treatment
```{r}
source("biv_mul_strat.R")
bm_16_tbl_strat_sens_rtf <- file("bm_16_tbl_strat_sens.RTF", "w")
writeLines(bm_16_tbl_strat%>%as_gt()%>%as_rtf(), bm_16_tbl_strat_sens_rtf)
close(bm_16_tbl_strat_sens_rtf)
bm_16_tbl_strat %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_strat_sens.png"
)
```
# Regression - interaction
```{r}
outs<-c("mdi_1_enr","mdi_6_newobs_enr")
```
```{r}
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
## Multivariate
mul<-dta |>
dplyr::select(all_of(c("active_treat",vars,outs[i])))|>
lm(formula(
paste(c(paste(c(outs[i],paste(c("active_treat","pase_0"),collapse="*")),collapse="~"),"."),collapse="+")),
data = _)|>
tbl_regression(label = lab_sel(labels_all,c(vars,"active_treat")))|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels()
bm_list[[i]]<-mul
}
## =============================================================================
## Big merge
## =============================================================================
tbl_merge(
tbls = bm_list,
tab_spanner = c("**One month follow up**",
"**Six months follow up**")
)
```
```{r}
library(aod)
for (i in 1:length(outs)){
model<-dta |>
dplyr::select(all_of(c("active_treat",vars,outs[i])))|>
lm(formula(
paste(c(paste(c(outs[i],paste(c("active_treat","pase_0"),collapse="*")),collapse="~"),"."),collapse="+")),
data = _)
wt<-wald.test(Sigma = vcov(model),
b = coef(model),
Terms = model$rank # Rank gives number of coefficients. The interaction is the last.
)
print(wt)
}
```
# Regression - nihss ~ pase_0
```{r}
vars_nihss<-c(
"pase_0",
"female",
"age",
"cohab",
"ever_smoker",
"diabetes",
"hypertension",
"afli",
"ami",
"tci",
"pad",
"nihss_0")
## Bivariate
biv<-dta|>
dplyr::select(all_of(vars_nihss))|>
tbl_uvregression(data=_,
y="nihss_0",
method=lm#,
#label = lab_sel(labels_all,vars)
) |>
add_global_p()|>
bold_p() |>
bold_labels() |>
italicize_levels()
## Multivariate
mul<-dta |>
dplyr::select(all_of(vars_nihss))|>
lm(nihss_0~pase_0+.,
data = _) |>
tbl_regression(
#label = lab_sel(labels_all,vars),
#intercept=FALSE
)|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels()
## Merge
tbl_merge(
tbls = list(biv, mul),
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
```
# Transformed data
```{r}
# dta<-dta_backup
dta<-dta|>
mutate(pase_0=sqrt(pase_0),
nihss_0=log1p(nihss_0),
mdi_1_enr=log1p(mdi_1_enr), # log1p(x) svarer til log(x+1)
mdi_6_newobs_enr=log1p(mdi_6_newobs_enr))|>
data.frame()
library(dplyr)
# source("biv_mul.R")
```
```{r}
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
## Bivariate
dta_l<-dta|>
dplyr::select(all_of(c("active_treat",vars,outs[i])))
sel<-dta_l|>
sapply(is.factor)
# i=1
biv<-dta_l|>
tbl_uvregression(data=_,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel]
) |>
add_global_p()|>
bold_p() |>
bold_labels() |>
italicize_levels()
## What follows is the pragmatic transformation and reformatting
## Transforming log2() to 2^()
# biv$table_body$estimate<-expm1(biv$table_body$estimate)
# biv$table_body$conf.low<-expm1(biv$table_body$conf.low)
# biv$table_body$conf.high<-expm1(biv$table_body$conf.high)
#
# ## Transforming sqrt(pase_0) to pase_0^2
# biv$table_body$estimate[biv$table_body$variable=="pase_0"]<-
# biv$table_body$estimate[biv$table_body$variable=="pase_0"]^2
#
# low<-biv$table_body$conf.low[biv$table_body$variable=="pase_0"]^2
# high<-biv$table_body$conf.high[biv$table_body$variable=="pase_0"]^2
#
# biv$table_body$conf.low[biv$table_body$variable=="pase_0"]<-high
# biv$table_body$conf.high[biv$table_body$variable=="pase_0"]<-low
#
# ## New confidence intervals
# # biv$table_body$estimate<-format(biv$table_body$estimate, drop0trailing = F,digits =2)
# biv$table_body$ci<-paste(formatC(biv$table_body$conf.low, digits = 3, format = "f"),
# formatC(biv$table_body$conf.high, digits = 3, format = "f"),
# sep=", ")
# biv$table_body$ci<-paste(format(biv$table_body$conf.low, digits = 2, drop0trailing = FALSE),
# format(biv$table_body$conf.high, digits = 2, drop0trailing = FALSE),
# sep=", ")
# Formatting from this: https://stackoverflow.com/questions/12243071/r-keeping-0-0-when-using-paste-or-paste0
## multivariate
mul<-dta_l |>
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = _) |>
tbl_regression(label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel]
)|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels()
## Merge
biv_mul<-tbl_merge(
tbls = list(biv, mul),
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
bm_list[[i]]<-biv_mul
}
## =============================================================================
## Big merge
## =============================================================================
bm_16_tbl<-tbl_merge(
tbls = bm_list,
tab_spanner = c("**One month follow up**",
"**Six months follow up**")
)
bm_16_tbl
```
```{r}
bm_16_tbl_rtf <- file("bm_16_tbl_trans.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_trans.png"
)
```
## Tests and visualisation
Box-Cox power transformation performs comparably to logarithmic transformation. The latter is much easier to explain.
```{r}
library(MASS)
dta_bc<-dta_backup|>
dplyr::select(all_of(c("mdi_6_newobs_enr",vars)))|>
mutate(pase_0=sqrt(pase_0),
mdi_6_newobs_enr=mdi_6_newobs_enr+1)#|>
# na.omit()
bc<-boxcox(mdi_6_newobs_enr~.,data=dta_bc)
lambda <- bc$x[which.max(bc$y)]
```
Q-Q plots to compare the two different approaches, and the non-transformed
```{r}
qqnorm(lm(((mdi_6_newobs_enr^lambda-1)/lambda) ~ .,data=dta_bc)$residuals)
qqnorm(lm(log(mdi_6_newobs_enr) ~ .,data=dta_bc)$residuals)
```
Histograms for reference
```{r}
hist(dta$pase_0,40); hist(sqrt(dta$pase_0),40)
```
```{r}
hist(expm1(dta$mdi_6_newobs_enr),40); hist((dta$mdi_6_newobs_enr),40) ## Observed MDI, and log transformed MDI
```

View File

@ -0,0 +1,33 @@
# Regression - sensitivity
outs<-c("mdi_1","mdi_6")
## Non-stratified
source("biv_mul.R")
bm_16_sens_tbl_rtf <- file("bm_16_sens_tbl.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_sens_tbl_rtf)
close(bm_16_sens_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_sens.png"
)
source("biv_mul_strat.R")
bm_16_tbl_strat_sens_rtf <- file("bm_16_tbl_strat_sens.RTF", "w")
writeLines(bm_16_tbl_strat%>%as_gt()%>%as_rtf(), bm_16_tbl_strat_sens_rtf)
close(bm_16_tbl_strat_sens_rtf)
bm_16_tbl_strat %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_strat_sens.png"
)

View File

@ -0,0 +1,34 @@
outs<-c("mdi_1_enr","mdi_6_newobs_enr")
## Non-stratified
source("biv_mul.R")
bm_16_tbl_rtf <- file("bm_16_tbl.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl.png"
)
## Stratified by treatment
source("biv_mul_strat.R")
bm_16_tbl_strat_rtf <- file("bm_16_tbl_strat.RTF", "w")
writeLines(bm_16_tbl_strat%>%as_gt()%>%as_rtf(), bm_16_tbl_strat_rtf)
close(bm_16_tbl_strat_rtf)
bm_16_tbl_strat %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_strat.png"
)

View File

@ -0,0 +1,139 @@
## =============================================================================
## Header
## =============================================================================
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
source("function_back_trans.R")
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
## Bivariate
dta_l<-dta|>
dplyr::select(all_of(c("active_treat",vars,outs[i])))
sel<-dta_l|>
sapply(is.factor)
# i=1
biv<-dta_l|>
tbl_uvregression(data=_,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
) |>
add_global_p()|>
bold_p() #|>
# bold_labels() |>
# italicize_levels()
# ## What follows is the pragmatic transformation and reformatting
#
# ## Transforming log1p() to expm1()
# biv$table_body$estimate<-expm1(biv$table_body$estimate)
# biv$table_body$conf.low<-expm1(biv$table_body$conf.low)
# biv$table_body$conf.high<-expm1(biv$table_body$conf.high)
#
# ## Transforming sqrt() to pase_0^2
# biv$table_body$estimate[biv$table_body$variable=="pase_0"]<-
# -biv$table_body$estimate[biv$table_body$variable=="pase_0"]^2
#
# low<-biv$table_body$conf.low[biv$table_body$variable=="pase_0"]^2
# high<-biv$table_body$conf.high[biv$table_body$variable=="pase_0"]^2
#
# biv$table_body$conf.low[biv$table_body$variable=="pase_0"]<-(-low)
# biv$table_body$conf.high[biv$table_body$variable=="pase_0"]<-(-high)
#
# ## Transforming log1p() to expm1()
# biv$table_body$estimate[biv$table_body$variable=="nihss_0"]<-
# expm1(biv$table_body$estimate[biv$table_body$variable=="nihss_0"])
#
# low<-expm1(biv$table_body$conf.low[biv$table_body$variable=="nihss_0"])
# high<-expm1(biv$table_body$conf.high[biv$table_body$variable=="nihss_0"])
#
# biv$table_body$conf.low[biv$table_body$variable=="nihss_0"]<-low
# biv$table_body$conf.high[biv$table_body$variable=="nihss_0"]<-high
#
# ## New confidence intervals
# # biv$table_body$estimate<-format(biv$table_body$estimate, drop0trailing = F,digits =2)
# biv$table_body$ci<-paste(formatC(biv$table_body$conf.low, digits = 3, format = "f"),
# formatC(biv$table_body$conf.high, digits = 3, format = "f"),
# sep=", ")
## multivariate
mul<-dta_l |>
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = _) |>
tbl_regression(label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
)|>
add_n() |>
add_global_p() |>
bold_p() #|>
# bold_labels() |>
# italicize_levels()
if (trans_back==TRUE){
ls<-lapply(list(biv,mul), back_trans, outm = "log1p" ,sqrts = "pase_0",log1ps = "nihss_0")
} else {ls<-list(biv,mul)}
## Merge
biv_mul<-tbl_merge(
tbls = ls,
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
bm_list[[i]]<-biv_mul
}
## =============================================================================
## Big merge
## =============================================================================
if (trans_back==TRUE){tab_span<-c("**One month follow up [TRANS t/r]**",
"**Six months follow up [TRANS t/r]**")
} else {tab_span<-c("**One month follow up**",
"**Six months follow up**")}
bm_16_tbl<-tbl_merge(
tbls = bm_list,
tab_spanner = tab_span
)
bm_16_tbl
fnm<-"bm_16_tbl"
if (trans_vars==TRUE){fnm<-paste0(fnm,"_trans")}
if (trans_back==TRUE){fnm<-paste0(fnm,"_back")}
bm_16_tbl_rtf <- file(paste0(fnm,".RTF"), "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = paste0(fnm,".png")
)

View File

@ -0,0 +1,169 @@
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
source("function_back_trans.R")
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
## Bivariate
dta_l<-dta|>
dplyr::select(all_of(c("active_treat",vars,outs[i])))
sel<-dta_l|>
sapply(is.factor)
# i=1
biv<-dta_l|>
tbl_uvregression(data=_,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
) |>
add_global_p()|>
bold_p() #|>
# bold_labels() |>
# italicize_levels()
# ## What follows is the pragmatic transformation and reformatting
#
# ## Transforming log1p() to expm1()
# biv$table_body$estimate<-expm1(biv$table_body$estimate)
# biv$table_body$conf.low<-expm1(biv$table_body$conf.low)
# biv$table_body$conf.high<-expm1(biv$table_body$conf.high)
#
# ## Transforming sqrt() to pase_0^2
# biv$table_body$estimate[biv$table_body$variable=="pase_0"]<-
# -biv$table_body$estimate[biv$table_body$variable=="pase_0"]^2
#
# low<-biv$table_body$conf.low[biv$table_body$variable=="pase_0"]^2
# high<-biv$table_body$conf.high[biv$table_body$variable=="pase_0"]^2
#
# biv$table_body$conf.low[biv$table_body$variable=="pase_0"]<-(-low)
# biv$table_body$conf.high[biv$table_body$variable=="pase_0"]<-(-high)
#
# ## Transforming log1p() to expm1()
# biv$table_body$estimate[biv$table_body$variable=="nihss_0"]<-
# expm1(biv$table_body$estimate[biv$table_body$variable=="nihss_0"])
#
# low<-expm1(biv$table_body$conf.low[biv$table_body$variable=="nihss_0"])
# high<-expm1(biv$table_body$conf.high[biv$table_body$variable=="nihss_0"])
#
# biv$table_body$conf.low[biv$table_body$variable=="nihss_0"]<-low
# biv$table_body$conf.high[biv$table_body$variable=="nihss_0"]<-high
#
# ## New confidence intervals
# # biv$table_body$estimate<-format(biv$table_body$estimate, drop0trailing = F,digits =2)
# biv$table_body$ci<-paste(formatC(biv$table_body$conf.low, digits = 3, format = "f"),
# formatC(biv$table_body$conf.high, digits = 3, format = "f"),
# sep=", ")
## multivariate
mul<-dta_l |>
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = _) |>
tbl_regression(label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
)|>
add_n() |>
add_global_p() |>
bold_p() #|>
# bold_labels() |>
# italicize_levels()
if (trans_back==TRUE){
ls<-lapply(list(biv,mul), back_trans, outm = "log1p" ,sqrts = "pase_0",log1ps = "nihss_0")
} else {ls<-list(biv,mul)}
## Merge
biv_mul<-tbl_merge(
tbls = ls,
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
bm_list[[i]]<-biv_mul
}
## =============================================================================
## Big merge
## =============================================================================
if (trans_back==TRUE){tab_span<-c("**One month follow up [TRANS t/r]**",
"**Six months follow up [TRANS t/r]**")
} else {tab_span<-c("**One month follow up**",
"**Six months follow up**")}
bm_16_tbl<-tbl_merge(
tbls = bm_list,
tab_spanner = c("**One month follow up**",
"**Six months follow up**")
)
bm_16_tbl
bm_16_tbl_rtf <- file("bm_16_tbl_trans_back.RTF", "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
bm_16_tbl %>% # build gtsummary table
as_gt() %>% # convert to gt table
gt::gtsave( # save table as image
filename = "bm_16_tbl_trans_back.png"
)
## Tests and visualisation
## Box-Cox power transformation performs comparably to logarithmic transformation. The latter is much easier to explain.
library(MASS)
dta_bc<-dta_backup|>
dplyr::select(all_of(c("mdi_6_newobs_enr",vars)))|>
mutate(pase_0=sqrt(pase_0),
mdi_6_newobs_enr=mdi_6_newobs_enr+1)#|>
# na.omit()
bc<-boxcox(mdi_6_newobs_enr~.,data=dta_bc)
lambda <- bc$x[which.max(bc$y)]
## Q-Q plots to compare the two different approaches, and the non-transformed
q1 <- qqnorm(lm(((mdi_6_newobs_enr^lambda-1)/lambda) ~ .,data=dta_bc)$residuals)
q2 <- qqnorm(lm(log(mdi_6_newobs_enr) ~ .,data=dta_bc)$residuals)
library(patchwork)
plot(q1); plot(q2)
## Histograms for reference
h1 <- hist(dta$pase_0,40); hist(sqrt(dta$pase_0),40)
h2 <- hist(expm1(dta$mdi_6_newobs_enr),40); hist((dta$mdi_6_newobs_enr),40) ## Observed MDI, and log transformed MDI
plot(h1); plot(h2)

146
biv_mul.R Normal file
View File

@ -0,0 +1,146 @@
## =============================================================================
## Requirements
## =============================================================================
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
library(gtsummary)
source("function_back_trans.R")
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
dta_l<-dta|>
dplyr::select(all_of(c("active_treat",vars,outs[i]))) # active_treat should be vector
sel<-dta_l|>
sapply(is.factor)
## Bivariate
if (!is.null(strat_var)){biv<-dta_l |>
tbl_strata(
strata = all_of(strat_var),
.tbl_fun =
~ .x %>%
tbl_uvregression(data=.,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel][-1], # excluding the first, active-treatment, as this is strat
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
)|>
add_global_p()|>
bold_p() |>
bold_labels() |>
italicize_levels(),
.header = "**{strata}**, N = {n}"
)
} else {
biv<-dta_l|>
tbl_uvregression(data=_,
y=outs[i],
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
) |>
add_global_p()|>
bold_p()
}
## Multivariate
if (!is.null(strat_var)){
mul<-dta_l |>
tbl_strata(
strata = all_of(strat_var),
.tbl_fun =
~ .x %>%
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = .) |>
tbl_regression(label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel][-1], # excluding the first, active-treatment, as this is strat
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
)|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels(),
.header = "**{strata}**, N = {n}"
)
} else {
mul<-dta_l |>
lm(formula(paste(c(outs[i],"."),collapse="~")),
data = _) |>
tbl_regression(label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
)|>
add_n() |>
add_global_p() |>
bold_p()
}
# Back transforming if flag set
if (trans_back==TRUE){
ls<-lapply(list(biv,mul), back_trans, outm = "log1p" ,sqrts = "pase_0",log1ps = "nihss_0")
} else {ls<-list(biv,mul)}
## Merge
biv_mul<-tbl_merge(
tbls = ls,
tab_spanner = c("**Bivariate linear regression**",
"**Multivariate linear regression**")
)
bm_list[[i]]<-biv_mul
}
## =============================================================================
## Big merge
## =============================================================================
# Header if back transformed
if (trans_back==TRUE){tab_span<-c("**One month follow up [TRANS t/r]**",
"**Six months follow up [TRANS t/r]**")
} else {tab_span<-c("**One month follow up**",
"**Six months follow up**")}
bm_16_tbl<-tbl_merge(
tbls = bm_list,
tab_spanner = tab_span
)
## =============================================================================
## Print
## =============================================================================
# File name depending onstratification, transformation and back transformation
if (print_tbl==TRUE){
fnm<-paste0("bm_16_tbl",lbl_x)
if (!is.null(strat_var)){fnm<-paste0(fnm,"_strat")}
if (trans_vars==TRUE){fnm<-paste0(fnm,"_trans")}
if (trans_back==TRUE){fnm<-paste0(fnm,"_back")}
bm_16_tbl_rtf <- file(paste0(fnm,".RTF"), "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
}

115
biv_mul_man.R Normal file
View File

@ -0,0 +1,115 @@
##
## NOTES
##
## Leaving gtsummary as this is slow and a little inflexible.
##
## =============================================================================
## Requirements
## =============================================================================
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
library(gtsummary)
source("function_back_trans.R")
vars_all<-c("active_treat",vars)
## =============================================================================
## Loop
## =============================================================================
dec <- 3
bm_list<-list()
if (biv_mul){
do_biv=TRUE
do_mul=TRUE
} else {
do_biv=FALSE
do_mul=TRUE
}
for (i in 1:length(outs)){
if (!is.null(strat_var)){
ls<-split(dta,dta[strat_var])
strat_list<-list()
for (j in 1:length(ls)){
X<-ls[[i]][,vars]
y <- ls[[i]][,outs[i]]
# Flagging factors and continous variables
#
sel_f<-X|>
sapply(is.factor)
f.names <- colnames(X)[sel_f]
source("function_reg_table.R")
rt<-reg_table(X,y,m.biv=do_biv,m.mul=do_mul,trans.var = trans_vars,sqrt.vars=sqrt_vars,inter.add=inter_reg)
rt<-rt|>mutate(across(matches('co|lo|hi|pv'),as.numeric))
rt[,grepl('co|lo|hi|pv',names(rt))] <- sapply( round( rt[,grepl('co|lo|hi|pv',names(rt))], 3 ),formatC, format='f', digits=3 )
strat_list[[j]] <- rt
names(strat_list)[j] <- levels(dta[,strat_var])[j]
}
bm_list[[i]] <- cbind(names(strat_list)[1],strat_list[[1]],names(strat_list)[2],strat_list[[2]])
names(bm_list)[i] <- outs[i]
} else {
X<-dta[,vars_all]
y <- dta[,outs[i]]
# Flagging factors and continous variables
#
sel_f<-X|>
sapply(is.factor)
f.names <- colnames(X)[sel_f]
source("function_reg_table.R")
rt<-reg_table(X,y,m.biv=do_biv,m.mul=do_mul,trans.var = trans_vars,sqrt.vars=sqrt_vars,inter.add=inter_reg)
rt<-rt|>mutate(across(matches('co|lo|hi|pv'),as.numeric))
rt[,grepl('co|lo|hi|pv',names(rt))] <- sapply( round( rt[,grepl('co|lo|hi|pv',names(rt))], 3 ),formatC, format='f', digits=3 )
bm_list[[i]] <- rt
names(bm_list)[i] <- outs[i]
}
}
## =============================================================================
## Print
## =============================================================================
# File name depending onstratification, transformation and back transformation
if (print_tbl==TRUE){
fnm<-paste0("bm_16_tbl",lbl_x)
if (!is.null(strat_var)){fnm<-paste0(fnm,"_strat")}
if (trans_vars==TRUE){fnm<-paste0(fnm,"_trans")}
# if (trans_back==TRUE){fnm<-paste0(fnm,"_back")}
export<-data.frame()
for (i in 1:length(bm_list)){
export<-rbind(export,paste(names(bm_list)[i]),bm_list[[i]])
}
write.csv(export,paste0(fnm,".csv"))
}

33
bm_16_tbl_inter_trans.csv Normal file
View File

@ -0,0 +1,33 @@
"","name","pred","co","lo","hi","pv","co.p","lo.p","hi.p"
"1","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr"
"2","active_treat","active_treat.yes","0.233653892072177","-0.232179668891965","0.699487453036319","0.324864859797705","0.263207210508771","-0.207196331646934","1.01272082910031"
"3","pase_0","pase_0","-0.000244585430319758","-0.00187082402407513","0.000143390295747283","0.266354042432291","-0.000244585430319758","-0.00187082402407513","0.000143390295747283"
"4","female","female.yes","0.180213913459648","0.0193236851124511","0.341104141806845","0.0282148782420233","0.197473491423575","0.0195115959405863","0.406499708656313"
"5","age","age","-0.00615699034671417","-0.0125459725709187","0.000231991877490371","0.0588843723328414","-0.00615699034671417","-0.0125459725709187","0.000231991877490371"
"6","cohab","cohab.yes","0.0385997993494245","-0.121911617887899","0.199111216586748","0.636788296013232","0.0393544500801572","-0.114773396757817","0.220317677919905"
"7","ever_smoker","ever_smoker.yes","-0.130804728095057","-0.288167087752173","0.0265576315620582","0.103067585262741","-0.122610912897366","-0.250363673274614","0.026913428181286"
"8","diabetes","diabetes.yes","0.218436741940986","-0.0112594513032668","0.448132935185239","0.0622889336689862","0.244130312869116","-0.011196300916562","0.565386776803707"
"9","hypertension","hypertension.yes","0.0616393238146578","-0.0909735343341647","0.21425218196348","0.427835234030472","0.0635786680438701","-0.0869581251593398","0.238935052475424"
"10","afli","afli.yes","-0.151678986134109","-0.353288078026529","0.0499301057583107","0.139996958070073","-0.140735927846055","-0.297625174523839","0.0511976211477106"
"11","ami","ami.yes","0.175218683806947","-0.105335118835802","0.455772486449696","0.220374098717126","0.191506751356345","-0.0999771425699263","0.577391426015035"
"12","tci","tci.yes","0.0747157782985039","-0.365670936717259","0.515102493314267","0.7390186199739","0.0775778363499326","-0.306268954930611","0.673810047345449"
"13","pad","pad.yes","0.150056760624913","-0.237311562420527","0.537425083670353","0.446960209143568","0.161900191037562","-0.211254493727694","0.711593971943397"
"14","nihss_0","nihss_0","0.11613724835806","0.00897236714493893","0.22330212957118","0.0337248669412898","0.11613724835806","0.00897236714493893","0.22330212957118"
"15","any_reperf","any_reperf.yes","-0.0107151021515006","-0.172236649696012","0.150806445393011","0.89635092823517","-0.0106578999359388","-0.158220057372026","0.162771576504227"
"16","active_treat*pase_0+","active_treat*pase_0+","-0.0110727809082654","-0.0493422786913023","0.0271967168747716","0.569968244427194","-0.0110727809082654","-0.0493422786913023","0.0271967168747716"
"17","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr"
"18","active_treat","active_treat.yes","-0.0564200982921334","-0.623930308211759","0.511090111627492","0.845187999796114","-0.0548580000618283","-0.464165700383232","0.667107538069166"
"19","pase_0","pase_0","-0.000976681489563953","-0.00407660143217371","1.80757612451662e-06","0.0601839260699098","-0.000976681489563953","-0.00407660143217371","1.80757612451662e-06"
"20","female","female.yes","0.263835454377699","0.0758881335002106","0.451782775255187","0.00603737741261064","0.301913954433282","0.0788418811415876","0.571110627402178"
"21","age","age","-0.00707604184801931","-0.0145258759726912","0.000373792276652601","0.0626020368466464","-0.00707604184801931","-0.0145258759726912","0.000373792276652601"
"22","cohab","cohab.yes","-0.00811615427982147","-0.197824514236291","0.181592205676648","0.933033500656618","-0.0080833072236699","-0.17948617099948","0.199125097753481"
"23","ever_smoker","ever_smoker.yes","-0.000519117102016271","-0.18339011388276","0.182351879678728","0.995551387820496","-0.000518982384045944","-0.167556655320812","0.20003638801342"
"24","diabetes","diabetes.yes","-0.0169576554876117","-0.299400688593834","0.26548537761861","0.906128811311326","-0.0168146837437277","-0.258737665440769","0.304063785564845"
"25","hypertension","hypertension.yes","0.0997346056783598","-0.0787083358306297","0.278177547187349","0.27262085505285","0.10487765090699","-0.0756905269109551","0.32072066663342"
"26","afli","afli.yes","-0.0627807759073845","-0.300670509163122","0.175108957348353","0.604272406167713","-0.0608506647157438","-0.259678338231203","0.191376018712674"
"27","ami","ami.yes","0.303152924706539","-0.032166810710295","0.638472660123374","0.0762901279157927","0.354121527246548","-0.0316549617176921","0.893586519331088"
"28","tci","tci.yes","-0.695532964813223","-1.21149930597945","-0.179566623646997","0.00835099528356764","-0.501191470265989","-0.70224947454008","-0.164367723781238"
"29","pad","pad.yes","0.303632413594264","-0.155473443332633","0.762738270521161","0.194364922678559","0.354770969159139","-0.14399019060515","1.14413942309133"
"30","nihss_0","nihss_0","0.133424171870123","0.00625404713700828","0.260594296603237","0.0397906254749111","0.133424171870123","0.00625404713700828","0.260594296603237"
"31","any_reperf","any_reperf.yes","-0.0346496766887493","-0.222751967579255","0.153452614201757","0.717519225149966","-0.0340562503960797","-0.199686671668901","0.165852540959894"
"32","active_treat*pase_0+","active_treat*pase_0+","-0.0010263702467695","-0.0474599310905048","0.0454071905969658","0.965370876353512","-0.0010263702467695","-0.0474599310905048","0.0454071905969658"
1 name pred co lo hi pv co.p lo.p hi.p
2 1 mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr
3 2 active_treat active_treat.yes 0.233653892072177 -0.232179668891965 0.699487453036319 0.324864859797705 0.263207210508771 -0.207196331646934 1.01272082910031
4 3 pase_0 pase_0 -0.000244585430319758 -0.00187082402407513 0.000143390295747283 0.266354042432291 -0.000244585430319758 -0.00187082402407513 0.000143390295747283
5 4 female female.yes 0.180213913459648 0.0193236851124511 0.341104141806845 0.0282148782420233 0.197473491423575 0.0195115959405863 0.406499708656313
6 5 age age -0.00615699034671417 -0.0125459725709187 0.000231991877490371 0.0588843723328414 -0.00615699034671417 -0.0125459725709187 0.000231991877490371
7 6 cohab cohab.yes 0.0385997993494245 -0.121911617887899 0.199111216586748 0.636788296013232 0.0393544500801572 -0.114773396757817 0.220317677919905
8 7 ever_smoker ever_smoker.yes -0.130804728095057 -0.288167087752173 0.0265576315620582 0.103067585262741 -0.122610912897366 -0.250363673274614 0.026913428181286
9 8 diabetes diabetes.yes 0.218436741940986 -0.0112594513032668 0.448132935185239 0.0622889336689862 0.244130312869116 -0.011196300916562 0.565386776803707
10 9 hypertension hypertension.yes 0.0616393238146578 -0.0909735343341647 0.21425218196348 0.427835234030472 0.0635786680438701 -0.0869581251593398 0.238935052475424
11 10 afli afli.yes -0.151678986134109 -0.353288078026529 0.0499301057583107 0.139996958070073 -0.140735927846055 -0.297625174523839 0.0511976211477106
12 11 ami ami.yes 0.175218683806947 -0.105335118835802 0.455772486449696 0.220374098717126 0.191506751356345 -0.0999771425699263 0.577391426015035
13 12 tci tci.yes 0.0747157782985039 -0.365670936717259 0.515102493314267 0.7390186199739 0.0775778363499326 -0.306268954930611 0.673810047345449
14 13 pad pad.yes 0.150056760624913 -0.237311562420527 0.537425083670353 0.446960209143568 0.161900191037562 -0.211254493727694 0.711593971943397
15 14 nihss_0 nihss_0 0.11613724835806 0.00897236714493893 0.22330212957118 0.0337248669412898 0.11613724835806 0.00897236714493893 0.22330212957118
16 15 any_reperf any_reperf.yes -0.0107151021515006 -0.172236649696012 0.150806445393011 0.89635092823517 -0.0106578999359388 -0.158220057372026 0.162771576504227
17 16 active_treat*pase_0+ active_treat*pase_0+ -0.0110727809082654 -0.0493422786913023 0.0271967168747716 0.569968244427194 -0.0110727809082654 -0.0493422786913023 0.0271967168747716
18 17 mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr
19 18 active_treat active_treat.yes -0.0564200982921334 -0.623930308211759 0.511090111627492 0.845187999796114 -0.0548580000618283 -0.464165700383232 0.667107538069166
20 19 pase_0 pase_0 -0.000976681489563953 -0.00407660143217371 1.80757612451662e-06 0.0601839260699098 -0.000976681489563953 -0.00407660143217371 1.80757612451662e-06
21 20 female female.yes 0.263835454377699 0.0758881335002106 0.451782775255187 0.00603737741261064 0.301913954433282 0.0788418811415876 0.571110627402178
22 21 age age -0.00707604184801931 -0.0145258759726912 0.000373792276652601 0.0626020368466464 -0.00707604184801931 -0.0145258759726912 0.000373792276652601
23 22 cohab cohab.yes -0.00811615427982147 -0.197824514236291 0.181592205676648 0.933033500656618 -0.0080833072236699 -0.17948617099948 0.199125097753481
24 23 ever_smoker ever_smoker.yes -0.000519117102016271 -0.18339011388276 0.182351879678728 0.995551387820496 -0.000518982384045944 -0.167556655320812 0.20003638801342
25 24 diabetes diabetes.yes -0.0169576554876117 -0.299400688593834 0.26548537761861 0.906128811311326 -0.0168146837437277 -0.258737665440769 0.304063785564845
26 25 hypertension hypertension.yes 0.0997346056783598 -0.0787083358306297 0.278177547187349 0.27262085505285 0.10487765090699 -0.0756905269109551 0.32072066663342
27 26 afli afli.yes -0.0627807759073845 -0.300670509163122 0.175108957348353 0.604272406167713 -0.0608506647157438 -0.259678338231203 0.191376018712674
28 27 ami ami.yes 0.303152924706539 -0.032166810710295 0.638472660123374 0.0762901279157927 0.354121527246548 -0.0316549617176921 0.893586519331088
29 28 tci tci.yes -0.695532964813223 -1.21149930597945 -0.179566623646997 0.00835099528356764 -0.501191470265989 -0.70224947454008 -0.164367723781238
30 29 pad pad.yes 0.303632413594264 -0.155473443332633 0.762738270521161 0.194364922678559 0.354770969159139 -0.14399019060515 1.14413942309133
31 30 nihss_0 nihss_0 0.133424171870123 0.00625404713700828 0.260594296603237 0.0397906254749111 0.133424171870123 0.00625404713700828 0.260594296603237
32 31 any_reperf any_reperf.yes -0.0346496766887493 -0.222751967579255 0.153452614201757 0.717519225149966 -0.0340562503960797 -0.199686671668901 0.165852540959894
33 32 active_treat*pase_0+ active_treat*pase_0+ -0.0010263702467695 -0.0474599310905048 0.0454071905969658 0.965370876353512 -0.0010263702467695 -0.0474599310905048 0.0454071905969658

View File

@ -0,0 +1,14 @@
"","name","pred","co","lo","hi","pv","co.p","lo.p","hi.p"
"1","nihss_0","nihss_0","nihss_0","nihss_0","nihss_0","nihss_0","nihss_0","nihss_0","nihss_0"
"2","active_treat","active_treat.yes","0.002","-0.119","0.123","0.975","0.002","-0.112","0.130"
"3","pase_0","pase_0","-0.000","-0.001","0.000","0.067","-0.000","-0.001","0.000"
"4","female","female.yes","0.086","-0.050","0.222","0.213","0.090","-0.049","0.249"
"5","age","age","0.004","-0.001","0.010","0.127","0.004","-0.001","0.010"
"6","cohab","cohab.yes","0.085","-0.049","0.220","0.215","0.089","-0.048","0.246"
"7","ever_smoker","ever_smoker.yes","0.008","-0.124","0.140","0.908","0.008","-0.117","0.150"
"8","diabetes","diabetes.yes","-0.000","-0.192","0.192","0.999","-0.000","-0.174","0.211"
"9","hypertension","hypertension.yes","-0.149","-0.275","-0.022","0.021","-0.138","-0.240","-0.022"
"10","afli","afli.yes","0.229","0.063","0.395","0.007","0.258","0.065","0.485"
"11","ami","ami.yes","0.034","-0.195","0.263","0.771","0.035","-0.177","0.301"
"12","tci","tci.yes","-0.170","-0.535","0.195","0.361","-0.156","-0.414","0.216"
"13","pad","pad.yes","-0.273","-0.608","0.062","0.110","-0.239","-0.455","0.063"
1 name pred co lo hi pv co.p lo.p hi.p
2 1 nihss_0 nihss_0 nihss_0 nihss_0 nihss_0 nihss_0 nihss_0 nihss_0 nihss_0
3 2 active_treat active_treat.yes 0.002 -0.119 0.123 0.975 0.002 -0.112 0.130
4 3 pase_0 pase_0 -0.000 -0.001 0.000 0.067 -0.000 -0.001 0.000
5 4 female female.yes 0.086 -0.050 0.222 0.213 0.090 -0.049 0.249
6 5 age age 0.004 -0.001 0.010 0.127 0.004 -0.001 0.010
7 6 cohab cohab.yes 0.085 -0.049 0.220 0.215 0.089 -0.048 0.246
8 7 ever_smoker ever_smoker.yes 0.008 -0.124 0.140 0.908 0.008 -0.117 0.150
9 8 diabetes diabetes.yes -0.000 -0.192 0.192 0.999 -0.000 -0.174 0.211
10 9 hypertension hypertension.yes -0.149 -0.275 -0.022 0.021 -0.138 -0.240 -0.022
11 10 afli afli.yes 0.229 0.063 0.395 0.007 0.258 0.065 0.485
12 11 ami ami.yes 0.034 -0.195 0.263 0.771 0.035 -0.177 0.301
13 12 tci tci.yes -0.170 -0.535 0.195 0.361 -0.156 -0.414 0.216
14 13 pad pad.yes -0.273 -0.608 0.062 0.110 -0.239 -0.455 0.063

View File

@ -0,0 +1,31 @@
"","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p"
"1","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month"
"2","active_treat.yes","0.066","-0.077","0.209","0.367","0.068","-0.074","0.232","0.122","-0.022","0.266","0.096","0.13","-0.022","0.305"
"3","afli.yes","-0.159","-0.356","0.037","0.112","-0.147","-0.299","0.038","-0.135","-0.337","0.066","0.188","-0.127","-0.286","0.069"
"4","age","-0.002","-0.007","0.004","0.575","-0.002","-0.007","0.004","-0.006","-0.012","0.001","0.073","-0.006","-0.012","0.001"
"5","ami.yes","0.143","-0.116","0.402","0.28","0.153","-0.11","0.494","0.166","-0.116","0.447","0.248","0.18","-0.11","0.564"
"6","any_reperf.yes","-0.004","-0.151","0.144","0.961","-0.004","-0.141","0.155","-0.024","-0.185","0.138","0.773","-0.023","-0.169","0.147"
"7","cohab.yes","0.018","-0.132","0.168","0.814","0.018","-0.124","0.183","0.033","-0.127","0.193","0.687","0.033","-0.12","0.213"
"8","diabetes.yes","0.142","-0.083","0.367","0.215","0.153","-0.08","0.444","0.196","-0.036","0.427","0.098","0.216","-0.036","0.533"
"9","ever_smoker.yes","-0.093","-0.245","0.059","0.23","-0.089","-0.218","0.061","-0.136","-0.294","0.021","0.09","-0.127","-0.255","0.022"
"10","female.yes","0.139","-0.011","0.289","0.07","0.149","-0.011","0.335","0.186","0.025","0.347","0.024","0.204","0.025","0.414"
"11","hypertension.yes","0.146","0.003","0.288","0.045","0.157","0.003","0.334","0.071","-0.082","0.223","0.361","0.073","-0.078","0.25"
"12","nihss_0","0.069","-0.031","0.169","0.178","0.069","-0.031","0.169","0.09","-0.018","0.198","0.101","0.09","-0.018","0.198"
"13","pad.yes","0.16","-0.195","0.515","0.376","0.173","-0.177","0.674","0.166","-0.219","0.551","0.398","0.18","-0.197","0.735"
"14","pase_0","-0.001","-0.002","0","0.013","-0.001","-0.002","0","0","-0.002","0","0.105","0","-0.002","0"
"15","tci.yes","0.159","-0.291","0.608","0.489","0.172","-0.253","0.837","0.102","-0.336","0.54","0.647","0.107","-0.285","0.715"
"16","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month"
"17","active_treat.yes","-0.081","-0.246","0.083","0.331","-0.078","-0.218","0.087","-0.054","-0.223","0.114","0.528","-0.053","-0.2","0.121"
"18","afli.yes","-0.042","-0.273","0.189","0.719","-0.041","-0.239","0.208","-0.077","-0.317","0.162","0.526","-0.074","-0.271","0.176"
"19","age","0.001","-0.005","0.008","0.744","0.001","-0.005","0.008","-0.007","-0.014","0.001","0.069","-0.007","-0.014","0.001"
"20","ami.yes","0.156","-0.15","0.463","0.317","0.169","-0.14","0.589","0.312","-0.021","0.645","0.066","0.366","-0.021","0.905"
"21","any_reperf.yes","-0.011","-0.181","0.158","0.896","-0.011","-0.165","0.171","-0.021","-0.209","0.166","0.823","-0.021","-0.188","0.181"
"22","cohab.yes","-0.108","-0.282","0.066","0.221","-0.103","-0.246","0.068","-0.047","-0.236","0.143","0.629","-0.045","-0.21","0.154"
"23","diabetes.yes","-0.021","-0.296","0.253","0.879","-0.021","-0.256","0.288","-0.068","-0.353","0.217","0.641","-0.066","-0.298","0.243"
"24","ever_smoker.yes","-0.033","-0.209","0.143","0.714","-0.032","-0.188","0.154","-0.008","-0.191","0.174","0.927","-0.008","-0.174","0.19"
"25","female.yes","0.252","0.081","0.423","0.004","0.287","0.084","0.527","0.25","0.062","0.438","0.009","0.284","0.064","0.549"
"26","hypertension.yes","0.231","0.067","0.396","0.006","0.26","0.07","0.485","0.122","-0.056","0.301","0.177","0.13","-0.054","0.351"
"27","nihss_0","0.13","0.012","0.247","0.031","0.13","0.012","0.247","0.122","-0.005","0.249","0.06","0.122","-0.005","0.249"
"28","pad.yes","0.39","-0.03","0.811","0.069","0.478","-0.03","1.25","0.325","-0.132","0.781","0.163","0.384","-0.123","1.184"
"29","pase_0","-0.001","-0.003","0","0.014","-0.001","-0.003","0","-0.001","-0.003","0","0.047","-0.001","-0.003","0"
"30","tci.yes","-0.637","-1.153","-0.122","0.016","-0.471","-0.684","-0.115","-0.674","-1.186","-0.161","0.01","-0.49","-0.694","-0.149"
1 pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p
2 1 One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month
3 2 active_treat.yes 0.066 -0.077 0.209 0.367 0.068 -0.074 0.232 0.122 -0.022 0.266 0.096 0.13 -0.022 0.305
4 3 afli.yes -0.159 -0.356 0.037 0.112 -0.147 -0.299 0.038 -0.135 -0.337 0.066 0.188 -0.127 -0.286 0.069
5 4 age -0.002 -0.007 0.004 0.575 -0.002 -0.007 0.004 -0.006 -0.012 0.001 0.073 -0.006 -0.012 0.001
6 5 ami.yes 0.143 -0.116 0.402 0.28 0.153 -0.11 0.494 0.166 -0.116 0.447 0.248 0.18 -0.11 0.564
7 6 any_reperf.yes -0.004 -0.151 0.144 0.961 -0.004 -0.141 0.155 -0.024 -0.185 0.138 0.773 -0.023 -0.169 0.147
8 7 cohab.yes 0.018 -0.132 0.168 0.814 0.018 -0.124 0.183 0.033 -0.127 0.193 0.687 0.033 -0.12 0.213
9 8 diabetes.yes 0.142 -0.083 0.367 0.215 0.153 -0.08 0.444 0.196 -0.036 0.427 0.098 0.216 -0.036 0.533
10 9 ever_smoker.yes -0.093 -0.245 0.059 0.23 -0.089 -0.218 0.061 -0.136 -0.294 0.021 0.09 -0.127 -0.255 0.022
11 10 female.yes 0.139 -0.011 0.289 0.07 0.149 -0.011 0.335 0.186 0.025 0.347 0.024 0.204 0.025 0.414
12 11 hypertension.yes 0.146 0.003 0.288 0.045 0.157 0.003 0.334 0.071 -0.082 0.223 0.361 0.073 -0.078 0.25
13 12 nihss_0 0.069 -0.031 0.169 0.178 0.069 -0.031 0.169 0.09 -0.018 0.198 0.101 0.09 -0.018 0.198
14 13 pad.yes 0.16 -0.195 0.515 0.376 0.173 -0.177 0.674 0.166 -0.219 0.551 0.398 0.18 -0.197 0.735
15 14 pase_0 -0.001 -0.002 0 0.013 -0.001 -0.002 0 0 -0.002 0 0.105 0 -0.002 0
16 15 tci.yes 0.159 -0.291 0.608 0.489 0.172 -0.253 0.837 0.102 -0.336 0.54 0.647 0.107 -0.285 0.715
17 16 Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month
18 17 active_treat.yes -0.081 -0.246 0.083 0.331 -0.078 -0.218 0.087 -0.054 -0.223 0.114 0.528 -0.053 -0.2 0.121
19 18 afli.yes -0.042 -0.273 0.189 0.719 -0.041 -0.239 0.208 -0.077 -0.317 0.162 0.526 -0.074 -0.271 0.176
20 19 age 0.001 -0.005 0.008 0.744 0.001 -0.005 0.008 -0.007 -0.014 0.001 0.069 -0.007 -0.014 0.001
21 20 ami.yes 0.156 -0.15 0.463 0.317 0.169 -0.14 0.589 0.312 -0.021 0.645 0.066 0.366 -0.021 0.905
22 21 any_reperf.yes -0.011 -0.181 0.158 0.896 -0.011 -0.165 0.171 -0.021 -0.209 0.166 0.823 -0.021 -0.188 0.181
23 22 cohab.yes -0.108 -0.282 0.066 0.221 -0.103 -0.246 0.068 -0.047 -0.236 0.143 0.629 -0.045 -0.21 0.154
24 23 diabetes.yes -0.021 -0.296 0.253 0.879 -0.021 -0.256 0.288 -0.068 -0.353 0.217 0.641 -0.066 -0.298 0.243
25 24 ever_smoker.yes -0.033 -0.209 0.143 0.714 -0.032 -0.188 0.154 -0.008 -0.191 0.174 0.927 -0.008 -0.174 0.19
26 25 female.yes 0.252 0.081 0.423 0.004 0.287 0.084 0.527 0.25 0.062 0.438 0.009 0.284 0.064 0.549
27 26 hypertension.yes 0.231 0.067 0.396 0.006 0.26 0.07 0.485 0.122 -0.056 0.301 0.177 0.13 -0.054 0.351
28 27 nihss_0 0.13 0.012 0.247 0.031 0.13 0.012 0.247 0.122 -0.005 0.249 0.06 0.122 -0.005 0.249
29 28 pad.yes 0.39 -0.03 0.811 0.069 0.478 -0.03 1.25 0.325 -0.132 0.781 0.163 0.384 -0.123 1.184
30 29 pase_0 -0.001 -0.003 0 0.014 -0.001 -0.003 0 -0.001 -0.003 0 0.047 -0.001 -0.003 0
31 30 tci.yes -0.637 -1.153 -0.122 0.016 -0.471 -0.684 -0.115 -0.674 -1.186 -0.161 0.01 -0.49 -0.694 -0.149

29
bm_16_tbl_strat_trans.csv Normal file
View File

@ -0,0 +1,29 @@
"","names(strat_list)[1]","name","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p","names(strat_list)[2]","name","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p"
"1","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr"
"2","no","pase_0","pase_0","-0.000","-0.002","0.000","0.226","-0.000","-0.002","0.000","-0.000","-0.002","0.000","0.364","-0.000","-0.002","0.000","yes","pase_0","pase_0","-0.000","-0.002","0.000","0.226","-0.000","-0.002","0.000","-0.000","-0.002","0.000","0.364","-0.000","-0.002","0.000"
"3","no","female","female.yes","-0.032","-0.245","0.180","0.765","-0.032","-0.217","0.198","0.025","-0.204","0.255","0.830","0.025","-0.185","0.290","yes","female","female.yes","-0.032","-0.245","0.180","0.765","-0.032","-0.217","0.198","0.025","-0.204","0.255","0.830","0.025","-0.185","0.290"
"4","no","age","age","0.001","-0.007","0.009","0.847","0.001","-0.007","0.009","-0.001","-0.010","0.008","0.768","-0.001","-0.010","0.008","yes","age","age","0.001","-0.007","0.009","0.847","0.001","-0.007","0.009","-0.001","-0.010","0.008","0.768","-0.001","-0.010","0.008"
"5","no","cohab","cohab.yes","-0.028","-0.235","0.180","0.792","-0.027","-0.210","0.197","0.039","-0.188","0.266","0.736","0.040","-0.171","0.304","yes","cohab","cohab.yes","-0.028","-0.235","0.180","0.792","-0.027","-0.210","0.197","0.039","-0.188","0.266","0.736","0.040","-0.171","0.304"
"6","no","ever_smoker","ever_smoker.yes","-0.115","-0.333","0.103","0.301","-0.109","-0.283","0.109","-0.114","-0.341","0.113","0.323","-0.108","-0.289","0.119","yes","ever_smoker","ever_smoker.yes","-0.115","-0.333","0.103","0.301","-0.109","-0.283","0.109","-0.114","-0.341","0.113","0.323","-0.108","-0.289","0.119"
"7","no","diabetes","diabetes.yes","0.125","-0.162","0.412","0.392","0.133","-0.149","0.509","0.176","-0.130","0.482","0.259","0.192","-0.122","0.619","yes","diabetes","diabetes.yes","0.125","-0.162","0.412","0.392","0.133","-0.149","0.509","0.176","-0.130","0.482","0.259","0.192","-0.122","0.619"
"8","no","hypertension","hypertension.yes","0.064","-0.134","0.262","0.525","0.066","-0.126","0.300","-0.054","-0.272","0.164","0.625","-0.053","-0.238","0.178","yes","hypertension","hypertension.yes","0.064","-0.134","0.262","0.525","0.066","-0.126","0.300","-0.054","-0.272","0.164","0.625","-0.053","-0.238","0.178"
"9","no","afli","afli.yes","-0.061","-0.337","0.216","0.665","-0.059","-0.286","0.241","-0.126","-0.418","0.167","0.397","-0.118","-0.342","0.181","yes","afli","afli.yes","-0.061","-0.337","0.216","0.665","-0.059","-0.286","0.241","-0.126","-0.418","0.167","0.397","-0.118","-0.342","0.181"
"10","no","ami","ami.yes","0.230","-0.116","0.575","0.192","0.258","-0.110","0.778","0.348","-0.044","0.741","0.082","0.416","-0.043","1.097","yes","ami","ami.yes","0.230","-0.116","0.575","0.192","0.258","-0.110","0.778","0.348","-0.044","0.741","0.082","0.416","-0.043","1.097"
"11","no","tci","tci.yes","-0.371","-1.065","0.324","0.295","-0.310","-0.655","0.383","-0.356","-1.044","0.332","0.309","-0.300","-0.648","0.393","yes","tci","tci.yes","-0.371","-1.065","0.324","0.295","-0.310","-0.655","0.383","-0.356","-1.044","0.332","0.309","-0.300","-0.648","0.393"
"12","no","pad","pad.yes","0.321","-0.111","0.752","0.145","0.378","-0.105","1.122","0.287","-0.195","0.770","0.241","0.333","-0.177","1.159","yes","pad","pad.yes","0.321","-0.111","0.752","0.145","0.378","-0.105","1.122","0.287","-0.195","0.770","0.241","0.333","-0.177","1.159"
"13","no","nihss_0","nihss_0","0.153","0.010","0.297","0.036","0.153","0.010","0.297","0.238","0.083","0.393","0.003","0.238","0.083","0.393","yes","nihss_0","nihss_0","0.153","0.010","0.297","0.036","0.153","0.010","0.297","0.238","0.083","0.393","0.003","0.238","0.083","0.393"
"14","no","any_reperf","any_reperf.yes","-0.087","-0.289","0.114","0.396","-0.083","-0.251","0.121","-0.194","-0.417","0.029","0.089","-0.176","-0.341","0.030","yes","any_reperf","any_reperf.yes","-0.087","-0.289","0.114","0.396","-0.083","-0.251","0.121","-0.194","-0.417","0.029","0.089","-0.176","-0.341","0.030"
"15","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr"
"16","no","pase_0","pase_0","-0.002","-0.006","-0.000","0.007","-0.002","-0.006","-0.000","-0.002","-0.006","0.000","0.059","-0.002","-0.006","0.000","yes","pase_0","pase_0","-0.002","-0.006","-0.000","0.007","-0.002","-0.006","-0.000","-0.002","-0.006","0.000","0.059","-0.002","-0.006","0.000"
"17","no","female","female.yes","0.305","0.061","0.549","0.015","0.356","0.063","0.731","0.274","0.002","0.546","0.048","0.315","0.002","0.726","yes","female","female.yes","0.305","0.061","0.549","0.015","0.356","0.063","0.731","0.274","0.002","0.546","0.048","0.315","0.002","0.726"
"18","no","age","age","0.000","-0.009","0.009","0.977","0.000","-0.009","0.009","-0.008","-0.019","0.003","0.134","-0.008","-0.019","0.003","yes","age","age","0.000","-0.009","0.009","0.977","0.000","-0.009","0.009","-0.008","-0.019","0.003","0.134","-0.008","-0.019","0.003"
"19","no","cohab","cohab.yes","-0.067","-0.325","0.190","0.607","-0.065","-0.277","0.209","-0.102","-0.381","0.178","0.475","-0.097","-0.317","0.195","yes","cohab","cohab.yes","-0.067","-0.325","0.190","0.607","-0.065","-0.277","0.209","-0.102","-0.381","0.178","0.475","-0.097","-0.317","0.195"
"20","no","ever_smoker","ever_smoker.yes","0.103","-0.145","0.351","0.413","0.109","-0.135","0.420","0.098","-0.163","0.359","0.460","0.103","-0.150","0.432","yes","ever_smoker","ever_smoker.yes","0.103","-0.145","0.351","0.413","0.109","-0.135","0.420","0.098","-0.163","0.359","0.460","0.103","-0.150","0.432"
"21","no","diabetes","diabetes.yes","0.080","-0.339","0.498","0.709","0.083","-0.287","0.645","0.079","-0.343","0.500","0.713","0.082","-0.290","0.649","yes","diabetes","diabetes.yes","0.080","-0.339","0.498","0.709","0.083","-0.287","0.645","0.079","-0.343","0.500","0.713","0.082","-0.290","0.649"
"22","no","hypertension","hypertension.yes","0.285","0.047","0.523","0.019","0.330","0.049","0.686","0.158","-0.103","0.419","0.235","0.171","-0.098","0.520","yes","hypertension","hypertension.yes","0.285","0.047","0.523","0.019","0.330","0.049","0.686","0.158","-0.103","0.419","0.235","0.171","-0.098","0.520"
"23","no","afli","afli.yes","-0.079","-0.404","0.245","0.631","-0.076","-0.332","0.278","-0.076","-0.411","0.259","0.655","-0.073","-0.337","0.296","yes","afli","afli.yes","-0.079","-0.404","0.245","0.631","-0.076","-0.332","0.278","-0.076","-0.411","0.259","0.655","-0.073","-0.337","0.296"
"24","no","ami","ami.yes","0.203","-0.254","0.661","0.382","0.225","-0.225","0.936","0.178","-0.326","0.682","0.488","0.195","-0.278","0.977","yes","ami","ami.yes","0.203","-0.254","0.661","0.382","0.225","-0.225","0.936","0.178","-0.326","0.682","0.488","0.195","-0.278","0.977"
"25","no","tci","tci.yes","-0.718","-1.431","-0.005","0.049","-0.512","-0.761","-0.005","-0.806","-1.521","-0.092","0.027","-0.553","-0.781","-0.088","yes","tci","tci.yes","-0.718","-1.431","-0.005","0.049","-0.512","-0.761","-0.005","-0.806","-1.521","-0.092","0.027","-0.553","-0.781","-0.088"
"26","no","pad","pad.yes","0.339","-0.439","1.118","0.391","0.404","-0.355","2.058","0.293","-0.575","1.161","0.507","0.340","-0.437","2.194","yes","pad","pad.yes","0.339","-0.439","1.118","0.391","0.404","-0.355","2.058","0.293","-0.575","1.161","0.507","0.340","-0.437","2.194"
"27","no","nihss_0","nihss_0","0.028","-0.136","0.193","0.734","0.028","-0.136","0.193","-0.056","-0.239","0.126","0.544","-0.056","-0.239","0.126","yes","nihss_0","nihss_0","0.028","-0.136","0.193","0.734","0.028","-0.136","0.193","-0.056","-0.239","0.126","0.544","-0.056","-0.239","0.126"
"28","no","any_reperf","any_reperf.yes","0.037","-0.211","0.285","0.768","0.038","-0.190","0.330","0.183","-0.097","0.462","0.199","0.201","-0.092","0.588","yes","any_reperf","any_reperf.yes","0.037","-0.211","0.285","0.768","0.038","-0.190","0.330","0.183","-0.097","0.462","0.199","0.201","-0.092","0.588"
1 names(strat_list)[1] name pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p names(strat_list)[2] name pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p
2 1 mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr
3 2 no pase_0 pase_0 -0.000 -0.002 0.000 0.226 -0.000 -0.002 0.000 -0.000 -0.002 0.000 0.364 -0.000 -0.002 0.000 yes pase_0 pase_0 -0.000 -0.002 0.000 0.226 -0.000 -0.002 0.000 -0.000 -0.002 0.000 0.364 -0.000 -0.002 0.000
4 3 no female female.yes -0.032 -0.245 0.180 0.765 -0.032 -0.217 0.198 0.025 -0.204 0.255 0.830 0.025 -0.185 0.290 yes female female.yes -0.032 -0.245 0.180 0.765 -0.032 -0.217 0.198 0.025 -0.204 0.255 0.830 0.025 -0.185 0.290
5 4 no age age 0.001 -0.007 0.009 0.847 0.001 -0.007 0.009 -0.001 -0.010 0.008 0.768 -0.001 -0.010 0.008 yes age age 0.001 -0.007 0.009 0.847 0.001 -0.007 0.009 -0.001 -0.010 0.008 0.768 -0.001 -0.010 0.008
6 5 no cohab cohab.yes -0.028 -0.235 0.180 0.792 -0.027 -0.210 0.197 0.039 -0.188 0.266 0.736 0.040 -0.171 0.304 yes cohab cohab.yes -0.028 -0.235 0.180 0.792 -0.027 -0.210 0.197 0.039 -0.188 0.266 0.736 0.040 -0.171 0.304
7 6 no ever_smoker ever_smoker.yes -0.115 -0.333 0.103 0.301 -0.109 -0.283 0.109 -0.114 -0.341 0.113 0.323 -0.108 -0.289 0.119 yes ever_smoker ever_smoker.yes -0.115 -0.333 0.103 0.301 -0.109 -0.283 0.109 -0.114 -0.341 0.113 0.323 -0.108 -0.289 0.119
8 7 no diabetes diabetes.yes 0.125 -0.162 0.412 0.392 0.133 -0.149 0.509 0.176 -0.130 0.482 0.259 0.192 -0.122 0.619 yes diabetes diabetes.yes 0.125 -0.162 0.412 0.392 0.133 -0.149 0.509 0.176 -0.130 0.482 0.259 0.192 -0.122 0.619
9 8 no hypertension hypertension.yes 0.064 -0.134 0.262 0.525 0.066 -0.126 0.300 -0.054 -0.272 0.164 0.625 -0.053 -0.238 0.178 yes hypertension hypertension.yes 0.064 -0.134 0.262 0.525 0.066 -0.126 0.300 -0.054 -0.272 0.164 0.625 -0.053 -0.238 0.178
10 9 no afli afli.yes -0.061 -0.337 0.216 0.665 -0.059 -0.286 0.241 -0.126 -0.418 0.167 0.397 -0.118 -0.342 0.181 yes afli afli.yes -0.061 -0.337 0.216 0.665 -0.059 -0.286 0.241 -0.126 -0.418 0.167 0.397 -0.118 -0.342 0.181
11 10 no ami ami.yes 0.230 -0.116 0.575 0.192 0.258 -0.110 0.778 0.348 -0.044 0.741 0.082 0.416 -0.043 1.097 yes ami ami.yes 0.230 -0.116 0.575 0.192 0.258 -0.110 0.778 0.348 -0.044 0.741 0.082 0.416 -0.043 1.097
12 11 no tci tci.yes -0.371 -1.065 0.324 0.295 -0.310 -0.655 0.383 -0.356 -1.044 0.332 0.309 -0.300 -0.648 0.393 yes tci tci.yes -0.371 -1.065 0.324 0.295 -0.310 -0.655 0.383 -0.356 -1.044 0.332 0.309 -0.300 -0.648 0.393
13 12 no pad pad.yes 0.321 -0.111 0.752 0.145 0.378 -0.105 1.122 0.287 -0.195 0.770 0.241 0.333 -0.177 1.159 yes pad pad.yes 0.321 -0.111 0.752 0.145 0.378 -0.105 1.122 0.287 -0.195 0.770 0.241 0.333 -0.177 1.159
14 13 no nihss_0 nihss_0 0.153 0.010 0.297 0.036 0.153 0.010 0.297 0.238 0.083 0.393 0.003 0.238 0.083 0.393 yes nihss_0 nihss_0 0.153 0.010 0.297 0.036 0.153 0.010 0.297 0.238 0.083 0.393 0.003 0.238 0.083 0.393
15 14 no any_reperf any_reperf.yes -0.087 -0.289 0.114 0.396 -0.083 -0.251 0.121 -0.194 -0.417 0.029 0.089 -0.176 -0.341 0.030 yes any_reperf any_reperf.yes -0.087 -0.289 0.114 0.396 -0.083 -0.251 0.121 -0.194 -0.417 0.029 0.089 -0.176 -0.341 0.030
16 15 mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr
17 16 no pase_0 pase_0 -0.002 -0.006 -0.000 0.007 -0.002 -0.006 -0.000 -0.002 -0.006 0.000 0.059 -0.002 -0.006 0.000 yes pase_0 pase_0 -0.002 -0.006 -0.000 0.007 -0.002 -0.006 -0.000 -0.002 -0.006 0.000 0.059 -0.002 -0.006 0.000
18 17 no female female.yes 0.305 0.061 0.549 0.015 0.356 0.063 0.731 0.274 0.002 0.546 0.048 0.315 0.002 0.726 yes female female.yes 0.305 0.061 0.549 0.015 0.356 0.063 0.731 0.274 0.002 0.546 0.048 0.315 0.002 0.726
19 18 no age age 0.000 -0.009 0.009 0.977 0.000 -0.009 0.009 -0.008 -0.019 0.003 0.134 -0.008 -0.019 0.003 yes age age 0.000 -0.009 0.009 0.977 0.000 -0.009 0.009 -0.008 -0.019 0.003 0.134 -0.008 -0.019 0.003
20 19 no cohab cohab.yes -0.067 -0.325 0.190 0.607 -0.065 -0.277 0.209 -0.102 -0.381 0.178 0.475 -0.097 -0.317 0.195 yes cohab cohab.yes -0.067 -0.325 0.190 0.607 -0.065 -0.277 0.209 -0.102 -0.381 0.178 0.475 -0.097 -0.317 0.195
21 20 no ever_smoker ever_smoker.yes 0.103 -0.145 0.351 0.413 0.109 -0.135 0.420 0.098 -0.163 0.359 0.460 0.103 -0.150 0.432 yes ever_smoker ever_smoker.yes 0.103 -0.145 0.351 0.413 0.109 -0.135 0.420 0.098 -0.163 0.359 0.460 0.103 -0.150 0.432
22 21 no diabetes diabetes.yes 0.080 -0.339 0.498 0.709 0.083 -0.287 0.645 0.079 -0.343 0.500 0.713 0.082 -0.290 0.649 yes diabetes diabetes.yes 0.080 -0.339 0.498 0.709 0.083 -0.287 0.645 0.079 -0.343 0.500 0.713 0.082 -0.290 0.649
23 22 no hypertension hypertension.yes 0.285 0.047 0.523 0.019 0.330 0.049 0.686 0.158 -0.103 0.419 0.235 0.171 -0.098 0.520 yes hypertension hypertension.yes 0.285 0.047 0.523 0.019 0.330 0.049 0.686 0.158 -0.103 0.419 0.235 0.171 -0.098 0.520
24 23 no afli afli.yes -0.079 -0.404 0.245 0.631 -0.076 -0.332 0.278 -0.076 -0.411 0.259 0.655 -0.073 -0.337 0.296 yes afli afli.yes -0.079 -0.404 0.245 0.631 -0.076 -0.332 0.278 -0.076 -0.411 0.259 0.655 -0.073 -0.337 0.296
25 24 no ami ami.yes 0.203 -0.254 0.661 0.382 0.225 -0.225 0.936 0.178 -0.326 0.682 0.488 0.195 -0.278 0.977 yes ami ami.yes 0.203 -0.254 0.661 0.382 0.225 -0.225 0.936 0.178 -0.326 0.682 0.488 0.195 -0.278 0.977
26 25 no tci tci.yes -0.718 -1.431 -0.005 0.049 -0.512 -0.761 -0.005 -0.806 -1.521 -0.092 0.027 -0.553 -0.781 -0.088 yes tci tci.yes -0.718 -1.431 -0.005 0.049 -0.512 -0.761 -0.005 -0.806 -1.521 -0.092 0.027 -0.553 -0.781 -0.088
27 26 no pad pad.yes 0.339 -0.439 1.118 0.391 0.404 -0.355 2.058 0.293 -0.575 1.161 0.507 0.340 -0.437 2.194 yes pad pad.yes 0.339 -0.439 1.118 0.391 0.404 -0.355 2.058 0.293 -0.575 1.161 0.507 0.340 -0.437 2.194
28 27 no nihss_0 nihss_0 0.028 -0.136 0.193 0.734 0.028 -0.136 0.193 -0.056 -0.239 0.126 0.544 -0.056 -0.239 0.126 yes nihss_0 nihss_0 0.028 -0.136 0.193 0.734 0.028 -0.136 0.193 -0.056 -0.239 0.126 0.544 -0.056 -0.239 0.126
29 28 no any_reperf any_reperf.yes 0.037 -0.211 0.285 0.768 0.038 -0.190 0.330 0.183 -0.097 0.462 0.199 0.201 -0.092 0.588 yes any_reperf any_reperf.yes 0.037 -0.211 0.285 0.768 0.038 -0.190 0.330 0.183 -0.097 0.462 0.199 0.201 -0.092 0.588

View File

@ -0,0 +1,29 @@
"","name","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p","names(strat_list)[2]","name.1","pred.1","biv_co.1","biv_lo.1","biv_hi.1","biv_pv.1","biv_co.p.1","biv_lo.p.1","biv_hi.p.1","mul_co.1","mul_lo.1","mul_hi.1","mul_pv.1","mul_co.p.1","mul_lo.p.1","mul_hi.p.1"
"1","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month"
"2","afli","afli.yes","-0.061","-0.337","0.216","0.665","-0.059","-0.286","0.241","-0.126","-0.418","0.167","0.397","-0.118","-0.342","0.181","yes","afli","afli.yes","-0.061","-0.337","0.216","0.665","-0.059","-0.286","0.241","-0.126","-0.418","0.167","0.397","-0.118","-0.342","0.181"
"3","age","age","0.001","-0.007","0.009","0.847","0.001","-0.007","0.009","-0.001","-0.01","0.008","0.768","-0.001","-0.01","0.008","yes","age","age","0.001","-0.007","0.009","0.847","0.001","-0.007","0.009","-0.001","-0.01","0.008","0.768","-0.001","-0.01","0.008"
"4","ami","ami.yes","0.23","-0.116","0.575","0.192","0.258","-0.11","0.778","0.348","-0.044","0.741","0.082","0.416","-0.043","1.097","yes","ami","ami.yes","0.23","-0.116","0.575","0.192","0.258","-0.11","0.778","0.348","-0.044","0.741","0.082","0.416","-0.043","1.097"
"5","any_reperf","any_reperf.yes","-0.087","-0.289","0.114","0.396","-0.083","-0.251","0.121","-0.194","-0.417","0.029","0.089","-0.176","-0.341","0.03","yes","any_reperf","any_reperf.yes","-0.087","-0.289","0.114","0.396","-0.083","-0.251","0.121","-0.194","-0.417","0.029","0.089","-0.176","-0.341","0.03"
"6","cohab","cohab.yes","-0.028","-0.235","0.18","0.792","-0.027","-0.21","0.197","0.039","-0.188","0.266","0.736","0.04","-0.171","0.304","yes","cohab","cohab.yes","-0.028","-0.235","0.18","0.792","-0.027","-0.21","0.197","0.039","-0.188","0.266","0.736","0.04","-0.171","0.304"
"7","diabetes","diabetes.yes","0.125","-0.162","0.412","0.392","0.133","-0.149","0.509","0.176","-0.13","0.482","0.259","0.192","-0.122","0.619","yes","diabetes","diabetes.yes","0.125","-0.162","0.412","0.392","0.133","-0.149","0.509","0.176","-0.13","0.482","0.259","0.192","-0.122","0.619"
"8","ever_smoker","ever_smoker.yes","-0.115","-0.333","0.103","0.301","-0.109","-0.283","0.109","-0.114","-0.341","0.113","0.323","-0.108","-0.289","0.119","yes","ever_smoker","ever_smoker.yes","-0.115","-0.333","0.103","0.301","-0.109","-0.283","0.109","-0.114","-0.341","0.113","0.323","-0.108","-0.289","0.119"
"9","female","female.yes","-0.032","-0.245","0.18","0.765","-0.032","-0.217","0.198","0.025","-0.204","0.255","0.83","0.025","-0.185","0.29","yes","female","female.yes","-0.032","-0.245","0.18","0.765","-0.032","-0.217","0.198","0.025","-0.204","0.255","0.83","0.025","-0.185","0.29"
"10","hypertension","hypertension.yes","0.064","-0.134","0.262","0.525","0.066","-0.126","0.3","-0.054","-0.272","0.164","0.625","-0.053","-0.238","0.178","yes","hypertension","hypertension.yes","0.064","-0.134","0.262","0.525","0.066","-0.126","0.3","-0.054","-0.272","0.164","0.625","-0.053","-0.238","0.178"
"11","nihss_0","nihss_0","0.153","0.01","0.297","0.036","0.153","0.01","0.297","0.238","0.083","0.393","0.003","0.238","0.083","0.393","yes","nihss_0","nihss_0","0.153","0.01","0.297","0.036","0.153","0.01","0.297","0.238","0.083","0.393","0.003","0.238","0.083","0.393"
"12","pad","pad.yes","0.321","-0.111","0.752","0.145","0.378","-0.105","1.122","0.287","-0.195","0.77","0.241","0.333","-0.177","1.159","yes","pad","pad.yes","0.321","-0.111","0.752","0.145","0.378","-0.105","1.122","0.287","-0.195","0.77","0.241","0.333","-0.177","1.159"
"13","pase_0","pase_0","0","-0.002","0","0.226","0","-0.002","0","0","-0.002","0","0.364","0","-0.002","0","yes","pase_0","pase_0","0","-0.002","0","0.226","0","-0.002","0","0","-0.002","0","0.364","0","-0.002","0"
"14","tci","tci.yes","-0.371","-1.065","0.324","0.295","-0.31","-0.655","0.383","-0.356","-1.044","0.332","0.309","-0.3","-0.648","0.393","yes","tci","tci.yes","-0.371","-1.065","0.324","0.295","-0.31","-0.655","0.383","-0.356","-1.044","0.332","0.309","-0.3","-0.648","0.393"
"15","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month"
"16","afli","afli.yes","-0.079","-0.404","0.245","0.631","-0.076","-0.332","0.278","-0.076","-0.411","0.259","0.655","-0.073","-0.337","0.296","yes","afli","afli.yes","-0.079","-0.404","0.245","0.631","-0.076","-0.332","0.278","-0.076","-0.411","0.259","0.655","-0.073","-0.337","0.296"
"17","age","age","0","-0.009","0.009","0.977","0","-0.009","0.009","-0.008","-0.019","0.003","0.134","-0.008","-0.019","0.003","yes","age","age","0","-0.009","0.009","0.977","0","-0.009","0.009","-0.008","-0.019","0.003","0.134","-0.008","-0.019","0.003"
"18","ami","ami.yes","0.203","-0.254","0.661","0.382","0.225","-0.225","0.936","0.178","-0.326","0.682","0.488","0.195","-0.278","0.977","yes","ami","ami.yes","0.203","-0.254","0.661","0.382","0.225","-0.225","0.936","0.178","-0.326","0.682","0.488","0.195","-0.278","0.977"
"19","any_reperf","any_reperf.yes","0.037","-0.211","0.285","0.768","0.038","-0.19","0.33","0.183","-0.097","0.462","0.199","0.201","-0.092","0.588","yes","any_reperf","any_reperf.yes","0.037","-0.211","0.285","0.768","0.038","-0.19","0.33","0.183","-0.097","0.462","0.199","0.201","-0.092","0.588"
"20","cohab","cohab.yes","-0.067","-0.325","0.19","0.607","-0.065","-0.277","0.209","-0.102","-0.381","0.178","0.475","-0.097","-0.317","0.195","yes","cohab","cohab.yes","-0.067","-0.325","0.19","0.607","-0.065","-0.277","0.209","-0.102","-0.381","0.178","0.475","-0.097","-0.317","0.195"
"21","diabetes","diabetes.yes","0.08","-0.339","0.498","0.709","0.083","-0.287","0.645","0.079","-0.343","0.5","0.713","0.082","-0.29","0.649","yes","diabetes","diabetes.yes","0.08","-0.339","0.498","0.709","0.083","-0.287","0.645","0.079","-0.343","0.5","0.713","0.082","-0.29","0.649"
"22","ever_smoker","ever_smoker.yes","0.103","-0.145","0.351","0.413","0.109","-0.135","0.42","0.098","-0.163","0.359","0.46","0.103","-0.15","0.432","yes","ever_smoker","ever_smoker.yes","0.103","-0.145","0.351","0.413","0.109","-0.135","0.42","0.098","-0.163","0.359","0.46","0.103","-0.15","0.432"
"23","female","female.yes","0.305","0.061","0.549","0.015","0.356","0.063","0.731","0.274","0.002","0.546","0.048","0.315","0.002","0.726","yes","female","female.yes","0.305","0.061","0.549","0.015","0.356","0.063","0.731","0.274","0.002","0.546","0.048","0.315","0.002","0.726"
"24","hypertension","hypertension.yes","0.285","0.047","0.523","0.019","0.33","0.049","0.686","0.158","-0.103","0.419","0.235","0.171","-0.098","0.52","yes","hypertension","hypertension.yes","0.285","0.047","0.523","0.019","0.33","0.049","0.686","0.158","-0.103","0.419","0.235","0.171","-0.098","0.52"
"25","nihss_0","nihss_0","0.028","-0.136","0.193","0.734","0.028","-0.136","0.193","-0.056","-0.239","0.126","0.544","-0.056","-0.239","0.126","yes","nihss_0","nihss_0","0.028","-0.136","0.193","0.734","0.028","-0.136","0.193","-0.056","-0.239","0.126","0.544","-0.056","-0.239","0.126"
"26","pad","pad.yes","0.339","-0.439","1.118","0.391","0.404","-0.355","2.058","0.293","-0.575","1.161","0.507","0.34","-0.437","2.194","yes","pad","pad.yes","0.339","-0.439","1.118","0.391","0.404","-0.355","2.058","0.293","-0.575","1.161","0.507","0.34","-0.437","2.194"
"27","pase_0","pase_0","-0.002","-0.006","0","0.007","-0.002","-0.006","0","-0.002","-0.006","0","0.059","-0.002","-0.006","0","yes","pase_0","pase_0","-0.002","-0.006","0","0.007","-0.002","-0.006","0","-0.002","-0.006","0","0.059","-0.002","-0.006","0"
"28","tci","tci.yes","-0.718","-1.431","-0.005","0.049","-0.512","-0.761","-0.005","-0.806","-1.521","-0.092","0.027","-0.553","-0.781","-0.088","yes","tci","tci.yes","-0.718","-1.431","-0.005","0.049","-0.512","-0.761","-0.005","-0.806","-1.521","-0.092","0.027","-0.553","-0.781","-0.088"
1 name pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p names(strat_list)[2] name.1 pred.1 biv_co.1 biv_lo.1 biv_hi.1 biv_pv.1 biv_co.p.1 biv_lo.p.1 biv_hi.p.1 mul_co.1 mul_lo.1 mul_hi.1 mul_pv.1 mul_co.p.1 mul_lo.p.1 mul_hi.p.1
2 1 One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month
3 2 afli afli.yes -0.061 -0.337 0.216 0.665 -0.059 -0.286 0.241 -0.126 -0.418 0.167 0.397 -0.118 -0.342 0.181 yes afli afli.yes -0.061 -0.337 0.216 0.665 -0.059 -0.286 0.241 -0.126 -0.418 0.167 0.397 -0.118 -0.342 0.181
4 3 age age 0.001 -0.007 0.009 0.847 0.001 -0.007 0.009 -0.001 -0.01 0.008 0.768 -0.001 -0.01 0.008 yes age age 0.001 -0.007 0.009 0.847 0.001 -0.007 0.009 -0.001 -0.01 0.008 0.768 -0.001 -0.01 0.008
5 4 ami ami.yes 0.23 -0.116 0.575 0.192 0.258 -0.11 0.778 0.348 -0.044 0.741 0.082 0.416 -0.043 1.097 yes ami ami.yes 0.23 -0.116 0.575 0.192 0.258 -0.11 0.778 0.348 -0.044 0.741 0.082 0.416 -0.043 1.097
6 5 any_reperf any_reperf.yes -0.087 -0.289 0.114 0.396 -0.083 -0.251 0.121 -0.194 -0.417 0.029 0.089 -0.176 -0.341 0.03 yes any_reperf any_reperf.yes -0.087 -0.289 0.114 0.396 -0.083 -0.251 0.121 -0.194 -0.417 0.029 0.089 -0.176 -0.341 0.03
7 6 cohab cohab.yes -0.028 -0.235 0.18 0.792 -0.027 -0.21 0.197 0.039 -0.188 0.266 0.736 0.04 -0.171 0.304 yes cohab cohab.yes -0.028 -0.235 0.18 0.792 -0.027 -0.21 0.197 0.039 -0.188 0.266 0.736 0.04 -0.171 0.304
8 7 diabetes diabetes.yes 0.125 -0.162 0.412 0.392 0.133 -0.149 0.509 0.176 -0.13 0.482 0.259 0.192 -0.122 0.619 yes diabetes diabetes.yes 0.125 -0.162 0.412 0.392 0.133 -0.149 0.509 0.176 -0.13 0.482 0.259 0.192 -0.122 0.619
9 8 ever_smoker ever_smoker.yes -0.115 -0.333 0.103 0.301 -0.109 -0.283 0.109 -0.114 -0.341 0.113 0.323 -0.108 -0.289 0.119 yes ever_smoker ever_smoker.yes -0.115 -0.333 0.103 0.301 -0.109 -0.283 0.109 -0.114 -0.341 0.113 0.323 -0.108 -0.289 0.119
10 9 female female.yes -0.032 -0.245 0.18 0.765 -0.032 -0.217 0.198 0.025 -0.204 0.255 0.83 0.025 -0.185 0.29 yes female female.yes -0.032 -0.245 0.18 0.765 -0.032 -0.217 0.198 0.025 -0.204 0.255 0.83 0.025 -0.185 0.29
11 10 hypertension hypertension.yes 0.064 -0.134 0.262 0.525 0.066 -0.126 0.3 -0.054 -0.272 0.164 0.625 -0.053 -0.238 0.178 yes hypertension hypertension.yes 0.064 -0.134 0.262 0.525 0.066 -0.126 0.3 -0.054 -0.272 0.164 0.625 -0.053 -0.238 0.178
12 11 nihss_0 nihss_0 0.153 0.01 0.297 0.036 0.153 0.01 0.297 0.238 0.083 0.393 0.003 0.238 0.083 0.393 yes nihss_0 nihss_0 0.153 0.01 0.297 0.036 0.153 0.01 0.297 0.238 0.083 0.393 0.003 0.238 0.083 0.393
13 12 pad pad.yes 0.321 -0.111 0.752 0.145 0.378 -0.105 1.122 0.287 -0.195 0.77 0.241 0.333 -0.177 1.159 yes pad pad.yes 0.321 -0.111 0.752 0.145 0.378 -0.105 1.122 0.287 -0.195 0.77 0.241 0.333 -0.177 1.159
14 13 pase_0 pase_0 0 -0.002 0 0.226 0 -0.002 0 0 -0.002 0 0.364 0 -0.002 0 yes pase_0 pase_0 0 -0.002 0 0.226 0 -0.002 0 0 -0.002 0 0.364 0 -0.002 0
15 14 tci tci.yes -0.371 -1.065 0.324 0.295 -0.31 -0.655 0.383 -0.356 -1.044 0.332 0.309 -0.3 -0.648 0.393 yes tci tci.yes -0.371 -1.065 0.324 0.295 -0.31 -0.655 0.383 -0.356 -1.044 0.332 0.309 -0.3 -0.648 0.393
16 15 Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month
17 16 afli afli.yes -0.079 -0.404 0.245 0.631 -0.076 -0.332 0.278 -0.076 -0.411 0.259 0.655 -0.073 -0.337 0.296 yes afli afli.yes -0.079 -0.404 0.245 0.631 -0.076 -0.332 0.278 -0.076 -0.411 0.259 0.655 -0.073 -0.337 0.296
18 17 age age 0 -0.009 0.009 0.977 0 -0.009 0.009 -0.008 -0.019 0.003 0.134 -0.008 -0.019 0.003 yes age age 0 -0.009 0.009 0.977 0 -0.009 0.009 -0.008 -0.019 0.003 0.134 -0.008 -0.019 0.003
19 18 ami ami.yes 0.203 -0.254 0.661 0.382 0.225 -0.225 0.936 0.178 -0.326 0.682 0.488 0.195 -0.278 0.977 yes ami ami.yes 0.203 -0.254 0.661 0.382 0.225 -0.225 0.936 0.178 -0.326 0.682 0.488 0.195 -0.278 0.977
20 19 any_reperf any_reperf.yes 0.037 -0.211 0.285 0.768 0.038 -0.19 0.33 0.183 -0.097 0.462 0.199 0.201 -0.092 0.588 yes any_reperf any_reperf.yes 0.037 -0.211 0.285 0.768 0.038 -0.19 0.33 0.183 -0.097 0.462 0.199 0.201 -0.092 0.588
21 20 cohab cohab.yes -0.067 -0.325 0.19 0.607 -0.065 -0.277 0.209 -0.102 -0.381 0.178 0.475 -0.097 -0.317 0.195 yes cohab cohab.yes -0.067 -0.325 0.19 0.607 -0.065 -0.277 0.209 -0.102 -0.381 0.178 0.475 -0.097 -0.317 0.195
22 21 diabetes diabetes.yes 0.08 -0.339 0.498 0.709 0.083 -0.287 0.645 0.079 -0.343 0.5 0.713 0.082 -0.29 0.649 yes diabetes diabetes.yes 0.08 -0.339 0.498 0.709 0.083 -0.287 0.645 0.079 -0.343 0.5 0.713 0.082 -0.29 0.649
23 22 ever_smoker ever_smoker.yes 0.103 -0.145 0.351 0.413 0.109 -0.135 0.42 0.098 -0.163 0.359 0.46 0.103 -0.15 0.432 yes ever_smoker ever_smoker.yes 0.103 -0.145 0.351 0.413 0.109 -0.135 0.42 0.098 -0.163 0.359 0.46 0.103 -0.15 0.432
24 23 female female.yes 0.305 0.061 0.549 0.015 0.356 0.063 0.731 0.274 0.002 0.546 0.048 0.315 0.002 0.726 yes female female.yes 0.305 0.061 0.549 0.015 0.356 0.063 0.731 0.274 0.002 0.546 0.048 0.315 0.002 0.726
25 24 hypertension hypertension.yes 0.285 0.047 0.523 0.019 0.33 0.049 0.686 0.158 -0.103 0.419 0.235 0.171 -0.098 0.52 yes hypertension hypertension.yes 0.285 0.047 0.523 0.019 0.33 0.049 0.686 0.158 -0.103 0.419 0.235 0.171 -0.098 0.52
26 25 nihss_0 nihss_0 0.028 -0.136 0.193 0.734 0.028 -0.136 0.193 -0.056 -0.239 0.126 0.544 -0.056 -0.239 0.126 yes nihss_0 nihss_0 0.028 -0.136 0.193 0.734 0.028 -0.136 0.193 -0.056 -0.239 0.126 0.544 -0.056 -0.239 0.126
27 26 pad pad.yes 0.339 -0.439 1.118 0.391 0.404 -0.355 2.058 0.293 -0.575 1.161 0.507 0.34 -0.437 2.194 yes pad pad.yes 0.339 -0.439 1.118 0.391 0.404 -0.355 2.058 0.293 -0.575 1.161 0.507 0.34 -0.437 2.194
28 27 pase_0 pase_0 -0.002 -0.006 0 0.007 -0.002 -0.006 0 -0.002 -0.006 0 0.059 -0.002 -0.006 0 yes pase_0 pase_0 -0.002 -0.006 0 0.007 -0.002 -0.006 0 -0.002 -0.006 0 0.059 -0.002 -0.006 0
29 28 tci tci.yes -0.718 -1.431 -0.005 0.049 -0.512 -0.761 -0.005 -0.806 -1.521 -0.092 0.027 -0.553 -0.781 -0.088 yes tci tci.yes -0.718 -1.431 -0.005 0.049 -0.512 -0.761 -0.005 -0.806 -1.521 -0.092 0.027 -0.553 -0.781 -0.088

31
bm_16_tbl_trans.csv Normal file
View File

@ -0,0 +1,31 @@
"","name","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p"
"1","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr","mdi_1_enr"
"2","active_treat","active_treat.yes","0.053","-0.090","0.196","0.464","0.055","-0.086","0.217","0.105","-0.039","0.250","0.151","0.111","-0.038","0.284"
"3","pase_0","pase_0","-0.001","-0.002","-0.000","0.006","-0.001","-0.002","-0.000","-0.000","-0.002","0.000","0.059","-0.000","-0.002","0.000"
"4","female","female.yes","0.145","-0.005","0.295","0.058","0.156","-0.005","0.343","0.183","0.023","0.344","0.025","0.201","0.023","0.410"
"5","age","age","-0.001","-0.007","0.004","0.688","-0.001","-0.007","0.004","-0.006","-0.012","0.000","0.060","-0.006","-0.012","0.000"
"6","cohab","cohab.yes","0.019","-0.132","0.169","0.807","0.019","-0.123","0.184","0.040","-0.120","0.201","0.620","0.041","-0.113","0.222"
"7","ever_smoker","ever_smoker.yes","-0.088","-0.240","0.064","0.256","-0.084","-0.214","0.066","-0.134","-0.291","0.023","0.095","-0.125","-0.252","0.023"
"8","diabetes","diabetes.yes","0.159","-0.065","0.383","0.163","0.172","-0.063","0.466","0.217","-0.013","0.446","0.064","0.242","-0.012","0.563"
"9","hypertension","hypertension.yes","0.138","-0.004","0.281","0.058","0.148","-0.004","0.324","0.061","-0.091","0.214","0.430","0.063","-0.087","0.238"
"10","afli","afli.yes","-0.146","-0.342","0.050","0.143","-0.136","-0.290","0.051","-0.149","-0.351","0.052","0.146","-0.139","-0.296","0.053"
"11","ami","ami.yes","0.147","-0.112","0.405","0.266","0.158","-0.106","0.499","0.177","-0.103","0.457","0.216","0.194","-0.098","0.580"
"12","tci","tci.yes","0.138","-0.316","0.591","0.550","0.148","-0.271","0.807","0.078","-0.362","0.518","0.729","0.081","-0.304","0.678"
"13","pad","pad.yes","0.139","-0.219","0.497","0.447","0.149","-0.197","0.643","0.150","-0.237","0.537","0.446","0.162","-0.211","0.711"
"14","nihss_0","nihss_0","0.106","0.007","0.204","0.036","0.106","0.007","0.204","0.117","0.010","0.224","0.032","0.117","0.010","0.224"
"15","any_reperf","any_reperf.yes","0.021","-0.127","0.168","0.785","0.021","-0.119","0.183","-0.013","-0.174","0.149","0.879","-0.012","-0.160","0.160"
"16","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr","mdi_6_newobs_enr"
"17","active_treat","active_treat.yes","-0.084","-0.249","0.081","0.316","-0.081","-0.220","0.084","-0.068","-0.237","0.100","0.426","-0.066","-0.211","0.105"
"18","pase_0","pase_0","-0.001","-0.003","-0.000","0.002","-0.001","-0.003","-0.000","-0.001","-0.003","-0.000","0.017","-0.001","-0.003","-0.000"
"19","female","female.yes","0.246","0.074","0.418","0.005","0.279","0.077","0.519","0.264","0.077","0.451","0.006","0.302","0.080","0.570"
"20","age","age","0.001","-0.005","0.008","0.658","0.001","-0.005","0.008","-0.007","-0.015","0.000","0.062","-0.007","-0.015","0.000"
"21","cohab","cohab.yes","-0.094","-0.269","0.080","0.290","-0.090","-0.236","0.084","-0.008","-0.197","0.181","0.935","-0.008","-0.179","0.199"
"22","ever_smoker","ever_smoker.yes","-0.021","-0.197","0.155","0.817","-0.020","-0.178","0.168","-0.001","-0.183","0.182","0.994","-0.001","-0.167","0.199"
"23","diabetes","diabetes.yes","0.012","-0.260","0.284","0.932","0.012","-0.229","0.329","-0.017","-0.299","0.265","0.905","-0.017","-0.259","0.303"
"24","hypertension","hypertension.yes","0.232","0.068","0.396","0.006","0.261","0.070","0.487","0.100","-0.078","0.278","0.272","0.105","-0.075","0.321"
"25","afli","afli.yes","-0.025","-0.255","0.206","0.835","-0.024","-0.225","0.229","-0.063","-0.300","0.175","0.605","-0.061","-0.259","0.191"
"26","ami","ami.yes","0.200","-0.103","0.502","0.195","0.221","-0.098","0.652","0.303","-0.031","0.638","0.076","0.354","-0.031","0.893"
"27","tci","tci.yes","-0.660","-1.180","-0.140","0.013","-0.483","-0.693","-0.130","-0.695","-1.210","-0.180","0.008","-0.501","-0.702","-0.165"
"28","pad","pad.yes","0.416","0.001","0.831","0.050","0.516","0.001","1.296","0.304","-0.155","0.762","0.194","0.355","-0.143","1.143"
"29","nihss_0","nihss_0","0.142","0.024","0.260","0.018","0.142","0.024","0.260","0.134","0.007","0.260","0.039","0.134","0.007","0.260"
"30","any_reperf","any_reperf.yes","-0.028","-0.198","0.142","0.749","-0.027","-0.179","0.153","-0.035","-0.222","0.153","0.715","-0.034","-0.199","0.165"
1 name pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p
2 1 mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr mdi_1_enr
3 2 active_treat active_treat.yes 0.053 -0.090 0.196 0.464 0.055 -0.086 0.217 0.105 -0.039 0.250 0.151 0.111 -0.038 0.284
4 3 pase_0 pase_0 -0.001 -0.002 -0.000 0.006 -0.001 -0.002 -0.000 -0.000 -0.002 0.000 0.059 -0.000 -0.002 0.000
5 4 female female.yes 0.145 -0.005 0.295 0.058 0.156 -0.005 0.343 0.183 0.023 0.344 0.025 0.201 0.023 0.410
6 5 age age -0.001 -0.007 0.004 0.688 -0.001 -0.007 0.004 -0.006 -0.012 0.000 0.060 -0.006 -0.012 0.000
7 6 cohab cohab.yes 0.019 -0.132 0.169 0.807 0.019 -0.123 0.184 0.040 -0.120 0.201 0.620 0.041 -0.113 0.222
8 7 ever_smoker ever_smoker.yes -0.088 -0.240 0.064 0.256 -0.084 -0.214 0.066 -0.134 -0.291 0.023 0.095 -0.125 -0.252 0.023
9 8 diabetes diabetes.yes 0.159 -0.065 0.383 0.163 0.172 -0.063 0.466 0.217 -0.013 0.446 0.064 0.242 -0.012 0.563
10 9 hypertension hypertension.yes 0.138 -0.004 0.281 0.058 0.148 -0.004 0.324 0.061 -0.091 0.214 0.430 0.063 -0.087 0.238
11 10 afli afli.yes -0.146 -0.342 0.050 0.143 -0.136 -0.290 0.051 -0.149 -0.351 0.052 0.146 -0.139 -0.296 0.053
12 11 ami ami.yes 0.147 -0.112 0.405 0.266 0.158 -0.106 0.499 0.177 -0.103 0.457 0.216 0.194 -0.098 0.580
13 12 tci tci.yes 0.138 -0.316 0.591 0.550 0.148 -0.271 0.807 0.078 -0.362 0.518 0.729 0.081 -0.304 0.678
14 13 pad pad.yes 0.139 -0.219 0.497 0.447 0.149 -0.197 0.643 0.150 -0.237 0.537 0.446 0.162 -0.211 0.711
15 14 nihss_0 nihss_0 0.106 0.007 0.204 0.036 0.106 0.007 0.204 0.117 0.010 0.224 0.032 0.117 0.010 0.224
16 15 any_reperf any_reperf.yes 0.021 -0.127 0.168 0.785 0.021 -0.119 0.183 -0.013 -0.174 0.149 0.879 -0.012 -0.160 0.160
17 16 mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr mdi_6_newobs_enr
18 17 active_treat active_treat.yes -0.084 -0.249 0.081 0.316 -0.081 -0.220 0.084 -0.068 -0.237 0.100 0.426 -0.066 -0.211 0.105
19 18 pase_0 pase_0 -0.001 -0.003 -0.000 0.002 -0.001 -0.003 -0.000 -0.001 -0.003 -0.000 0.017 -0.001 -0.003 -0.000
20 19 female female.yes 0.246 0.074 0.418 0.005 0.279 0.077 0.519 0.264 0.077 0.451 0.006 0.302 0.080 0.570
21 20 age age 0.001 -0.005 0.008 0.658 0.001 -0.005 0.008 -0.007 -0.015 0.000 0.062 -0.007 -0.015 0.000
22 21 cohab cohab.yes -0.094 -0.269 0.080 0.290 -0.090 -0.236 0.084 -0.008 -0.197 0.181 0.935 -0.008 -0.179 0.199
23 22 ever_smoker ever_smoker.yes -0.021 -0.197 0.155 0.817 -0.020 -0.178 0.168 -0.001 -0.183 0.182 0.994 -0.001 -0.167 0.199
24 23 diabetes diabetes.yes 0.012 -0.260 0.284 0.932 0.012 -0.229 0.329 -0.017 -0.299 0.265 0.905 -0.017 -0.259 0.303
25 24 hypertension hypertension.yes 0.232 0.068 0.396 0.006 0.261 0.070 0.487 0.100 -0.078 0.278 0.272 0.105 -0.075 0.321
26 25 afli afli.yes -0.025 -0.255 0.206 0.835 -0.024 -0.225 0.229 -0.063 -0.300 0.175 0.605 -0.061 -0.259 0.191
27 26 ami ami.yes 0.200 -0.103 0.502 0.195 0.221 -0.098 0.652 0.303 -0.031 0.638 0.076 0.354 -0.031 0.893
28 27 tci tci.yes -0.660 -1.180 -0.140 0.013 -0.483 -0.693 -0.130 -0.695 -1.210 -0.180 0.008 -0.501 -0.702 -0.165
29 28 pad pad.yes 0.416 0.001 0.831 0.050 0.516 0.001 1.296 0.304 -0.155 0.762 0.194 0.355 -0.143 1.143
30 29 nihss_0 nihss_0 0.142 0.024 0.260 0.018 0.142 0.024 0.260 0.134 0.007 0.260 0.039 0.134 0.007 0.260
31 30 any_reperf any_reperf.yes -0.028 -0.198 0.142 0.749 -0.027 -0.179 0.153 -0.035 -0.222 0.153 0.715 -0.034 -0.199 0.165

31
bm_16_tbl_trans_back.csv Normal file
View File

@ -0,0 +1,31 @@
"","pred","biv_co","biv_lo","biv_hi","biv_pv","biv_co.p","biv_lo.p","biv_hi.p","mul_co","mul_lo","mul_hi","mul_pv","mul_co.p","mul_lo.p","mul_hi.p"
"1","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month","One month"
"2","active_treat.yes","0.053","-0.09","0.196","0.464","0.055","-0.086","0.217","0.105","-0.039","0.25","0.151","0.111","-0.038","0.284"
"3","afli.yes","-0.146","-0.342","0.05","0.143","-0.136","-0.29","0.051","-0.149","-0.351","0.052","0.146","-0.139","-0.296","0.053"
"4","age","-0.001","-0.007","0.004","0.688","-0.001","-0.007","0.004","-0.006","-0.012","0","0.06","-0.006","-0.012","0"
"5","ami.yes","0.147","-0.112","0.405","0.266","0.158","-0.106","0.499","0.177","-0.103","0.457","0.216","0.194","-0.098","0.58"
"6","any_reperf.yes","0.021","-0.127","0.168","0.785","0.021","-0.119","0.183","-0.013","-0.174","0.149","0.879","-0.012","-0.16","0.16"
"7","cohab.yes","0.019","-0.132","0.169","0.807","0.019","-0.123","0.184","0.04","-0.12","0.201","0.62","0.041","-0.113","0.222"
"8","diabetes.yes","0.159","-0.065","0.383","0.163","0.172","-0.063","0.466","0.217","-0.013","0.446","0.064","0.242","-0.012","0.563"
"9","ever_smoker.yes","-0.088","-0.24","0.064","0.256","-0.084","-0.214","0.066","-0.134","-0.291","0.023","0.095","-0.125","-0.252","0.023"
"10","female.yes","0.145","-0.005","0.295","0.058","0.156","-0.005","0.343","0.183","0.023","0.344","0.025","0.201","0.023","0.41"
"11","hypertension.yes","0.138","-0.004","0.281","0.058","0.148","-0.004","0.324","0.061","-0.091","0.214","0.43","0.063","-0.087","0.238"
"12","nihss_0","0.106","0.007","0.204","0.036","0.106","0.007","0.204","0.117","0.01","0.224","0.032","0.117","0.01","0.224"
"13","pad.yes","0.139","-0.219","0.497","0.447","0.149","-0.197","0.643","0.15","-0.237","0.537","0.446","0.162","-0.211","0.711"
"14","pase_0","-0.001","-0.002","0","0.006","-0.001","-0.002","0","0","-0.002","0","0.059","0","-0.002","0"
"15","tci.yes","0.138","-0.316","0.591","0.55","0.148","-0.271","0.807","0.078","-0.362","0.518","0.729","0.081","-0.304","0.678"
"16","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month","Six month"
"17","active_treat.yes","-0.084","-0.249","0.081","0.316","-0.081","-0.22","0.084","-0.068","-0.237","0.1","0.426","-0.066","-0.211","0.105"
"18","afli.yes","-0.025","-0.255","0.206","0.835","-0.024","-0.225","0.229","-0.063","-0.3","0.175","0.605","-0.061","-0.259","0.191"
"19","age","0.001","-0.005","0.008","0.658","0.001","-0.005","0.008","-0.007","-0.015","0","0.062","-0.007","-0.015","0"
"20","ami.yes","0.2","-0.103","0.502","0.195","0.221","-0.098","0.652","0.303","-0.031","0.638","0.076","0.354","-0.031","0.893"
"21","any_reperf.yes","-0.028","-0.198","0.142","0.749","-0.027","-0.179","0.153","-0.035","-0.222","0.153","0.715","-0.034","-0.199","0.165"
"22","cohab.yes","-0.094","-0.269","0.08","0.29","-0.09","-0.236","0.084","-0.008","-0.197","0.181","0.935","-0.008","-0.179","0.199"
"23","diabetes.yes","0.012","-0.26","0.284","0.932","0.012","-0.229","0.329","-0.017","-0.299","0.265","0.905","-0.017","-0.259","0.303"
"24","ever_smoker.yes","-0.021","-0.197","0.155","0.817","-0.02","-0.178","0.168","-0.001","-0.183","0.182","0.994","-0.001","-0.167","0.199"
"25","female.yes","0.246","0.074","0.418","0.005","0.279","0.077","0.519","0.264","0.077","0.451","0.006","0.302","0.08","0.57"
"26","hypertension.yes","0.232","0.068","0.396","0.006","0.261","0.07","0.487","0.1","-0.078","0.278","0.272","0.105","-0.075","0.321"
"27","nihss_0","0.142","0.024","0.26","0.018","0.142","0.024","0.26","0.134","0.007","0.26","0.039","0.134","0.007","0.26"
"28","pad.yes","0.416","0.001","0.831","0.05","0.516","0.001","1.296","0.304","-0.155","0.762","0.194","0.355","-0.143","1.143"
"29","pase_0","-0.001","-0.003","0","0.002","-0.001","-0.003","0","-0.001","-0.003","0","0.017","-0.001","-0.003","0"
"30","tci.yes","-0.66","-1.18","-0.14","0.013","-0.483","-0.693","-0.13","-0.695","-1.21","-0.18","0.008","-0.501","-0.702","-0.165"
1 pred biv_co biv_lo biv_hi biv_pv biv_co.p biv_lo.p biv_hi.p mul_co mul_lo mul_hi mul_pv mul_co.p mul_lo.p mul_hi.p
2 1 One month One month One month One month One month One month One month One month One month One month One month One month One month One month One month
3 2 active_treat.yes 0.053 -0.09 0.196 0.464 0.055 -0.086 0.217 0.105 -0.039 0.25 0.151 0.111 -0.038 0.284
4 3 afli.yes -0.146 -0.342 0.05 0.143 -0.136 -0.29 0.051 -0.149 -0.351 0.052 0.146 -0.139 -0.296 0.053
5 4 age -0.001 -0.007 0.004 0.688 -0.001 -0.007 0.004 -0.006 -0.012 0 0.06 -0.006 -0.012 0
6 5 ami.yes 0.147 -0.112 0.405 0.266 0.158 -0.106 0.499 0.177 -0.103 0.457 0.216 0.194 -0.098 0.58
7 6 any_reperf.yes 0.021 -0.127 0.168 0.785 0.021 -0.119 0.183 -0.013 -0.174 0.149 0.879 -0.012 -0.16 0.16
8 7 cohab.yes 0.019 -0.132 0.169 0.807 0.019 -0.123 0.184 0.04 -0.12 0.201 0.62 0.041 -0.113 0.222
9 8 diabetes.yes 0.159 -0.065 0.383 0.163 0.172 -0.063 0.466 0.217 -0.013 0.446 0.064 0.242 -0.012 0.563
10 9 ever_smoker.yes -0.088 -0.24 0.064 0.256 -0.084 -0.214 0.066 -0.134 -0.291 0.023 0.095 -0.125 -0.252 0.023
11 10 female.yes 0.145 -0.005 0.295 0.058 0.156 -0.005 0.343 0.183 0.023 0.344 0.025 0.201 0.023 0.41
12 11 hypertension.yes 0.138 -0.004 0.281 0.058 0.148 -0.004 0.324 0.061 -0.091 0.214 0.43 0.063 -0.087 0.238
13 12 nihss_0 0.106 0.007 0.204 0.036 0.106 0.007 0.204 0.117 0.01 0.224 0.032 0.117 0.01 0.224
14 13 pad.yes 0.139 -0.219 0.497 0.447 0.149 -0.197 0.643 0.15 -0.237 0.537 0.446 0.162 -0.211 0.711
15 14 pase_0 -0.001 -0.002 0 0.006 -0.001 -0.002 0 0 -0.002 0 0.059 0 -0.002 0
16 15 tci.yes 0.138 -0.316 0.591 0.55 0.148 -0.271 0.807 0.078 -0.362 0.518 0.729 0.081 -0.304 0.678
17 16 Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month Six month
18 17 active_treat.yes -0.084 -0.249 0.081 0.316 -0.081 -0.22 0.084 -0.068 -0.237 0.1 0.426 -0.066 -0.211 0.105
19 18 afli.yes -0.025 -0.255 0.206 0.835 -0.024 -0.225 0.229 -0.063 -0.3 0.175 0.605 -0.061 -0.259 0.191
20 19 age 0.001 -0.005 0.008 0.658 0.001 -0.005 0.008 -0.007 -0.015 0 0.062 -0.007 -0.015 0
21 20 ami.yes 0.2 -0.103 0.502 0.195 0.221 -0.098 0.652 0.303 -0.031 0.638 0.076 0.354 -0.031 0.893
22 21 any_reperf.yes -0.028 -0.198 0.142 0.749 -0.027 -0.179 0.153 -0.035 -0.222 0.153 0.715 -0.034 -0.199 0.165
23 22 cohab.yes -0.094 -0.269 0.08 0.29 -0.09 -0.236 0.084 -0.008 -0.197 0.181 0.935 -0.008 -0.179 0.199
24 23 diabetes.yes 0.012 -0.26 0.284 0.932 0.012 -0.229 0.329 -0.017 -0.299 0.265 0.905 -0.017 -0.259 0.303
25 24 ever_smoker.yes -0.021 -0.197 0.155 0.817 -0.02 -0.178 0.168 -0.001 -0.183 0.182 0.994 -0.001 -0.167 0.199
26 25 female.yes 0.246 0.074 0.418 0.005 0.279 0.077 0.519 0.264 0.077 0.451 0.006 0.302 0.08 0.57
27 26 hypertension.yes 0.232 0.068 0.396 0.006 0.261 0.07 0.487 0.1 -0.078 0.278 0.272 0.105 -0.075 0.321
28 27 nihss_0 0.142 0.024 0.26 0.018 0.142 0.024 0.26 0.134 0.007 0.26 0.039 0.134 0.007 0.26
29 28 pad.yes 0.416 0.001 0.831 0.05 0.516 0.001 1.296 0.304 -0.155 0.762 0.194 0.355 -0.143 1.143
30 29 pase_0 -0.001 -0.003 0 0.002 -0.001 -0.003 0 -0.001 -0.003 0 0.017 -0.001 -0.003 0
31 30 tci.yes -0.66 -1.18 -0.14 0.013 -0.483 -0.693 -0.13 -0.695 -1.21 -0.18 0.008 -0.501 -0.702 -0.165

34
data modification.R Normal file
View File

@ -0,0 +1,34 @@
## =============================================================================
##
## Data modification and enriching
##
## =============================================================================
## =============================================================================
## Requirements
## =============================================================================
# library(gtsummary)
library(REDCapR)
## =============================================================================
## Import
## =============================================================================
token_talos<-read.csv("/Users/au301842/talos_redcap_token.csv",colClasses = "character")|>
names()|>
(\(x){ ## Shorthand for "anonymous lambda function"
substr(x,2,33)})()|>
suppressWarnings()
dta <- redcap_read_oneshot(
redcap_uri = "https://redcap.au.dk/api/",
token = token_talos
)$data|>
select(-c("cpr"))
## =============================================================================
## MDI scores
## =============================================================================

112
data_format.R Normal file
View File

@ -0,0 +1,112 @@
library(REDCapR)
library(gtsummary)
theme_gtsummary_compact()
library(REDCapR)
library(gt)
library(lubridate)
library(dplyr)
library(tidyr)
dta_all<-read.csv("/Volumes/Data/depression/dep_dataset.csv")
# Defining patients to include for analysis
# Only including cases with complete pase_0 and MDI at 1 & 6 months
dta<-dta_all[!is.na(dta_all$pase_0),]
# &!is.na(dta$mdi_1)&!is.na(dta$mdi_6)
## Formatting
dta$diabetes<-factor(dta$diabetes)
dta$pad<-factor(dta$pad)
dta$cohab<-ifelse(dta$civil=="partner","yes","no")|>
factor()
dta$hypertension<-factor(dta$hypertension)
dta$afli[dta$afli=="unknown"]<-NA
dta$afli<-factor(dta$afli)
dta$ever_smoker<-ifelse(dta$smoke_ever=="ever","yes","no")|>
factor()
dta$ami<-factor(dta$ami)
dta$tci<-factor(dta$tci)
dta$thrombolysis<-factor(dta$thrombolysis)
dta$thrombechtomy<-factor(dta$thrombechtomy)
dta$any_reperf<-ifelse(dta$rep_any=="rep","yes","no")|>
factor()
dta$pad<-factor(dta$pad)
dta$nihss_0<-as.numeric(dta$nihss_0)
dta$age<-as.numeric(dta$age)
dta$active_treat<-ifelse(dta$rtreat=="Active","yes","no")|>
factor()
# dta$rtreat<-factor(dta$rtreat)
dta$female<-ifelse(dta$sex=="female","yes","no")|>
factor()
dta$pase_0<-as.numeric(dta$pase_0)
dta$pase_6<-as.numeric(dta$pase_6)
dta$bmi<-as.numeric(dta$bmi)
dta$mdi_6<-as.numeric(dta$mdi_6)
dta$pase_0_bin<-factor(dta$pase_0_bin,levels=c("lower","higher"))
dta$nihss_0_isna<-is.na(dta$nihss_0)
vars<-c("pase_0",
"female",
"age",
"cohab",
"ever_smoker",
"diabetes",
"hypertension",
"afli",
"ami",
"tci",
"pad",
"nihss_0",
"any_reperf")
# tbl1_vars<-c("thrombolysis", "thrombechtomy","inc_time")
labels_all<-list(active_treat~"Active trial treatment",
pase_0~"PASE score",
age~"Age",
female~"Female sex",
ever_smoker~"History of smoking",
cohab~"Cohabitation",
diabetes~"Known diabetes",
hypertension~"Known hypertension",
afli~"Known Atrialfibrillation",
ami~"Previos myocardial infarction",
tci~"Previos TIA",
pad~"Known peripheral artery disease",
nihss_0~"NIHSS score",
thrombolysis~"Thrombolytic therapy",
thrombechtomy~"Endovascular treatment",
any_reperf~"Any reperfusion treatment",
inc_time~"Study inclusion time",
'[Intercept]'~"Intercept")
lab_sel<-function(label_list,variables_vector){
## Helper function to select labels for gtsummary function from list of all labels based on selected variables.
## Long names in try to ease reading.
include_index<-c()
for (i in 1:length(label_list)) {
include_index[i]<-as.character(label_list[[i]])[2] %in% variables_vector
}
return(label_list[include_index])
}
dta_backup<-dta

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

138
function_back_trans.R Normal file
View File

@ -0,0 +1,138 @@
back_trans <- function(gtt,outm=NULL,sqrts=NULL,logs=NULL,log1ps=NULL){
## Handles back-transformation for non-strat and strat
##
## gtt = gt table element
## outm = outcome meassure trans. One of c("log","log1p","sqrt"). The reciprocal function is used to back transform.
## sqrts = sqrt-trasformed variable names
## logs= log-trasformed variable names
## log1ps= log1p-trasformed variable names
# gtt<-mul
# outm<-"log1p"
# sqrts <- "pase_0"
# logs <- "nihss_0"
ests<-colnames(dplyr::select(gtt$table_body,contains("estimate")))
lows<-colnames(dplyr::select(gtt$table_body,contains("conf.low")))
highs<-colnames(dplyr::select(gtt$table_body,contains("conf.high")))
sqrt_ci <- function(gtt,all.v=FALSE,var=NULL){
# Sqrt-transformation function to account for negative coefficients.
if (all.v){
var<-gtt$table_body$variable
}
# There is a
for (i in var){
for (j in ests){
est<-gtt$table_body[gtt$table_body$variable==i,][j]
if (0 > est){
gtt$table_body[gtt$table_body$variable==i,][j]<- (0-(est^2))
} else {
gtt$table_body[gtt$table_body$variable==i,][j]<- (est^2)
}
}
for (j in lows){
low<-gtt$table_body[gtt$table_body$variable==i,][j]
if (0 > low){
gtt$table_body[gtt$table_body$variable==i,][j]<- (0-(low^2))
} else {
gtt$table_body[gtt$table_body$variable==i,][j]<- (low^2)
}
}
for (j in highs){
high<-gtt$table_body[gtt$table_body$variable==i,][j]
if (0 > high){
gtt$table_body[gtt$table_body$variable==i,][j]<- (0-(high^2))
} else {
gtt$table_body[gtt$table_body$variable==i,][j]<- (high^2)
}
}
}
return(gtt)
}
log_ci <- function(gtt,all.v=FALSE,var=NULL){
# Log-transformation function
if (all.v){
var<-gtt$table_body$variable
}
for (i in var){
for (j in ests){
gtt$table_body[gtt$table_body$variable==i,][j]<-
exp(gtt$table_body[gtt$table_body$variable==i,][j])
}
for (j in lows){
gtt$table_body[gtt$table_body$variable==i,][j]<-
exp(gtt$table_body[gtt$table_body$variable==i,][j])
}
for (j in highs){
gtt$table_body[gtt$table_body$variable==i,][j]<-
exp(gtt$table_body[gtt$table_body$variable==i,][j])
}
}
return(gtt)
}
log1p_ci <- function(gtt,all.v=FALSE,var=NULL){
# Log1p-transformation function
if (all.v){
var<-gtt$table_body$variable
}
for (i in var){
for (j in ests){
gtt$table_body[gtt$table_body$variable==i,][j]<-
expm1(gtt$table_body[gtt$table_body$variable==i,][j])
}
for (j in lows){
gtt$table_body[gtt$table_body$variable==i,][j]<-
expm1(gtt$table_body[gtt$table_body$variable==i,][j])
}
for (j in highs){
gtt$table_body[gtt$table_body$variable==i,][j]<-
expm1(gtt$table_body[gtt$table_body$variable==i,][j])
}
}
return(gtt)
}
if (outm=="log1p"){
## Transforming log1p() to expm1()
gtt<-log1p_ci(gtt,all.v=TRUE)
}
if (outm=="log"){
## Transforming log1p() to expm1()
gtt<-log_ci(gtt,all.v=TRUE)
}
if (outm=="sqrt"){
gtt<-sqrt_ci(gtt,all.v=TRUE)
}
# Sqrts
gtt<-sqrt_ci(gtt,var=sqrts)
# Log1ps
gtt<-log1p_ci(gtt, var=log1ps)
# Logs
gtt<-log_ci(gtt, var=logs)
return(gtt)
}

29
function_reg_fun.R Normal file
View File

@ -0,0 +1,29 @@
reg_fun <- function(outs=c("mdi_1_enr","mdi_6_newobs_enr"),
lbl_x=NULL,
strat_var=NULL,
trans_vars=TRUE,
sqrt_vars="pase_0",
log1p_vars="nihss_0",
log_vars=NULL,
trans_back=TRUE,
print_tbl=TRUE){
##
## THIS IS NOT WORKING. WISH IT WOULD!
##
# outs Outcoume variables
# lbl_x # Extra label in file name,
# strat_var # Variable to stratify by. Only one variable(!),
# trans_vars # Transform variables? T/F,
# sqrt_vars" # Variables to sqrt-transfom,
# log1p_vars" # Variables to log1p-transform, not outcome,
# log_vars # Variables to log-transform,
# log1p_vars_all # All variables to log1p-transform, incl outcome,
# trans_back # Back transform variables? T/F,
# print_tbl # Print tables? T/F){
log1p_vars_all <- c(log1p_vars,outs)
source("data_format.R")
source("biv_mul.R")
}

87
function_reg_table.R Normal file
View File

@ -0,0 +1,87 @@
reg_table <- function(X,y,m.biv=TRUE,m.mul=TRUE,trans.out=FALSE,trans.var=FALSE,outm=NULL,sqrt.vars=NULL,log1p.vars=NULL,inter.add=NULL){
# method One of biv, mul, biv_mul
source("function_trans_table.R")
cols<-c("name","pred", "co", "lo", "hi", "pv")
if(!is.null(inter.add)){
form_add<-paste0(paste0(inter.add,collapse = "*"),"+")
m.biv <- FALSE # If interaction term is added, only multivariate is performed.
} else {
form_add=NULL
}
if (m.biv){
df_b <- data.frame(matrix(NA, ncol = length(cols)))
names(df_b)<-cols
for (j in colnames(X)){
m<-lm(formula(paste0("y~",j)),X)
ci <- confint(m)
lo <- ci[-1, 1]
hi <- ci[-1, 2]
co <- coef(m)[-1]
#pv <- broom::tidy(m)$p.value[-1]
pv <- summary(m)$coefficients[2,4] # Avoids dependency
x1 <- X[, j]
if (is.factor(x1)) {
pred <- paste(j, levels(x1)[-1],
sep = ".")
} else { pred <- j }
df_b <- rbind(df_b, cbind(name=j, pred, co, lo, hi, pv))
}
df_b <- df_b[-1,]
if (trans.var){
df_b <- trans_table(df_b,sqrts=sqrt.vars,f.vars=f.names)
}
df_b<-df_b|>data.frame()|>mutate(across(matches('co|lo|hi'),as.numeric))
}
if (m.mul){
m<-lm(formula(paste0("y~",form_add,".")),X)
ci <- confint(m)
lo <- ci[-1, 1]
hi <- ci[-1, 2]
co <- coef(m)[-1]
#pv <- broom::tidy(m)$p.value[-1]
pv <- summary(m)$coefficients[-1,4] # Avoids dependency
pred <- c()
for (j in colnames(X)){
x1 <- X[, j]
if (is.factor(x1)) {
pred <- c(pred,
paste(j, levels(x1)[-1],
sep = "."))
} else { pred <- c(pred,
j) }
}
df_m <- cbind(name=c(colnames(X),form_add), pred=c(pred,form_add), co, lo, hi, pv)
if (trans.var){
df_m <- trans_table(df_m,sqrts=sqrt.vars,f.vars=f.names)
}
df_m<-df_m|>data.frame()|>mutate(across(matches('co|lo|hi'),as.numeric))
}
if (all(m.biv,m.mul)){
colnames(df_b)[3:ncol(df_b)]<-paste0("biv_",colnames(df_b)[3:ncol(df_b)])
colnames(df_m)[3:ncol(df_m)]<-paste0("mul_",colnames(df_m)[3:ncol(df_m)])
return(merge(df_b,df_m,by=c("name","pred"),sort=FALSE))
} else if (m.biv) {
return(df_b)
} else {return(df_m)}
}

25
function_trans_cols.R Normal file
View File

@ -0,0 +1,25 @@
trans_cols<-function(ds,sqrts=NULL,logs=NULL,log1ps=NULL){
## gtt = gt table element
## sqrts = sqrt-trasformed variable names
## logs= log-trasformed variable names
## log1ps= log1p-trasformed variable names
# gtt<-mul
# outm<-"log1p"
# sqrts <- "pase_0"
# logs <- "nihss_0"
for (i in sqrts){
ds[i]<-sqrt(ds[i])
}
for (i in logs){
ds[i]<-log(ds[i])
}
for (i in log1ps){
ds[i]<-log1p(ds[i])
}
return(ds)
}

55
function_trans_table.R Normal file
View File

@ -0,0 +1,55 @@
trans_table <- function(ds,f.vars,sqrts=NULL,logs=NULL){
## Handles back-transformation for table with co, lo and hi
##
## ds = matrix or table including colnames co, lo and hi
## sqrts sqrt-trasformed variables names
## logs log-trasformed independent variables names
## f.vars dichotomous variables
# f.vars <- f.names
# ds<-df_m
# sqrts <- "pase_0"
# logs <- "nihss_0"
ds<-ds|>data.frame()|>mutate(across(c("co", "lo", "hi"),as.numeric))
for (i in sqrts){
est<-ds$co[ds$name==i]
if (0 > est){
ds$co[ds$name==i]<- (0-(est^2))
} else {
ds$co[ds$name==i]<- (est^2)
}
low<-ds$lo[ds$name==i]
if (0 > low){
ds$lo[ds$name==i]<- (0-(low^2))
} else {
ds$lo[ds$name==i]<- (low^2)
}
high<-ds$hi[ds$name==i]
if (0 > high){
ds$hi[ds$name==i]<- (0-(high^2))
} else {
ds$hi[ds$name==i]<- (high^2)
}
}
cols<-c("name","co.p", "lo.p", "hi.p")
ds_r <- data.frame(matrix(ncol = length(cols)))
names(ds_r)<-cols
for (j in 1:nrow(ds)){
if (ds$name[j]%in%f.vars){
ds_r<-rbind(ds_r,c(name=ds$name[j],sapply(ds[j,3:5],expm1)))
} else {
ds_rn <- c(ds$name[j],ds[j,3:5])
names(ds_rn) <- cols
ds_r<-rbind(ds_r,ds_rn)
}
}
return(merge(ds,ds_r,by="name",sort = FALSE))
}

97
regression_interaction.R Normal file
View File

@ -0,0 +1,97 @@
## =============================================================================
## Requirements
## =============================================================================
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
library(gtsummary)
source("function_back_trans.R")
## =============================================================================
## Loop
## =============================================================================
bm_list<-list()
for (i in 1:length(outs)){
dta_l<-dta|>
dplyr::select(all_of(c("active_treat",vars,outs[i]))) # active_treat should be vector
sel<-dta_l|>
sapply(is.factor)
## Multivariate
mul<-dta_l |>
lm(formula(
paste(c(paste(c(outs[i],paste(c("active_treat","pase_0"),collapse="*")),collapse="~"),"."),collapse="+")),
data = _)|>
tbl_regression(label = lab_sel(labels_all,c(vars,"active_treat")),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3))|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels()
mul <- back_trans(mul, outm = "log1p" ,sqrts = "pase_0",log1ps = "nihss_0")
bm_list[[i]]<-mul
}
## =============================================================================
## Big merge
## =============================================================================
bm_16_tbl <- tbl_merge(
tbls = bm_list,
tab_spanner = c("**One month follow up**",
"**Six months follow up**")
)
library(aod)
for (i in 1:length(outs)){
model<-dta |>
dplyr::select(all_of(c("active_treat",vars,outs[i])))|>
lm(formula(
paste(c(paste(c(outs[i],paste(c("active_treat","pase_0"),collapse="*")),collapse="~"),"."),collapse="+")),
data = _)
wt<-wald.test(Sigma = vcov(model),
b = coef(model),
Terms = model$rank # Rank gives number of coefficients. The interaction is the last.
)
print(wt)
}
## =============================================================================
## Print
## =============================================================================
# File name depending onstratification, transformation and back transformation
if (print_tbl==TRUE){
fnm<-paste0("bm_16_tbl",lbl_x)
if (!is.null(strat_var)){fnm<-paste0(fnm,"_strat")}
if (trans_vars==TRUE){fnm<-paste0(fnm,"_trans")}
if (trans_back==TRUE){fnm<-paste0(fnm,"_back")}
bm_16_tbl_rtf <- file(paste0(fnm,".RTF"), "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
}

91
regression_nihss-pase.R Normal file
View File

@ -0,0 +1,91 @@
## =============================================================================
## Requirements
## =============================================================================
source("function_trans_cols.R")
if (trans_vars==TRUE){
# If trans_vars flag is TRUE, transform specified variables
dta<-trans_cols(dta_backup,sqrts=sqrt_vars,log1ps = log1p_vars_all)
} else {dta<-dta_backup}
library(dplyr)
library(gtsummary)
source("function_back_trans.R")
## =============================================================================
## Regression tables
## =============================================================================
dta_l<-dta|>
dplyr::select(all_of(c(vars,outs))) # active_treat should be vector
sel<-dta_l|>
sapply(is.factor)
## Bivariate
biv<-dta_l|>
tbl_uvregression(data=_,
y=outs,
method=lm,
label = lab_sel(labels_all,vars),
show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3)
) |>
add_global_p()|>
bold_p()
## Multivariate
mul<-dta_l |>
lm(nihss_0~pase_0+.,
data = _) |>
tbl_regression(show_single_row=colnames(dta_l)[sel],
estimate_fun = ~style_sigfig(.x,digits = 3),
pvalue_fun = ~style_pvalue(.x, digits = 3),
label = lab_sel(labels_all,vars)
)|>
add_n() |>
add_global_p() |>
bold_p() |>
bold_labels() |>
italicize_levels()
# Back transforming if flag set
if (trans_back==TRUE){
ls<-lapply(list(biv,mul), back_trans, outm = "log1p" ,sqrts = sqrt_vars)
} else {ls<-list(biv,mul)}
## =============================================================================
## Merge
## =============================================================================
if (trans_back==TRUE){tab_span<-c("**Bivariate linear regression [TRANS t/r]**",
"**Multivariate linear regression [TRANS t/r]**")
} else {tab_span<-c("**Bivariate linear regression**",
"**Multivariate linear regression**")}
bm_16_tbl<-tbl_merge(
tbls = ls,
tab_spanner = tab_span
)
## =============================================================================
## Print
## =============================================================================
# File name depending onstratification, transformation and back transformation
if (print_tbl==TRUE){
fnm<-paste0("bm_16_tbl",lbl_x)
if (!is.null(strat_var)){fnm<-paste0(fnm,"_strat")}
if (trans_vars==TRUE){fnm<-paste0(fnm,"_trans")}
if (trans_back==TRUE){fnm<-paste0(fnm,"_back")}
bm_16_tbl_rtf <- file(paste0(fnm,".RTF"), "w")
writeLines(bm_16_tbl%>%as_gt()%>%as_rtf(), bm_16_tbl_rtf)
close(bm_16_tbl_rtf)
}

15
table_1.R Normal file
View File

@ -0,0 +1,15 @@
tbl1_vars<-c("active_treat",vars,"inc_time")
tbl_1<-dta|>
tbl_summary(missing = "ifany",
include = all_of(tbl1_vars),
missing_text="(Missing)",
label = lab_sel(labels_all,tbl1_vars)
)|>
add_n()|>
as_gt() |>
# modify with gt functions
gt::tab_header("Baseline Characteristics") |>
gt::tab_options(
table.font.size = "small",
data_row.padding = gt::px(1))