transfer from old repo
BIN
2 Longterm/.DS_Store
vendored
Normal file
285
2 Longterm/260315/_targets.R
Executable file
|
|
@ -0,0 +1,285 @@
|
|||
# Created by use_targets().
|
||||
# Follow the comments below to fill in this target script.
|
||||
# Then follow the manual to check and run the pipeline:
|
||||
# https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline
|
||||
|
||||
# Load packages required to define the pipeline:
|
||||
library(targets)
|
||||
library(tarchetypes) # Load other packages as needed.
|
||||
|
||||
# Set target options:
|
||||
tar_option_set(
|
||||
seed = 142,
|
||||
packages = c("tibble"), # packages that your targets need to run
|
||||
format = "qs" # , # Optionally set the default storage format. qs is fast.
|
||||
#
|
||||
# For distributed computing in tar_make(), supply a {crew} controller
|
||||
# as discussed at https://books.ropensci.org/targets/crew.html.
|
||||
# Choose a controller that suits your needs. For example, the following
|
||||
# sets a controller with 2 workers which will run as local R processes:
|
||||
#
|
||||
# controller = crew::crew_controller_local(workers = 2)
|
||||
#
|
||||
# Alternatively, if you want workers to run on a high-performance computing
|
||||
# cluster, select a controller from the {crew.cluster} package. The following
|
||||
# example is a controller for Sun Grid Engine (SGE).
|
||||
#
|
||||
# controller = crew.cluster::crew_controller_sge(
|
||||
# workers = 50,
|
||||
# # Many clusters install R as an environment module, and you can load it
|
||||
# # with the script_lines argument. To select a specific verison of R,
|
||||
# # you may need to include a version string, e.g. "module load R/4.3.0".
|
||||
# # Check with your system administrator if you are unsure.
|
||||
# script_lines = "module load R"
|
||||
# )
|
||||
#
|
||||
# Set other options as needed.
|
||||
)
|
||||
|
||||
# tar_make_clustermq() is an older (pre-{crew}) way to do distributed computing
|
||||
# in {targets}, and its configuration for your machine is below.
|
||||
options(clustermq.scheduler = "multiprocess")
|
||||
|
||||
# tar_make_future() is an older (pre-{crew}) way to do distributed computing
|
||||
# in {targets}, and its configuration for your machine is below.
|
||||
future::plan(future.callr::callr)
|
||||
|
||||
# Run the R scripts in the R/ folder with your custom functions:
|
||||
tar_source()
|
||||
source(here::here("R/glmnet-reg.R")) # Source other scripts as needed.
|
||||
|
||||
# Replace the target list below with your own:
|
||||
list(
|
||||
tar_target(
|
||||
name = pop_df,
|
||||
command = get_clinical()
|
||||
),
|
||||
tar_target(
|
||||
name = reg_list,
|
||||
command = get_reg_ls()
|
||||
),
|
||||
tar_target(
|
||||
name = df_deaths,
|
||||
command = get_deaths(reg_list)
|
||||
),
|
||||
tar_target(
|
||||
name = df_events,
|
||||
command = get_events(reg_list)
|
||||
),
|
||||
tar_target(
|
||||
name = df_events_deaths,
|
||||
command = merge_events(list(events = df_events, deaths = df_deaths, clinical = pop_df))
|
||||
),
|
||||
tar_target(
|
||||
name = df_treated,
|
||||
command = get_treated(reg_list)
|
||||
),
|
||||
tar_target(
|
||||
name = df_dst,
|
||||
command = get_dst(reg_list, pop_df)
|
||||
),
|
||||
tar_target(
|
||||
name = list_filtered,
|
||||
command = list(all_events = df_events_deaths, clinical = pop_df, dst = df_dst)
|
||||
),
|
||||
tar_target(
|
||||
name = df_all_data,
|
||||
command = collectall(list_filtered)
|
||||
),
|
||||
tar_target(
|
||||
name = df_all_data_formatted,
|
||||
command = data_formatting(df_all_data)
|
||||
),
|
||||
tar_target(
|
||||
name = ls_all_events,
|
||||
command = all_events(list(events = df_events, deaths = df_deaths, clinical = pop_df))
|
||||
),
|
||||
tar_target(
|
||||
name = df_event_data,
|
||||
command = events_ready(df_all_data_formatted)
|
||||
),
|
||||
tar_target(
|
||||
name = df_talos_data,
|
||||
command = talos_ready(df_all_data_formatted)
|
||||
),
|
||||
tar_target(
|
||||
name = df_talos_data_imp,
|
||||
command = talos_imp(df_talos_data)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_summary,
|
||||
command = events_tblone(df_event_data)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_cox_regression,
|
||||
command = show_table_regression(df_event_data, use.mice = FALSE)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_cox_regression_uv,
|
||||
command = uv_cox_table(df_event_data)
|
||||
),
|
||||
tar_target(
|
||||
name = df_event_data_small,
|
||||
command = events_ready_small(df_all_data_formatted)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_summary_small,
|
||||
command = events_tblone(df_event_data_small)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_cox_regression_small,
|
||||
command = show_table_regression(df_event_data_small, use.mice = FALSE)
|
||||
),
|
||||
tar_target(
|
||||
name = df_events_mids,
|
||||
command = events_dataset(df_event_data, impute = TRUE)
|
||||
),
|
||||
tar_target(
|
||||
name = df_events_complete,
|
||||
command = complete_preds_data(df_event_data)
|
||||
),
|
||||
tar_target(
|
||||
name = tbl_events_mids_cox_regression,
|
||||
command = show_table_regression(df_event_data, use.mice = TRUE)
|
||||
),
|
||||
tar_target(
|
||||
name = plot_events_survival_smooth,
|
||||
command = df_event_data |> events_dataset(impute = FALSE) |> cox_regression(include_formula=TRUE) |> plot_survival_smooth()
|
||||
)#,
|
||||
# tar_target(
|
||||
# name = plot_events_survival_smooth_mids,
|
||||
# command = df_events_mids |> cox_regression() |> plot_survival_smooth()
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = df_pred_data,
|
||||
# command = prediction_ready(df_all_data_formatted)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary,
|
||||
# command = preds_tblone(df_pred_data)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_true,
|
||||
# command = df_pred_data |>
|
||||
# dplyr::select(pase_0, pase_4, soc_status_nowork, fam_indk_hl, edu_level_hl) |>
|
||||
# true_pred_sum_plot()
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_exp,
|
||||
# command = df_pred_data |>
|
||||
# dplyr::select(pase_0, pase_4, soc_status_nowork, fam_indk_hl, edu_level_hl) |>
|
||||
# preds_tblone()
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_exp_sex,
|
||||
# command = df_pred_data |>
|
||||
# dplyr::select(reg_female, soc_status_nowork, fam_indk_hl, edu_level_hl) |>
|
||||
# summary_tblone()
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_exp_pase,
|
||||
# command = df_pred_data |> sum_pase_tables()
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_exp_missing_edu,
|
||||
# command = df_pred_data |>
|
||||
# dplyr::select(age,reg_female, reg_trombolyse, reg_trombektomi, reg_hyperten, reg_diabetes, nihss_0, pase_0, pase_4, soc_status_nowork, fam_indk_hl, edu_level_hl) |>
|
||||
# who_is_missing(var="edu_level_hl")
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_pred_summary_exp_missing_bmi,
|
||||
# command = df_pred_data |>
|
||||
# dplyr::select(age,reg_female, reg_trombolyse, reg_trombektomi, reg_hyperten, reg_diabetes, nihss_0, pase_0, pase_4, reg_bmi, soc_status_nowork, fam_indk_hl, edu_level_hl) |>
|
||||
# who_is_missing(var="reg_bmi")
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_models,
|
||||
# command = pred_models(df_pred_data,auto.l = TRUE,weighted = FALSE)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_models_anyupdown,
|
||||
# command = pred_models(df_pred_data,auto.l = TRUE,weighted = FALSE,split.type="anyupdown")
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_models_relupdown_20,
|
||||
# command = pred_models(df_pred_data,auto.l = TRUE,weighted = FALSE,split.type="relupdown",rel.bin=20)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_models_relupdown_50,
|
||||
# command = pred_models(df_pred_data,auto.l = TRUE,weighted = FALSE,split.type="relupdown",rel.bin=50)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = df_pred_mids,
|
||||
# command = fun_impute(data = df_pred_data, outcome.vars = c("pase_0", "pase_4"))
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_mids_reg,
|
||||
# command = mids_regularisation(df_pred_mids)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_mids_reg_anyupdown,
|
||||
# command = mids_regularisation(df_pred_mids,split.type="anyupdown")
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_mids_reg_relupdown_20,
|
||||
# command = mids_regularisation(df_pred_mids,split.type="relupdown",rel.bin=20)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_mids_reg_relupdown_50,
|
||||
# command = mids_regularisation(df_pred_mids,split.type="relupdown",rel.bin=50)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_summary,
|
||||
# command = multi_summary(ls_pred_models)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = ls_pred_mids_summary,
|
||||
# command = multi_summary(ls_pred_mids_reg)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_preds_log_reg,
|
||||
# command = pred_log_reg(df_pred_data)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_preds_lin_reg,
|
||||
# command = pred_lin_reg(df_pred_data)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = tbl_preds_lin_imp_reg,
|
||||
# command = pred_lin_reg(df_pred_mids)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = list_pred_clusters,
|
||||
# command = get_clusters(df_events_complete,rm.out = TRUE)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = list_pred_clusters_seq,
|
||||
# command = get_clusters(df_events_complete,n.cl=4)
|
||||
# )#,
|
||||
# tar_target(
|
||||
# name = list_df_multi_grouping,
|
||||
# command = multi_grouping_df_list(df_all_data_formatted,args.list=df_mega_list())
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = list_multi_group_results,
|
||||
# command = multi_results_list(list_df_multi_grouping)
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = list_multi_group_results_direct,
|
||||
# command = df_all_data_formatted |> multi_grouping_df_list(args.list=df_mega_list()) |> multi_cox_performance_test()
|
||||
# )
|
||||
|
||||
|
||||
#,
|
||||
# tar_quarto(
|
||||
# name = report,
|
||||
# path = "index.qmd"
|
||||
# ),
|
||||
# tar_target(
|
||||
# name = pa_change_export_files,
|
||||
# command = quarto::quarto_render(here::here("doc/pa_change.qmd"), output_format = "docx")
|
||||
# )
|
||||
)
|
||||
|
||||
## TODO
|
||||
## - modify pipeline to only perform imputation once and have the rest use this single object.
|
||||
268
2 Longterm/260315/alternative_grouping.R
Executable file
|
|
@ -0,0 +1,268 @@
|
|||
source("R/functions.R")
|
||||
|
||||
### FUNCTIONALISE --> DONE
|
||||
|
||||
df <- targets::tar_read(df_all_data_formatted) |>
|
||||
group_format(binning.fun = bin_anyupdown) |>
|
||||
dplyr::mutate(pase_change = factor(pase_change, levels = c("high", "up", "low", "down")))
|
||||
|
||||
|
||||
df |> gtsummary::tbl_summary(by = pase_change)
|
||||
|
||||
cox <- df |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
|
||||
|
||||
df |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard()
|
||||
|
||||
df |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression() |>
|
||||
ggsurvfit::survfit2() |>
|
||||
ggsurvfit::ggsurvfit() + ggsurvfit::add_confidence_interval() +
|
||||
ggsurvfit::scale_ggsurvfit() +
|
||||
ggsurvfit::add_risktable()
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
||||
data <- targets::tar_read(df_all_data_formatted)
|
||||
|
||||
|
||||
df <- targets::tar_read(df_all_data_formatted) |>
|
||||
group_format(binning.fun = bin_relupdown, rel.bin = 50)
|
||||
|
||||
|
||||
df |> gtsummary::tbl_summary(by = pase_change)
|
||||
|
||||
df |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard()
|
||||
|
||||
df |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression() |>
|
||||
ggsurvfit::survfit2() |>
|
||||
ggsurvfit::ggsurvfit() + ggsurvfit::add_confidence_interval() +
|
||||
ggsurvfit::scale_ggsurvfit() +
|
||||
ggsurvfit::add_risktable()
|
||||
|
||||
|
||||
|
||||
targets::tar_read(list_df_multi_grouping) |> purrr::map(\(.x) summary(.x[["pase_change"]]))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## BMI out
|
||||
|
||||
### Univariable models
|
||||
|
||||
|
||||
|
||||
ls_df <- targets::tar_read(df_all_data_formatted) |>
|
||||
multi_grouping_df_list(args.list=df_mega_list(strategies=c(
|
||||
# "bin_original",
|
||||
# "bin_anyupdown",
|
||||
"bin_relupdown",
|
||||
"bin_absupdown",
|
||||
"bin_quantile",
|
||||
# "bin_clusterlcm",
|
||||
"bin_percentage")),remove="pase_0")
|
||||
|
||||
|
||||
performance_overview_uni <- ls_df |> multi_cox_performance_test(all.vars = FALSE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
|
||||
# performance_overview_uni
|
||||
|
||||
# Comparing the best and the original
|
||||
|
||||
|
||||
cox_models_uni <- ls_df|>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
cox_regression(all.vars = FALSE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
})
|
||||
|
||||
ls_df[c(pick_non_duplicated(performance_overview_uni,"Name","AIC_wt",1:3),"lowest_percentage_25")]|>
|
||||
purrr::map(\(.x){
|
||||
.x |> dplyr::select(pase_change) |>
|
||||
gtsummary::tbl_summary()
|
||||
}) |> tbl_merged_named()
|
||||
|
||||
|
||||
lapply(best_models_uni, performance::model_performance) |>
|
||||
(\(.x){
|
||||
dplyr::bind_cols(model=names(.x), dplyr::bind_rows(.x))
|
||||
})()
|
||||
|
||||
|
||||
models_ls_uni <- best_models_uni |> lapply(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE) |> gtsummary::bold_p()
|
||||
})
|
||||
|
||||
|
||||
models_ls_uni |> tbl_merged_named()
|
||||
|
||||
|
||||
## Multivariable models
|
||||
|
||||
performance_overview_multi <- ls_df |> multi_cox_performance_test(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
|
||||
# performance_overview_multi
|
||||
|
||||
# Comparing the best and the original
|
||||
# best_models_multi <- head(performance_overview_multi,10)
|
||||
|
||||
cox_models_multi <- ls_df |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
})
|
||||
|
||||
ls_df[c(pick_non_duplicated(performance_overview_multi,"Name","AIC_wt",1:3),"lowest_percentage_25")]|>
|
||||
purrr::map(\(.x){
|
||||
.x |> dplyr::select(pase_change) |>
|
||||
gtsummary::tbl_summary()
|
||||
}) |> tbl_merged_named()
|
||||
|
||||
lapply(best_models_multi, performance::model_performance) |>
|
||||
(\(.x){
|
||||
dplyr::bind_cols(model=names(.x), dplyr::bind_rows(.x))
|
||||
})()
|
||||
|
||||
|
||||
models_ls_multi <- best_models_multi |> lapply(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE) |> gtsummary::bold_p()
|
||||
})
|
||||
|
||||
|
||||
models_ls_multi |> tbl_merged_named()
|
||||
|
||||
|
||||
|
||||
## Handle for mids objects
|
||||
# targets::tar_read(df_events_mids)
|
||||
# targets::tar_read(df_event_data)
|
||||
|
||||
ls_df_mids <- targets::tar_read(df_events_mids) |> multi_grouping_df_list(args.list=df_mega_list(strategies=c(
|
||||
# "bin_original",
|
||||
# "bin_anyupdown",
|
||||
"bin_relupdown",
|
||||
"bin_absupdown",
|
||||
"bin_quantile",
|
||||
# "bin_clusterlcm",
|
||||
"bin_percentage")),remove="pase_0")
|
||||
|
||||
cox_models_mids <- ls_df_mids|>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change")
|
||||
})
|
||||
|
||||
performance_overview_mids <- lapply(cox_models_mids,mids_model_aic)|>
|
||||
(\(.x){
|
||||
dplyr::bind_cols(Name=names(.x), AIC=Reduce(c,.x))
|
||||
})() |> dplyr::arrange(AIC) |>
|
||||
dplyr::mutate(rank=rank(AIC,ties.method = "min"))
|
||||
|
||||
# performance_overview_mids|> head(20)
|
||||
|
||||
# Comparing the best and the original
|
||||
|
||||
best_models_mids <- head(performance_overview_mids,10)
|
||||
|
||||
# best_models_mids <- cox_models_mids[c(pick_non_duplicated(performance_overview_mids,"Name","AIC",1:3),"quantile_change_6_2_ANY","lowest_percentage_25")]
|
||||
|
||||
models_ls_mids <- best_models_mids |> lapply(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE) |> gtsummary::bold_p() |> gtsummary::add_glance_source_note()
|
||||
})
|
||||
|
||||
models_ls_mids |> tbl_merged_named()
|
||||
|
||||
## Difference between mids-results
|
||||
# targets::tar_read(df_event_data)
|
||||
|
||||
## NOTE on investigation
|
||||
# In the original grouping, PASE-cutting was performed based only on patients without prior events.
|
||||
# In the new multi-grouping strategies evaluation, PASE grouping is based on all TALOS-patients.
|
||||
# We already did export some data, so we should probably stick with this. On the other hand,
|
||||
# this is probably a minor thing, and we should perform analyses based on all patients like intended.
|
||||
# MAYBE
|
||||
#
|
||||
|
||||
##
|
||||
|
||||
|
||||
|
||||
|
||||
best_models <- list("uni"=performance_overview_uni,
|
||||
"multi"=performance_overview_multi,
|
||||
"mids"=performance_overview_mids) |>
|
||||
lapply(\(.x){
|
||||
.x |> dplyr::select(Name,rank,AIC)
|
||||
}) |> dplyr::bind_rows()
|
||||
|
||||
models_overall_rank <- split(best_models,best_models$Name) |>
|
||||
purrr::imap(\(.x,.i){
|
||||
tibble::tibble(name=.i,rank_sum=sum(.x$rank), median_AIC=median(.x$AIC))
|
||||
})|> dplyr::bind_rows() |>
|
||||
dplyr::arrange(rank_sum)
|
||||
|
||||
models_overall_rank[models_overall_rank$name %in% c("quantile_change_10_1","quantile_change_8_2","quantile_change_8_2_ANY"),]
|
||||
|
||||
all_cox_models <- list(
|
||||
"Univariable"=cox_models_uni,
|
||||
"Multivariable"=cox_models_multi,
|
||||
"Imputed multivariable"=cox_models_mids
|
||||
)
|
||||
|
||||
names_best <- models_overall_rank$name[c(1:6)]
|
||||
|
||||
best_sum_tables <- names_best|>
|
||||
lapply(\(.x){
|
||||
ls_df[[.x]] |>
|
||||
dplyr::select(pase_change) |> gtsummary::tbl_summary()
|
||||
}) |>
|
||||
setNames(glue::glue("{rank(models_overall_rank$rank_sum,ties.method = 'min')[c(1:6)]}_{names_best}"))
|
||||
|
||||
best_cox_tables <- names_best |>
|
||||
lapply(\(.x){
|
||||
list("Group counts"=ls_df[[.x]] |>
|
||||
dplyr::select(pase_change) |> gtsummary::tbl_summary() |> fix_labels(),
|
||||
all_cox_models |>
|
||||
lapply(\(.y){
|
||||
.y[[.x]] |> tbl_regression_standard() |> gtsummary::modify_table_styling(columns=tidyselect::starts_with("p.value"),hide = TRUE) |>
|
||||
gtsummary::remove_row_type(variables=-pase_change,type="all")
|
||||
})) |> purrr::list_flatten() |>
|
||||
tbl_merged_named()
|
||||
}) |>
|
||||
setNames(glue::glue("{rank(models_overall_rank$rank_sum,ties.method = 'min')[c(1:6)]}_{names_best}"))
|
||||
|
||||
## Counts also for multivariable analyses could be added as well
|
||||
|
||||
best_stack <- best_cox_tables |> tbl_stack_named()
|
||||
|
||||
best_stack |> gtsummary::as_gt() |>
|
||||
gt::gtsave(filename = here::here("out/sens_cox.docx"))
|
||||
|
||||
## Checking on a specific model
|
||||
ls_df_fun[[24]] |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression() |>
|
||||
ggsurvfit::survfit2() |>
|
||||
ggsurvfit::ggsurvfit() + ggsurvfit::add_confidence_interval() +
|
||||
ggsurvfit::scale_ggsurvfit() +
|
||||
ggsurvfit::add_risktable()
|
||||
|
||||
ls_df_fun[[24]] |>
|
||||
# dplyr::select(-pase_0,-pase_4,-pase_rel_dif) |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard()
|
||||
740
2 Longterm/260315/combined_script.R
Executable file
|
|
@ -0,0 +1,740 @@
|
|||
# Code from: cont_pase_sens.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
tbl_cont_0 <- targets::tar_read("df_all_data_formatted")|>
|
||||
dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |>
|
||||
# pase_cutter(drop.nas = TRUE) |>
|
||||
events_ready(v.groups=c("clin","lifestyle.events","ses", "assess.events","quartiles")) |>
|
||||
dplyr::select(dplyr::all_of(c("pase_0", "age", "reg_female", "nihss_0", "reg_trombolyse",
|
||||
"reg_trombektomi", "rtreat_placebo", "reg_alone", "reg_smoker",
|
||||
"reg_more_alc", "reg_hyperten", "reg_diabetes", "reg_atriefli",
|
||||
"reg_ami", "soc_status_nowork", "fam_indk_hl", "edu_level_hl",
|
||||
"who_4", "mdi_4", "mfi_gen_4", "mrs_4_above1", "time", "status"
|
||||
))) |>
|
||||
(\(data){
|
||||
# c("pase_0","pase_4") |>
|
||||
# purrr::map(\(exp){
|
||||
list("Univariable"=cox_regression(data=data,all.vars = FALSE, use.strata = FALSE, outcome.var = "pase_0"),
|
||||
"Multivariable"=cox_regression(data=data,all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_0")) |>
|
||||
purrr::map(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE) |> gtsummary::add_nevent()|>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
# })
|
||||
})() |>
|
||||
gtsummary::modify_table_body( ~ filter(.x, variable == "pase_0"))
|
||||
tbl_cont_4 <- targets::tar_read("df_all_data_formatted")|>
|
||||
dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |>
|
||||
# pase_cutter(drop.nas = TRUE) |>
|
||||
events_ready(v.groups=c("clin","lifestyle.events","ses", "assess.events","quartiles")) |>
|
||||
dplyr::select(dplyr::all_of(c("pase_4", "age", "reg_female", "nihss_0", "reg_trombolyse",
|
||||
"reg_trombektomi", "rtreat_placebo", "reg_alone", "reg_smoker",
|
||||
"reg_more_alc", "reg_hyperten", "reg_diabetes", "reg_atriefli",
|
||||
"reg_ami", "soc_status_nowork", "fam_indk_hl", "edu_level_hl",
|
||||
"who_4", "mdi_4", "mfi_gen_4", "mrs_4_above1", "time", "status"
|
||||
))) |>
|
||||
(\(data){
|
||||
# c("pase_0","pase_4") |>
|
||||
# purrr::map(\(exp){
|
||||
list("Univariable"=cox_regression(data=data,all.vars = FALSE, use.strata = FALSE, outcome.var = "pase_4"),
|
||||
"Multivariable"=cox_regression(data=data,all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_4")) |>
|
||||
purrr::map(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE) |> gtsummary::add_nevent()|>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
# })
|
||||
})() |>
|
||||
gtsummary::modify_table_body( ~ filter(.x, variable == "pase_4"))
|
||||
list("PASE 0"=tbl_cont_0,
|
||||
"PASE 6"=tbl_cont_4) |> tbl_stack_named()
|
||||
|
||||
|
||||
|
||||
# Code from: events_type_sens.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
df <- targets::tar_read(df_all_data_formatted) |>
|
||||
dplyr::mutate(
|
||||
status.all=dplyr::if_else(
|
||||
startsWith(as.character(event),"death"),"death","cve",missing = NA_character_)|> factor()
|
||||
)|>
|
||||
get_vars(vars.groups = c("clin","lifestyle.events","ses", "ssri")) |>
|
||||
dplyr::rename(status=status.all,
|
||||
time=time.all)
|
||||
df$status |> summary()
|
||||
tbl <- df |>
|
||||
pase_cutter(drop.nas = TRUE, drop.pase = TRUE) |>
|
||||
(\(.x) {
|
||||
list(
|
||||
"death" = .x |> dplyr::mutate(status = dplyr::if_else(status == "death", 1, 0, 0)),
|
||||
"cve" = .x |> dplyr::mutate(status = dplyr::if_else(status == "cve", 1, 0, 0))
|
||||
)
|
||||
})() |> lapply(\(.x) {
|
||||
ls <- list(
|
||||
"Univariate" = .x |> dplyr::select(-rtreat) |>
|
||||
standard_multi_cox_table(all.vars = FALSE) |> gtsummary::add_nevent(),
|
||||
"Multivariate" = .x |> dplyr::select(-rtreat) |>
|
||||
standard_multi_cox_table(all.vars = TRUE) |> gtsummary::add_nevent()
|
||||
) |>
|
||||
purrr::map(gtsummary::bold_p) |>
|
||||
|
||||
tbl_merged_named()
|
||||
ls |>
|
||||
gtsummary::modify_table_body( ~ filter(.x, variable == "pase_change"))
|
||||
}) |>
|
||||
gtsummary::tbl_stack(group_header = c("death","cve"))# |>
|
||||
# gtsummary::as_gt() |>
|
||||
# gt::gtsave(here::here("out/trial_strat_sens.docx"))
|
||||
|
||||
tbl
|
||||
|
||||
names(tbl)
|
||||
|
||||
|
||||
|
||||
# Code from: mrs_sensitivity.qmd
|
||||
source(here::here("R/functions.R"))
|
||||
ls_mrs0 <- targets::tar_read(df_all_data_formatted) |>
|
||||
dplyr::filter(mrs_0==0)|>
|
||||
dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |>
|
||||
events_ready() |>
|
||||
(\(.x){
|
||||
list(
|
||||
std=.x,
|
||||
imp=.x |> events_dataset(impute = TRUE)
|
||||
)
|
||||
})() |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
pase_cutter(drop.pase = TRUE,drop.nas = TRUE)
|
||||
})
|
||||
|
||||
# targets::tar_read(df_all_data_formatted) |>
|
||||
# dplyr::filter(mrs_0==0) |>
|
||||
# dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |> events_ready() |>
|
||||
# pase_cutter(drop.pase = TRUE,drop.nas = TRUE) |>
|
||||
# cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
# tbl_regression_standard()
|
||||
|
||||
ls <- list(
|
||||
"Univariable"= ls_mrs0$std |>
|
||||
dplyr::select(pase_change,dplyr::everything()) |>
|
||||
splitdf4uvcox(include=c("time","status")) |>
|
||||
purrr::map(\(.x){
|
||||
.x |> tbl_regression_standard()
|
||||
}) |>
|
||||
gtsummary::tbl_stack(),
|
||||
"Multivariable" = ls_mrs0$std |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard() |> gtsummary::add_glance_source_note(),
|
||||
"Multivariable Imputed"= ls_mrs0$imp |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard()
|
||||
) |> purrr::map(\(.x){
|
||||
.x|>
|
||||
gtsummary::modify_table_styling(column = p.value,
|
||||
hide=TRUE)
|
||||
}) |> tbl_merged_named()
|
||||
|
||||
ls
|
||||
# |> gtsummary::as_gt() |>
|
||||
# gt::gtsave(filename = here::here(glue::glue("out/sens_subset_mrs0_0.docx")))
|
||||
|
||||
# ls_mrs0$std |>
|
||||
# cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |> performance::check_model()
|
||||
targets::tar_read(df_all_data_formatted)|>
|
||||
dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |>
|
||||
dplyr::filter(mrs_0==0) |>
|
||||
dplyr::select(pase_0,pase_4) |>
|
||||
summary()
|
||||
# ls_mrs0$std |> gtsummary::tbl_summary(by = pase_change) |> fix_labels()
|
||||
ls_mrs0_change <- targets::tar_read(df_all_data_formatted) |>
|
||||
get_vars(vars.groups =c("clin","lifestyle.events","ses", "assess.events.pre")) |>
|
||||
dplyr::filter(event.include) |>
|
||||
dplyr::select(-tidyselect::all_of("event.include")) |>
|
||||
(\(.x){
|
||||
list(
|
||||
std=.x,
|
||||
imp=.x |>
|
||||
dplyr::select(-tidyselect::any_of("reg_bmi"))|>
|
||||
fun_impute(ignore = c("pase_0","pase_4"),pase.mod = FALSE)
|
||||
)
|
||||
})() |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
pase_cutter(drop.pase = TRUE,drop.nas = TRUE)
|
||||
})
|
||||
|
||||
# targets::tar_read(df_all_data_formatted) |>
|
||||
# dplyr::filter(mrs_0==0) |>
|
||||
# dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |> events_ready() |>
|
||||
# pase_cutter(drop.pase = TRUE,drop.nas = TRUE) |>
|
||||
# cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
# tbl_regression_standard()
|
||||
|
||||
ls_change <- list(
|
||||
"Univariable"= ls_mrs0_change$std |>
|
||||
dplyr::select(pase_change,dplyr::everything()) |>
|
||||
splitdf4uvcox(include=c("time","status")) |>
|
||||
purrr::map(\(.x){
|
||||
.x |> tbl_regression_standard()
|
||||
}) |>
|
||||
gtsummary::tbl_stack(),
|
||||
"Multivariable" = ls_mrs0_change$std |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard() |> gtsummary::add_glance_source_note(),
|
||||
"Multivariable Imputed"= ls_mrs0_change$imp |>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change") |>
|
||||
tbl_regression_standard()
|
||||
) |> purrr::map(\(.x){
|
||||
.x|>
|
||||
gtsummary::modify_table_styling(column = p.value,
|
||||
hide=TRUE)
|
||||
}) |> tbl_merged_named()
|
||||
|
||||
ls_change
|
||||
#| eval: false
|
||||
coll <- list(
|
||||
mrs0_0=ls_mrs0$std|>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change"),
|
||||
pase_change_mrs0 = ls_mrs0_change$std|>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change"),
|
||||
pase_change=df |>
|
||||
get_vars(vars.groups =c("clin","lifestyle.events","ses", "assess.events")) |>
|
||||
dplyr::filter(event.include) |>
|
||||
dplyr::select(-tidyselect::all_of("event.include")) |>
|
||||
pase_cutter(drop.pase = TRUE,drop.nas = TRUE)|>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_change"),
|
||||
prestroke_pase=df |>
|
||||
pase_cutter(drop.nas = FALSE) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle.events", "ses", "assess.pred", "quartiles"), vars.vec = c("inc_time",
|
||||
"time",
|
||||
"status")) |>
|
||||
dplyr::mutate(time = time + inc_time / 365) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0", "pase_4", "pase_change", "inc_time", "event.include", "pase_4_quartile")))|>
|
||||
cox_regression(all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_0_quartile")) |>
|
||||
purrr::map(performance::check_collinearity)
|
||||
|
||||
coll |> purrr::imap(\(.x,.i){
|
||||
.x |> dplyr::as_tibble() |> gt::gt() |> gt::tab_header(.i)|>
|
||||
gt::gtsave(filename = here::here(glue::glue("out/coll_{.i}.docx")))
|
||||
})
|
||||
|
||||
|
||||
|
||||
# Code from: pa_event_plots.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
# targets::tar_read(plot_events_survival_smooth)
|
||||
p1 <- targets::tar_read(df_event_data) |>
|
||||
events_dataset(impute = FALSE) |>
|
||||
dplyr::mutate(pase_change = factor(pase_change,
|
||||
levels = c("Persistently high", "Decrease", "Increase", "Persistently low")),
|
||||
pase_change = dplyr::recode(pase_change,
|
||||
"Persistently high"="Consistently above lowest",
|
||||
"Decrease"="Decrease to lowest",
|
||||
"Increase"="Increase from lowest",
|
||||
"Persistently low"="Consistently lowest")
|
||||
) |>
|
||||
cox_regression() |>
|
||||
plot_survival_smooth(line.w = 1) +
|
||||
ggplot2::labs(
|
||||
fill = "PA level change group",
|
||||
color = "PA level change group",
|
||||
linetype = "PA level change group"
|
||||
) +
|
||||
ggplot2::scale_x_continuous(limits = c(0, 9.5), breaks = c(0, 3, 6, 9))
|
||||
|
||||
|
||||
ggplot2::ggsave(here::here("out/smooth_surv.png"),
|
||||
p1,
|
||||
dpi = 600,
|
||||
units = "cm",
|
||||
height = 8,
|
||||
width = 15)
|
||||
p1
|
||||
surv.data <- targets::tar_read(df_event_data) |>
|
||||
events_dataset(impute = FALSE) |>
|
||||
cox_regression(all.vars = FALSE) |> # Minimal model to just give risk table
|
||||
ggsurvfit::survfit2() |>
|
||||
ggsurvfit::tidy_survfit(times = c(0, 3, 6, 9))
|
||||
|
||||
|
||||
risk_event <- c("n.risk", "cum.event") |>
|
||||
purrr::map2(c("Numbers at risk", "Events"), \(.x, .y){
|
||||
surv.data |>
|
||||
tidyr::pivot_wider(id_cols = strata, names_from = time, values_from = {{ .x }}) |>
|
||||
mask_micro_table(col.sel = -strata) |> # Masking columns
|
||||
tidyr::pivot_longer(cols = -strata) |>
|
||||
setNames(c("strata", "time", .x)) |>
|
||||
dplyr::mutate(dplyr::across(time, ~ as.numeric(.x))) |>
|
||||
dplyr::mutate(strata = factor(strata, levels = rev(c("Persistently high", "Decrease", "Increase", "Persistently low")))) |>
|
||||
ggplot2::ggplot(ggplot2::aes(x = time, y = strata, label = get(.x))) +
|
||||
ggplot2::geom_text() +
|
||||
ggplot2::labs(y = NULL, title = .y) +
|
||||
ggplot2::theme_minimal() +
|
||||
ggsurvfit::theme_risktable_default()
|
||||
})
|
||||
|
||||
p2 <- ggsurvfit::ggsurvfit_align_plots(list(p1, risk_event[1]) |> purrr::list_flatten()) |>
|
||||
patchwork::wrap_plots(ncol = 1, heights = c(2, 1), guides = "collect")
|
||||
|
||||
ggplot2::ggsave(here::here("out/smooth_surv_tables.png"),
|
||||
p2,
|
||||
dpi = 600,
|
||||
units = "cm",
|
||||
height = 9,
|
||||
width = 15)
|
||||
p2
|
||||
#| include: false
|
||||
targets::tar_read(df_event_data) |>
|
||||
events_dataset(impute = FALSE) |>
|
||||
dplyr::mutate(pase_change = factor(pase_change, levels = c("Persistently high", "Decrease", "Increase", "Persistently low"))) |>
|
||||
cox_regression(all.vars = FALSE) |> # Minimal model to just give risk table
|
||||
ggsurvfit::survfit2() |>
|
||||
ggsurvfit::ggsurvfit() +
|
||||
ggplot2::scale_y_continuous(
|
||||
limits = c(0, 1.02),
|
||||
breaks = seq(0, 1, .25),
|
||||
labels = scales::percent,
|
||||
expand = c(0.01, 0)
|
||||
) +
|
||||
ggplot2::scale_x_continuous(breaks = c(0, 4, 8.5), expand = c(0.02, 0)) +
|
||||
ggsurvfit::add_risktable()
|
||||
#| include: false
|
||||
targets::tar_read(df_event_data_small) |>
|
||||
events_dataset(impute = FALSE) |>
|
||||
dplyr::mutate(pase_change = factor(pase_change, levels = c("Persistently high", "Decrease", "Increase", "Persistently low"))) |>
|
||||
cox_regression() |>
|
||||
plot_survival_smooth() +
|
||||
ggplot2::labs(
|
||||
fill = "PA change group",
|
||||
color = "PA change group",
|
||||
linetype = "PA change group"
|
||||
)
|
||||
#| include: false
|
||||
targets::tar_read(df_event_data) |>
|
||||
events_dataset(impute = FALSE) |>
|
||||
dplyr::mutate(pase_change = factor(pase_change, levels = c("Persistently high", "Decrease", "Increase", "Persistently low"))) |>
|
||||
cox_regression() |>
|
||||
plot_survival_smooth() +
|
||||
ggplot2::labs(
|
||||
fill = "PA change group",
|
||||
color = "PA change group",
|
||||
linetype = "PA change group"
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Code from: pa_events_analyses.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
#| include: false
|
||||
list("Univariate"=targets::tar_read(tbl_events_cox_regression_uv),
|
||||
"Multivariate"=targets::tar_read(tbl_events_cox_regression),
|
||||
"Imputed Multivariate"=targets::tar_read(tbl_events_mids_cox_regression)) |>
|
||||
# purrr::map(gtsummary::modify_table_styling,column=p.value,hide=TRUE) |>
|
||||
purrr::map(gtsummary::bold_p) |>
|
||||
tbl_merged_named()
|
||||
#| include: true
|
||||
list("Univariate"=targets::tar_read(tbl_events_cox_regression_uv),
|
||||
"Multivariate"=targets::tar_read(tbl_events_cox_regression),
|
||||
"Imputed Multivariate"=targets::tar_read(tbl_events_mids_cox_regression)) |>
|
||||
purrr::map(gtsummary::modify_table_styling,column=p.value,hide=TRUE) |>
|
||||
tbl_merged_named()
|
||||
#| echo: true
|
||||
targets::tar_read(df_event_data) |>
|
||||
# dplyr::select(-reg_bmi) |>
|
||||
na.omit() |>
|
||||
nrow()
|
||||
#| include: false
|
||||
targets::tar_read(tbl_events_cox_regression_small)
|
||||
|
||||
targets::tar_read(df_event_data_small)
|
||||
#| include: false
|
||||
targets::tar_read(tbl_events_mids_cox_regression)
|
||||
targets::tar_read("df_all_data_formatted") |>
|
||||
events_ready() |>
|
||||
dplyr::filter(!is.na(pase_0),!is.na(pase_4)) |>
|
||||
(\(data){
|
||||
c("pase_0","pase_4") |>
|
||||
purrr::map(\(exp){
|
||||
with(data,survival::coxph(as.formula(glue::glue("survival::Surv(time, status)~{exp}")))) |>
|
||||
gtsummary::tbl_regression(exponentiate=TRUE)|>
|
||||
fix_labels()
|
||||
})
|
||||
})() |>
|
||||
gtsummary::tbl_stack()
|
||||
targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = TRUE) |>
|
||||
events_ready(v.groups=c("clin","lifestyle.events","ses", "assess.events","quartiles")) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0","pase_4","pase_change"))) |>
|
||||
(\(data){
|
||||
c("pase_0_quartile","pase_4_quartile") |>
|
||||
purrr::map(\(exp){
|
||||
list("Univariable"=cox_regression(data=data,all.vars = FALSE, use.strata = FALSE, outcome.var = exp),
|
||||
"Multivariable"=cox_regression(data=data,all.vars = TRUE, use.strata = FALSE, outcome.var = exp)) |>
|
||||
purrr::map(\(.x){
|
||||
.x |> gtsummary::tbl_regression(exponentiate=TRUE)|>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
})
|
||||
})() |>
|
||||
gtsummary::tbl_stack()
|
||||
targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = TRUE) |>
|
||||
get_vars(vars.groups = c("clin","lifestyle.events","ses", "assess.events","quartiles"),vars.vec = c("inc_time")) |>
|
||||
dplyr::mutate(time=time+inc_time/365) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0","pase_4","pase_change","inc_time","event.include","pase_4_quartile"))) |>
|
||||
(\(data){
|
||||
list(
|
||||
with(data,survival::coxph(as.formula(glue::glue("survival::Surv(time, status)~{exp}")))) |>
|
||||
gtsummary::tbl_regression(exponentiate=TRUE)|>
|
||||
fix_labels() |> gtsummary::add_glance_source_note()
|
||||
)
|
||||
})() |>
|
||||
gtsummary::tbl_stack()
|
||||
|
||||
|
||||
|
||||
# Code from: pa_events_summaries.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
#| include: false
|
||||
targets::tar_read(tbl_events_summary)
|
||||
#| include: true
|
||||
targets::tar_read(tbl_events_summary) |> mask_micro_summary(micro.n = 5)
|
||||
#| include: false
|
||||
ls <- targets::tar_read(df_event_data)|>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::select(-tidyselect::all_of(c("status", "time"))) |>
|
||||
dplyr::filter(!is.na(pase_change)) |>
|
||||
labelling_data() |>
|
||||
gtsummary::tbl_summary(
|
||||
missing = "ifany",
|
||||
by = pase_change,
|
||||
# value = list(where(is.logical) ~ TRUE),
|
||||
missing_text = "Missing"
|
||||
) |>
|
||||
gtsummary::add_overall() |>
|
||||
gtsummary::add_n()
|
||||
|
||||
ls |> add_missing_stats() |> mask_micro_summary(micro.n = 5)
|
||||
targets::tar_read(df_event_data)|>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::select(pase_change, time) |>
|
||||
dplyr::filter(!is.na(pase_change)) |>
|
||||
labelling_data() |>
|
||||
gtsummary::tbl_summary(
|
||||
missing = "ifany",
|
||||
by = pase_change,
|
||||
type = gtsummary::all_continuous() ~ "continuous2",
|
||||
statistic = list(gtsummary::all_continuous() ~ c("{median} ({p25}, {p75})","{mean} ({sd})")),
|
||||
# value = list(where(is.logical) ~ TRUE),
|
||||
|
||||
missing_text = "Missing"
|
||||
) |>
|
||||
gtsummary::add_overall()
|
||||
#| include: true
|
||||
targets::tar_read(df_all_data_formatted) |>
|
||||
(\(.x)summary(.x$pase_0))()
|
||||
|
||||
# targets::tar_read(df_all_data_formatted) |>
|
||||
# dplyr::filter(!is.na(pase_0),!is.na(pase_4))|>
|
||||
# (\(.x)summary(.x$pase_0))()
|
||||
#| include: false
|
||||
targets::tar_read(df_all_data_formatted) |>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::select(mrs_4, pase_change) |>
|
||||
dplyr::mutate(pase_change = forcats::fct_relevel(pase_change, c("Persistent high", "Increase", "Decrease", "Persistent low"))) |>
|
||||
na.omit() |>
|
||||
(\(.x){
|
||||
table(mrs = .x$mrs_4, pase = .x$pase_change)
|
||||
})() |>
|
||||
rankinPlot::grottaBar(groupName = "pase", scoreName = "mrs")
|
||||
targets::tar_read(df_event_data)|>
|
||||
pase_cutter(drop.pase = FALSE) |>
|
||||
dplyr::filter(!is.na(pase_change))|>
|
||||
dplyr::select(pase_0,pase_4) |>
|
||||
labelling_data() |>
|
||||
gtsummary::tbl_summary()
|
||||
targets::tar_read(df_all_data_formatted)|>
|
||||
pase_cutter(drop.pase = FALSE) |>
|
||||
dplyr::filter(!is.na(pase_change))|>
|
||||
dplyr::count(pase_0_quartile,pase_4_quartile) |>
|
||||
write_csv(here::here("out/event_sankey_data.csv"))
|
||||
ds <- targets::tar_read(df_all_data_formatted) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle", "ses", "assess.events", "extra")) |>
|
||||
dplyr::select(-time, -status, -soc_status) |>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
labelling_data()
|
||||
|
||||
ls <- list(
|
||||
pase_out = ds |>
|
||||
dplyr::mutate(event.filter = factor(
|
||||
dplyr::case_when(is.na(pase_change) ~ "pase_incomplete",
|
||||
!event.include ~ "early_event",
|
||||
.default = "included"
|
||||
),
|
||||
levels = c("pase_incomplete", "early_event", "included")
|
||||
)),
|
||||
event_out = ds |>
|
||||
dplyr::mutate(event.filter = factor(
|
||||
dplyr::case_when(!event.include ~ "early_event",
|
||||
is.na(pase_change) ~ "pase_incomplete",
|
||||
.default = "included"
|
||||
),
|
||||
levels = c("early_event", "pase_incomplete", "included")
|
||||
))
|
||||
) |>
|
||||
purrr::map(dplyr::select, -event.include, -pase_change, -event)
|
||||
|
||||
ls_tbl <- ls |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
dplyr::filter(event.filter != "pase_incomplete") |>
|
||||
dplyr::mutate(event.filter = factor(event.filter))
|
||||
}) |>
|
||||
(\(.x) list(.x, purrr::pluck(ls, 1) |> dplyr::mutate(event.filter = event.filter == "included")))() |>
|
||||
purrr::list_flatten()
|
||||
#| include: false
|
||||
ls_tbl |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
gtsummary::tbl_summary(
|
||||
by = event.filter,
|
||||
missing = "ifany"
|
||||
) |>
|
||||
gtsummary::add_p()
|
||||
}) |>
|
||||
(\(.x)gtsummary::tbl_merge(.x, c(names(.x)[1:2], "all_out")))()
|
||||
targets::tar_read(df_all_data_formatted) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle", "ses", "assess.events", "extra", "assess.pred")) |>
|
||||
dplyr::select(-time,
|
||||
# -status,
|
||||
-soc_status) |>
|
||||
pase_cutter(drop.pase = FALSE) |>
|
||||
labelling_data() |>
|
||||
dplyr::mutate(event.filter = factor(
|
||||
dplyr::case_when(
|
||||
!event.include | is.na(pase_change) ~ "excluded",
|
||||
.default = "included"
|
||||
)
|
||||
)) |>
|
||||
dplyr::select(-who_4, -mdi_4, -mrs_4_above1, -mfi_gen_4) |>
|
||||
gtsummary::tbl_summary(
|
||||
by = event.filter,
|
||||
missing = "ifany"
|
||||
) |>
|
||||
gtsummary::add_p()
|
||||
ds |>
|
||||
dplyr::mutate(pase_incomplete=is.na(pase_change),
|
||||
excluded=pase_incomplete | !event.include,
|
||||
early_event=!event.include) |>
|
||||
dplyr::select(early_event,pase_incomplete,excluded) |>
|
||||
gtsummary::tbl_summary(by=excluded)
|
||||
#| include: true
|
||||
ls_tbl |>
|
||||
purrr::pluck(3) |>
|
||||
dplyr::select(-who_4, -mdi_4, -mrs_4_above1, -mfi_gen_4) |>
|
||||
(\(.x){
|
||||
.x |>
|
||||
gtsummary::tbl_summary(
|
||||
by = event.filter,
|
||||
missing = "no"
|
||||
) |>
|
||||
gtsummary::add_p()
|
||||
})() |> mask_micro_summary(micro.n = 5)
|
||||
#| include: true
|
||||
targets::tar_read(df_event_data)|>
|
||||
pase_cutter(drop.pase = FALSE)|>
|
||||
dplyr::filter(!is.na(pase_change)) |>
|
||||
dplyr::select(-time, -status, -pase_0_quartile, -pase_4_quartile, -pase_change) |>
|
||||
labelling_data() |>
|
||||
dplyr::mutate(reg_female=ifelse(reg_female,"Female","Male")) |>
|
||||
gtsummary::tbl_summary(
|
||||
missing = "ifany",
|
||||
by = reg_female,
|
||||
value = list(where(is.logical) ~ TRUE)
|
||||
)|> gtsummary::add_p() |>
|
||||
mask_micro_summary()
|
||||
#| include: false
|
||||
events <- targets::tar_read(ls_all_events) |>
|
||||
dplyr::bind_rows() |>
|
||||
dplyr::left_join(targets::tar_read(df_all_data_formatted) |>
|
||||
dplyr::select(c("event.include", "rdate", "enddate", "PNR")), by = c("CPR" = "PNR")) |>
|
||||
dplyr::mutate(
|
||||
date.event = as.Date(date.event),
|
||||
event.trial = !date.event > enddate,
|
||||
event.itt = !date.event > (lubridate::dmonths(6) + rdate)
|
||||
) |>
|
||||
dplyr::mutate(event.type = dplyr::if_else(grepl("^death", event.type), "death", event.type))
|
||||
|
||||
ls <- list(
|
||||
# Events during inclusion and during first 6 months after inclusion (Intention to treat)
|
||||
events |>
|
||||
dplyr::select(event.type, event.trial, event.itt) |>
|
||||
tidyr::pivot_longer(cols = c("event.trial", "event.itt")) |>
|
||||
dplyr::filter(value) |>
|
||||
dplyr::select(-value) |>
|
||||
gtsummary::tbl_summary(by = name),
|
||||
|
||||
# All registred events
|
||||
events |>
|
||||
dplyr::select(event.type) |>
|
||||
gtsummary::tbl_summary(),
|
||||
|
||||
# All events in the selected group
|
||||
events |>
|
||||
dplyr::select(event.type, event.include) |>
|
||||
# tidyr::pivot_longer(cols = c("event.trial","event.itt")) |>
|
||||
dplyr::filter(event.include) |>
|
||||
dplyr::select(-event.include) |>
|
||||
gtsummary::tbl_summary(),
|
||||
|
||||
# All considered events (first event)
|
||||
targets::tar_read(df_events_deaths)|>
|
||||
dplyr::mutate(event.type = dplyr::if_else(grepl("^death", event.type), "death", event.type)) |>
|
||||
dplyr::select(event.type) |>
|
||||
gtsummary::tbl_summary(),
|
||||
|
||||
# All included events (first event)
|
||||
targets::tar_read(df_all_data_formatted)|>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::filter(!is.na(pase_change))|>
|
||||
dplyr::filter(event.include) |>
|
||||
# dplyr::select(-event.include)|>
|
||||
dplyr::mutate(event = dplyr::if_else(grepl("^death", event), "death", event)) |>
|
||||
dplyr::select(event) |>
|
||||
dplyr::filter(!is.na(event)) |>
|
||||
gtsummary::tbl_summary()
|
||||
) |>
|
||||
setNames(c("During trial", "All events", "Selected events", "Considered", "Included"))
|
||||
|
||||
ls[4] |>
|
||||
purrr::map(\(.x) .x |>
|
||||
mask_micro_summary(micro.n = 5)) |>
|
||||
tbl_merged_named()
|
||||
targets::tar_read(df_all_data_formatted)|>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::filter(!is.na(pase_change))|>
|
||||
dplyr::filter(event.include) |>
|
||||
# dplyr::select(-event.include)|>
|
||||
dplyr::mutate(event = dplyr::case_when(grepl("^death", event)~"Mors",
|
||||
grepl("^DI6", event)~ "DI61-4",
|
||||
.default = event)) |>
|
||||
dplyr::select(event) |>
|
||||
dplyr::filter(!is.na(event)) |>
|
||||
gtsummary::tbl_summary() |> mask_micro_summary(micro.n = 5)
|
||||
targets::tar_read(df_event_data) |>
|
||||
pase_cutter(drop.pase = TRUE) |>
|
||||
dplyr::filter(!is.na(pase_change)) |>
|
||||
events_table(by="pase_change")
|
||||
|
||||
|
||||
|
||||
# Code from: sex_events.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
|
||||
df <- targets::tar_read(df_all_data_formatted) |>
|
||||
get_vars(vars.groups = c("clin","lifestyle.events","ses", "ssri")) |>
|
||||
dplyr::rename(status=status.all,
|
||||
time=time.all)
|
||||
df |>
|
||||
pase_cutter(drop.nas = TRUE,drop.pase = TRUE) |>
|
||||
dplyr::mutate(reg_female=factor(ifelse(reg_female,"Female","Male"))) |>
|
||||
(\(.x) {
|
||||
split(.x, .x$reg_female)
|
||||
})() |> lapply(\(.x) {
|
||||
ls <- list("Univariate"=.x |> dplyr::select(-reg_female,-rtreat) |>
|
||||
standard_multi_cox_table(all.vars = FALSE) |> gtsummary::add_nevent(),
|
||||
"Multivariate"=.x |> dplyr::select(-reg_female,-rtreat) |>
|
||||
standard_multi_cox_table(all.vars = TRUE) |> gtsummary::add_nevent())|>
|
||||
purrr::map(gtsummary::bold_p) |>
|
||||
tbl_merged_named()
|
||||
ls |>
|
||||
gtsummary::modify_table_body(~filter(.x, variable == "pase_change"))
|
||||
}) |>
|
||||
(\(.x) {
|
||||
gtsummary::tbl_stack(.x,group_header=names(.x))
|
||||
})()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Code from: ssri_events.qmd
|
||||
targets::tar_config_set(store = here::here("_targets"))
|
||||
source(here::here("R/functions.R"))
|
||||
source(here::here("R/glmnet-reg.R"))
|
||||
library(targets)
|
||||
library(tidyverse)
|
||||
|
||||
df <- targets::tar_read(df_all_data_formatted) |>
|
||||
get_vars(vars.groups = c("clin","lifestyle.events","ses", "ssri")) |>
|
||||
dplyr::rename(status=status.all,
|
||||
time=time.all)
|
||||
df |>
|
||||
dplyr::select(#-event.include,
|
||||
-rtreat_placebo)|>
|
||||
labelling_data() |>
|
||||
gtsummary::tbl_summary(by=rtreat) |>
|
||||
gtsummary::add_overall() #|>
|
||||
# mask_micro_summary()
|
||||
df |>
|
||||
dplyr::select(
|
||||
-rtreat_placebo,
|
||||
-pase_4#,
|
||||
# -reg_bmi
|
||||
) |>
|
||||
cox_regression(outcome.var = "rtreat",use.strata = FALSE) |>
|
||||
gtsummary::tbl_regression(exponentiate = TRUE,
|
||||
add_estimate_to_reference_rows = TRUE,
|
||||
show_single_row = where(is.logical)) |>
|
||||
gtsummary::bold_p() |>
|
||||
fix_labels()
|
||||
df |>
|
||||
dplyr::select(-rtreat_placebo) |>
|
||||
cox_regression(outcome.var = "rtreat",all.vars = FALSE, use.strata = TRUE,include_formula = TRUE) |>
|
||||
plot_survival_smooth()
|
||||
df |>
|
||||
pase_cutter(drop.nas = TRUE,drop.pase = TRUE) |>
|
||||
(\(.x) {
|
||||
split(.x, .x$rtreat)
|
||||
})() |> lapply(\(.x) {
|
||||
ls <- list("Univariate"=.x |> dplyr::select(-rtreat_placebo, -rtreat) |>
|
||||
standard_multi_cox_table(all.vars = FALSE),
|
||||
"Multivariate"=.x |> dplyr::select(-rtreat_placebo, -rtreat) |>
|
||||
standard_multi_cox_table(all.vars = TRUE))|>
|
||||
purrr::map(gtsummary::bold_p) |>
|
||||
tbl_merged_named()
|
||||
ls |>
|
||||
gtsummary::modify_table_body(~filter(.x, variable == "pase_change"))
|
||||
}) |> tbl_stack_named()
|
||||
# gtsummary::tbl_stack(group_header=levels(factor(df$rtreat)))
|
||||
|
||||
|
||||
|
||||
BIN
2 Longterm/260315/cont_pase_sens.docx
Executable file
BIN
2 Longterm/260315/events_type_sens.docx
Executable file
4131
2 Longterm/260315/functions.R
Executable file
340
2 Longterm/260315/glmnet-reg.R
Executable file
|
|
@ -0,0 +1,340 @@
|
|||
## ItMLiHSmar2022
|
||||
## regular_fun.R, child script
|
||||
## Regularisation model building function
|
||||
## Andreas Gammelgaard Damsbo, agdamsbo@clin.au.dk
|
||||
##
|
||||
## Now modified to use in publication
|
||||
##
|
||||
|
||||
regular_fun <- function(X, y, K, lambdas, alpha) {
|
||||
n <- nrow(X)
|
||||
set.seed(321)
|
||||
|
||||
# Using caret function to ensure both levels represented in all folds
|
||||
c <- caret::createFolds(y = y, k = K, list = FALSE, returnTrain = TRUE)
|
||||
|
||||
B <- yhatTestProbKeep <- list()
|
||||
accTrain <- accTest <- err_train <- err_test <- auc_train <- auc_test <- matrix(nrow = K, ncol = length(lambdas))
|
||||
|
||||
TrainProb <- TestProb <- list()
|
||||
|
||||
catinfo <- levels(y)
|
||||
|
||||
cMatTrain <- cMatTest <- table(true = factor(c(0, 0), levels = catinfo), pred = factor(c(0, 0), levels = catinfo))
|
||||
|
||||
|
||||
## Iterate over partitions
|
||||
for (idx1 in 1:K) {
|
||||
# Status
|
||||
cat("Processing fold", idx1, "of", K, "\n")
|
||||
|
||||
# idx1=1
|
||||
# Get training- and test sets
|
||||
I_train <- c != idx1 ## Creating selection vector of TRUE/FALSE
|
||||
I_test <- !I_train
|
||||
|
||||
Xtrain <- X[I_train, ]
|
||||
ytrain <- y[I_train]
|
||||
Xtest <- X[I_test, ]
|
||||
ytest <- y[I_test]
|
||||
|
||||
|
||||
## Model matrices for glmnet
|
||||
## Using the complicated approach not to include first level.
|
||||
# Xmat.train<-model.matrix(~ .-1, data=Xtrain,
|
||||
# contrasts.arg = lapply(Xtrain[,sapply(Xtrain, is.factor)],
|
||||
# contrasts, contrasts=T))
|
||||
# Xmat.test<-model.matrix(~ .-1, data=Xtest,
|
||||
# contrasts.arg = lapply(Xtest[,sapply(Xtest, is.factor)],
|
||||
# contrasts, contrasts=T))
|
||||
|
||||
# Xmat.train<-model.matrix(~.-1,Xtrain)
|
||||
# Xmat.test<-model.matrix(~.-1,Xtest)
|
||||
|
||||
# Weights
|
||||
ytrain_weight <- as.vector(1 - (table(ytrain)[ytrain] / length(ytrain)))
|
||||
# ytest_weight<-as.vector(1 / (table(ytest)[ytest] / length(ytest)))
|
||||
|
||||
# Fit regularized linear regression model
|
||||
mod <- glmnet::glmnet(Xtrain, ytrain,
|
||||
alpha = alpha, ## Alpha = 1 for lasso
|
||||
lambda = lambdas, ## Setting lambdas
|
||||
standardize = TRUE, ## Scales and centers
|
||||
weights = ytrain_weight,
|
||||
family = "binomial"
|
||||
)
|
||||
|
||||
# Keep coefficients for plot
|
||||
B[[idx1]] <- as.matrix(coef(mod))
|
||||
|
||||
# TrainProb[[idx1]] <- list()
|
||||
TestProb[[idx1]] <- list()
|
||||
|
||||
# Iterate over regularization strengths to compute training- and test
|
||||
# errors for individual regularization strengths.
|
||||
for (idx2 in 1:length(lambdas)) {
|
||||
# idx2=1
|
||||
|
||||
# Predict
|
||||
yhatTrainProb <- predict(mod,
|
||||
s = lambdas[idx2],
|
||||
newx = data.matrix(Xtrain),
|
||||
type = "response"
|
||||
)
|
||||
|
||||
yhatTestProb <- predict(mod,
|
||||
s = lambdas[idx2],
|
||||
newx = data.matrix(Xtest),
|
||||
type = "response"
|
||||
)
|
||||
|
||||
# Compute training and test error
|
||||
yhatTrain <- round(yhatTrainProb)
|
||||
yhatTest <- round(yhatTestProb)
|
||||
|
||||
TestProb[[idx1]][[idx2]] <- dplyr::bind_cols(data.matrix(Xtest),y=ytest,pred=yhatTestProb,.name_repair = "unique_quiet")
|
||||
|
||||
# Make predictions categorical again (instead of 0/1 coding)
|
||||
yhatTrainCat <- factor(round(yhatTrainProb), levels = c("0", "1"), labels = catinfo, ordered = TRUE)
|
||||
yhatTestCat <- factor(round(yhatTestProb), levels = c("0", "1"), labels = catinfo, ordered = TRUE)
|
||||
|
||||
# Evaluate classifier performance
|
||||
# Accuracy
|
||||
# accTrain[idx1,idx2] <- sum(yhatTrainCat==ytrain)/length(ytrain)
|
||||
# accTest [idx1,idx2] <- sum(yhatTestCat==ytest)/length(ytest)
|
||||
# #
|
||||
# # Error rate
|
||||
# err_train[idx1,idx2] = 1 - accTrain[idx1,idx2]
|
||||
# err_test [idx1,idx2] = 1 - accTest[idx1,idx2]
|
||||
|
||||
# AUROC
|
||||
suppressMessages(
|
||||
auc_train[idx1, idx2] <- pROC::auc(ytrain, yhatTrainCat)
|
||||
)
|
||||
suppressMessages(
|
||||
auc_test[idx1, idx2] <- pROC::auc(ytest, yhatTestCat)
|
||||
)
|
||||
|
||||
# Compute confusion matrices
|
||||
cMatTrain <- cMatTrain + table(true = ytrain, pred = yhatTrainCat)
|
||||
cMatTest <- cMatTest + table(true = ytest, pred = yhatTestCat)
|
||||
}
|
||||
}
|
||||
list(mod = mod, B = B, auc_train = auc_train, auc_test = auc_test, cMatTrain = cMatTrain, cMatTest = cMatTest,
|
||||
TrainProb=TrainProb,
|
||||
TestProb=TestProb)
|
||||
}
|
||||
|
||||
|
||||
## ItMLiHSmar2022
|
||||
## regularisation_steps.R, child script
|
||||
## Regularised model building and analysation for assignment
|
||||
## Andreas Gammelgaard Damsbo, agdamsbo@clin.au.dk
|
||||
##
|
||||
## Now modified to use in publication
|
||||
##
|
||||
|
||||
|
||||
|
||||
#' Title
|
||||
#'
|
||||
#' @param data
|
||||
#' @param outcome.var
|
||||
#' @param weighted
|
||||
#'
|
||||
#' @return
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' data <- targets::tar_read(df_pred_data) |>
|
||||
#' pred_ls_split(excluded.vars = "reg_bmi")
|
||||
#'
|
||||
#' data <- data[[1]]
|
||||
#' mod <- data |> regularisation_steps(auto.l=TRUE)
|
||||
regularisation_steps <- function(data, outcome.var = "pase_bin", weighted = FALSE, auto.l = FALSE) {
|
||||
n <- nrow(data)
|
||||
|
||||
y <- data |> dplyr::select({{ outcome.var }})
|
||||
X <- data |> dplyr::select(-{{ outcome.var }})
|
||||
|
||||
## ====================================================================
|
||||
## Step 0: data import and wrangling
|
||||
## ====================================================================
|
||||
|
||||
# setwd("/Users/au301842/PhysicalActivityandStrokeOutcome/1 PA Decline/")
|
||||
|
||||
# source("data_format.R")
|
||||
y1 <- factor(as.integer(y[[1]])) ## Outcome is required to be factor of 0 or 1.
|
||||
# summary(y1)
|
||||
|
||||
## ====================================================================
|
||||
## Step 1: settings
|
||||
## ====================================================================
|
||||
|
||||
## Folds
|
||||
K <- 10
|
||||
set.seed(3)
|
||||
c <- caret::createFolds(
|
||||
y = y1,
|
||||
k = K,
|
||||
list = FALSE,
|
||||
returnTrain = TRUE
|
||||
) # Fold IDs for tuning
|
||||
|
||||
## Defining tuning parameters
|
||||
if (auto.l){
|
||||
lambdas <- NULL
|
||||
} else {
|
||||
lambdas <- 2^seq(-10, 20, 1)
|
||||
}
|
||||
|
||||
alphas <- seq(0, 1, .1)
|
||||
|
||||
## Weights for models
|
||||
if (weighted) {
|
||||
wght <- as.vector(1 - (table(y1)[y1] / length(y1)))
|
||||
} else {
|
||||
wght <- rep(1, length(y1))
|
||||
}
|
||||
|
||||
|
||||
## Standardise numeric
|
||||
## Centered and
|
||||
|
||||
|
||||
|
||||
## ====================================================================
|
||||
## Step 2: all cross validations for each alpha
|
||||
## ====================================================================
|
||||
|
||||
# library(furrr)
|
||||
# library(purrr)
|
||||
# library(doMC)
|
||||
# registerDoMC(cores=6)
|
||||
|
||||
future::plan(strategy = "multisession", workers = 2)
|
||||
|
||||
# Nested CVs with analysis for all lambdas for each alpha
|
||||
#
|
||||
set.seed(3)
|
||||
cvs <- furrr::future_map(alphas, .options = furrr::furrr_options(seed = 3), function(a) {
|
||||
glmnet::cv.glmnet(model.matrix(~ . - 1, X),
|
||||
y1,
|
||||
weights = wght,
|
||||
lambda = lambdas,
|
||||
type.measure = "deviance", # This is standard measure and recommended for tuning
|
||||
foldid = c, # Per recommendation the folds are kept for alpha optimisation
|
||||
alpha = a,
|
||||
standardize = TRUE,
|
||||
family = quasibinomial, # Same as binomial, but not as picky
|
||||
keep = TRUE
|
||||
)
|
||||
})
|
||||
|
||||
## ====================================================================
|
||||
# Step 3: optimum lambda for each alpha
|
||||
## ====================================================================
|
||||
|
||||
|
||||
# For each alpha, lambda is chosen for the lowest meassure (deviance)
|
||||
each_alpha <- sapply(seq_along(alphas), function(id) {
|
||||
each_cv <- cvs[[id]]
|
||||
alpha_val <- alphas[id]
|
||||
index_lmin <- match(
|
||||
each_cv$lambda.min,
|
||||
each_cv$lambda
|
||||
)
|
||||
c(
|
||||
lamb = each_cv$lambda.min,
|
||||
alph = alpha_val,
|
||||
cvm = each_cv$cvm[index_lmin]
|
||||
)
|
||||
})
|
||||
|
||||
if (auto.l){
|
||||
# Best (min) lambda
|
||||
best_lamb <- min(each_alpha["lamb", ])
|
||||
|
||||
# Alpha is chosen for best lambda with lowest model deviance, each_alpha["cvm",]
|
||||
best_alph <- each_alpha["alph", ][each_alpha["cvm", ] == min(each_alpha["cvm", ]
|
||||
[each_alpha["lamb", ] %in% best_lamb])]
|
||||
|
||||
# BEst lamb is set to NULL to allow glm.net to use the optimal method, which is bult in.
|
||||
# best_lamb <- NULL
|
||||
|
||||
} else {
|
||||
# Best (min) lambda
|
||||
best_lamb <- min(each_alpha["lamb", ])
|
||||
|
||||
# Alpha is chosen for best lambda with lowest model deviance, each_alpha["cvm",]
|
||||
best_alph <- each_alpha["alph", ][each_alpha["cvm", ] == min(each_alpha["cvm", ]
|
||||
[each_alpha["lamb", ] %in% best_lamb])]
|
||||
}
|
||||
|
||||
|
||||
## https://stackoverflow.com/questions/42007313/plot-an-roc-curve-in-r-with-ggplot2
|
||||
# df_roc <- glmnet::roc.glmnet(cvs[[match(best_alph, alphas)]]$fit.preval, newy = y1)[match(best_lamb, lambdas)]# |> # Plots performance from model with best alpha
|
||||
#
|
||||
# df_roc |> plot_roc_curve()
|
||||
|
||||
## ====================================================================
|
||||
# Step 4: Creating the final model
|
||||
## ====================================================================
|
||||
|
||||
# source(here::here("R/regular_fun.R")) # Custom function
|
||||
optimised_model <- regular_fun(X = X, y = y1, K = K, lambdas = best_lamb, alpha = best_alph)
|
||||
# With lambda and alpha specified, the function is just a k-fold cross-validation wrapper,
|
||||
# but keeps model performance figures from each fold.
|
||||
|
||||
# list2env(optimised_model, .GlobalEnv)
|
||||
# Function outputs a list, which is unwrapped to Env.
|
||||
# See source script for reference.
|
||||
|
||||
## ====================================================================
|
||||
# Step 5: creating table of coefficients for inference
|
||||
## ====================================================================
|
||||
|
||||
# reg_coef_tbl <- optimised_model$B |> purrr::reduce(cbind)
|
||||
|
||||
# Bmatrix <- optimised_model$B |> purrr::reduce(cbind)
|
||||
# Bmedian <- apply(Bmatrix, 1, median)
|
||||
# Bmean <- apply(Bmatrix, 1, mean)
|
||||
#
|
||||
# reg_coef_tbl <- dplyr::tibble(
|
||||
# name = rownames(Bmatrix),
|
||||
# medianX = round(Bmedian, 5),
|
||||
# ORmed = round(exp(Bmedian), 5),
|
||||
# meanX = round(Bmean, 5),
|
||||
# ORmea = round(exp(Bmean), 5)
|
||||
# ) # |>
|
||||
# arrange(desc(abs(medianX)))%>%
|
||||
# gt::gt()
|
||||
|
||||
## ====================================================================
|
||||
# Step 6: plotting predictive performance
|
||||
## ====================================================================
|
||||
|
||||
# reg_cfm <- caret::confusionMatrix(optimised_model$cMatTest)
|
||||
# reg_cfm <- optimised_model$cMatTest
|
||||
# reg_auc_sum <- optimised_model$auc_test[, 1]
|
||||
|
||||
## ====================================================================
|
||||
# Step 7: Packing list to save in loop
|
||||
## ====================================================================
|
||||
|
||||
list(
|
||||
"IncludedN" = n,
|
||||
"model" = optimised_model,
|
||||
"alphas" = alphas,
|
||||
"bestA" = best_alph,
|
||||
"lambdas" = lambdas,
|
||||
"bestL" = best_lamb,
|
||||
# "TestTable" = reg_cfm,
|
||||
# "AUROC" = reg_auc_sum,
|
||||
# "ROC curve" = df_roc,
|
||||
"y1" = y1,
|
||||
"X" = X,
|
||||
"data" = data,
|
||||
"cvs" = cvs
|
||||
)
|
||||
}
|
||||
172
2 Longterm/260315/last_sensitivity.R
Executable file
|
|
@ -0,0 +1,172 @@
|
|||
targets::tar_read("df_all_data_formatted") |>
|
||||
events_ready() |>
|
||||
dplyr::filter(!is.na(pase_0), !is.na(pase_4)) |>
|
||||
(\(data){
|
||||
c("pase_0", "pase_4") |>
|
||||
purrr::map(\(exp){
|
||||
list(
|
||||
"Univariable" = cox_regression(data = data, all.vars = FALSE, use.strata = FALSE, outcome.var = exp),
|
||||
"Multivariable" = cox_regression(data = data, all.vars = TRUE, use.strata = FALSE, outcome.var = exp)
|
||||
) |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
gtsummary::tbl_regression(exponentiate = TRUE) |>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
})
|
||||
})() |>
|
||||
gtsummary::tbl_stack()
|
||||
|
||||
|
||||
targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = TRUE) |>
|
||||
events_ready(v.groups = c("clin", "lifestyle.events", "ses", "assess.events", "quartiles")) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0", "pase_4", "pase_change"))) |>
|
||||
(\(data){
|
||||
c("pase_0_quartile", "pase_4_quartile") |>
|
||||
purrr::map(\(exp){
|
||||
list(
|
||||
"Univariable" = cox_regression(data = data, all.vars = FALSE, use.strata = FALSE, outcome.var = exp),
|
||||
"Multivariable" = cox_regression(data = data, all.vars = TRUE, use.strata = FALSE, outcome.var = exp)
|
||||
) |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
gtsummary::tbl_regression(exponentiate = TRUE) |>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
})
|
||||
})() |>
|
||||
gtsummary::tbl_stack()
|
||||
|
||||
|
||||
targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = TRUE) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle.events", "ses", "assess.events", "quartiles"), vars.vec = c("inc_time")) |>
|
||||
dplyr::mutate(time = time + inc_time / 365) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0", "pase_4", "pase_change", "inc_time", "event.include", "pase_4_quartile"))) |>
|
||||
(\(data){
|
||||
list(
|
||||
"Univariable" = cox_regression(data = data, all.vars = FALSE, use.strata = FALSE, outcome.var = "pase_0_quartile"),
|
||||
"Multivariable" = cox_regression(data = data, all.vars = TRUE, use.strata = FALSE, outcome.var = "pase_0_quartile")
|
||||
) |>
|
||||
purrr::map(\(.x){
|
||||
.x |>
|
||||
gtsummary::tbl_regression(exponentiate = TRUE) |>
|
||||
fix_labels()
|
||||
}) |>
|
||||
tbl_merged_named()
|
||||
})()
|
||||
|
||||
ls_sens <- list(
|
||||
pase_0_all_quartile = list(
|
||||
data = targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = FALSE) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle.events", "ses", "assess.pred", "quartiles"), vars.vec = c("inc_time",
|
||||
"time",
|
||||
"status")) |>
|
||||
dplyr::mutate(time = time + inc_time / 365) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0", "pase_4", "pase_change", "inc_time", "event.include", "pase_4_quartile"))),
|
||||
main.exp = "pase_0_quartile"
|
||||
),
|
||||
# pase_0_all_contin = list(
|
||||
# data = targets::tar_read("df_all_data_formatted") |>
|
||||
# get_vars(vars.groups = c("clin", "lifestyle.events", "ses", "assess.pred", "quartiles"), vars.vec = c("inc_time",
|
||||
# "time",
|
||||
# "status")) |>
|
||||
# dplyr::mutate(time = time + inc_time / 365) |>
|
||||
# dplyr::select(-dplyr::any_of(c("pase_4", "pase_change", "inc_time", "event.include", "pase_0_quartile", "pase_4_quartile"))),
|
||||
# main.exp = "pase_0"
|
||||
# ),
|
||||
pase_0_excl_quartile = list(
|
||||
data = targets::tar_read("df_all_data_formatted") |>
|
||||
pase_cutter(drop.nas = TRUE,drop.pase = FALSE) |>
|
||||
events_ready(v.groups = c("clin", "lifestyle.events", "ses", "assess.pred", "quartiles"), vars.vec = c("inc_time",
|
||||
"time",
|
||||
"status")) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0","pase_4", "pase_change", "inc_time", "event.include", "pase_4_quartile"))),
|
||||
main.exp = "pase_0_quartile"
|
||||
),
|
||||
# pase_0_excl_contin = list(
|
||||
# data = targets::tar_read("df_all_data_formatted") |>
|
||||
# events_ready(v.groups = c("clin", "lifestyle.events", "ses", "assess.pred", "quartiles"), vars.vec = c("inc_time",
|
||||
# "time",
|
||||
# "status")) |>
|
||||
# dplyr::filter(!is.na(pase_0), !is.na(pase_4)) |>
|
||||
# dplyr::select(-pase_4),
|
||||
# main.exp = "pase_0"
|
||||
# ),
|
||||
pase_4_quartile = list(
|
||||
data = targets::tar_read("df_all_data_formatted") |>
|
||||
dplyr::mutate(pase_4_quartile=cut(x = pase_4, breaks = quantile(pase_4, na.rm = TRUE), labels = 1:4, include.lowest = TRUE)) |>
|
||||
get_vars(vars.groups = c("clin", "lifestyle.events", "ses", "assess.events", "quartiles"))|>
|
||||
dplyr::filter(!is.na(pase_4_quartile),event.include) |>
|
||||
dplyr::select(-dplyr::any_of(c("pase_0","pase_4", "pase_change", "inc_time", "event.include", "pase_0_quartile"))),
|
||||
main.exp = "pase_4_quartile"
|
||||
),
|
||||
# pase_4_contin = list(
|
||||
# data = targets::tar_read("df_all_data_formatted") |>
|
||||
# events_ready() |>
|
||||
# dplyr::filter(!is.na(pase_0), !is.na(pase_4)) |>
|
||||
# dplyr::select(-pase_0),
|
||||
# main.exp = "pase_4"
|
||||
# ),
|
||||
pase_4_change_late_cut = list(
|
||||
data = targets::tar_read("df_all_data_formatted") |>
|
||||
events_ready() |>
|
||||
dplyr::filter(!is.na(pase_0), !is.na(pase_4)) |>
|
||||
pase_cutter(drop.pase = TRUE),
|
||||
main.exp = "pase_change"
|
||||
# ),
|
||||
# pase_4_change_earliest_cut = list(
|
||||
# data = targets::tar_read("df_all_data_formatted") |>
|
||||
# pase_cutter(drop.pase = TRUE)|>
|
||||
# events_ready(vars.vec = c("pase_change")) |>
|
||||
# dplyr::filter(!is.na(pase_change)) ,
|
||||
# main.exp = "pase_change"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
f <- function(data, main.exp, ...) {
|
||||
set.seed(3023)
|
||||
imp <- fun_impute(data = data, ignore = main.exp)
|
||||
|
||||
list(
|
||||
"Univariable" = cox_regression(data = data, all.vars = FALSE, use.strata = FALSE, outcome.var = main.exp),
|
||||
"Multivariable" = cox_regression(data = data, all.vars = TRUE, use.strata = FALSE, outcome.var = main.exp),
|
||||
"Multivariable Imputed" = cox_regression(data = imp, all.vars = TRUE, use.strata = FALSE, outcome.var = main.exp)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
ls_out <- purrr::map(ls_sens, \(.x){
|
||||
do.call(f, .x)
|
||||
})
|
||||
|
||||
ls_stack <- ls_out |>
|
||||
purrr::imap(\(.x, .i){
|
||||
list(
|
||||
"Group counts" = ls_sens[[.i]][["data"]] |>
|
||||
dplyr::select(ls_sens[[.i]][["main.exp"]]) |>
|
||||
gtsummary::tbl_summary(statistic = list(gtsummary::all_continuous() ~ "{N_nonmiss} ({p_nonmiss}%)", gtsummary::all_categorical() ~ "{n} ({p}%)")) |>
|
||||
fix_labels(),
|
||||
.x |>
|
||||
lapply(\(.y){
|
||||
.y |>
|
||||
tbl_regression_standard() |>
|
||||
# gtsummary::modify_table_styling(columns = tidyselect::starts_with("p.value"), hide = TRUE) |>
|
||||
gtsummary::remove_row_type(variables = -dplyr::any_of(ls_sens[[.i]][["main.exp"]]), type = "all") |>
|
||||
gtsummary::bold_p()
|
||||
})
|
||||
) |>
|
||||
purrr::list_flatten() |>
|
||||
tbl_merged_named()
|
||||
}) |>
|
||||
tbl_stack_named()
|
||||
|
||||
ls_stack <- ls_stack|> gtsummary::as_gt() |> gt::tab_style(style = gt::cell_text(weight="bold"),locations = gt::cells_row_groups(dplyr::everything()))
|
||||
|
||||
ls_stack |> gt::gtsave(filename = here::here("out/pase_extra_cox2.docx"))
|
||||
BIN
2 Longterm/260315/sex_events.docx
Executable file
BIN
2 Longterm/260315/ssri_events.docx
Executable file
3389
2 Longterm/DDV 240607/functions.R
Executable file
BIN
2 Longterm/DDV 240607/pa_event_plots.docx
Executable file
BIN
2 Longterm/DDV 240607/pa_events_analyses.docx
Executable file
BIN
2 Longterm/DDV 240607/pa_events_summaries.docx
Executable file
BIN
2 Longterm/DDV 240607/smooth_surv.png
Executable file
|
After Width: | Height: | Size: 153 KiB |
BIN
2 Longterm/DDV 240607/smooth_surv_tables.png
Executable file
|
After Width: | Height: | Size: 166 KiB |
BIN
2 Longterm/DDV 240607/~$_events_summaries.docx
Normal file
BIN
2 Longterm/DDV 240814/pa_events_analyses.docx
Executable file
BIN
2 Longterm/DDV 240814/pa_events_summaries.docx
Executable file
BIN
2 Longterm/DDV 240814/smooth_surv.png
Executable file
|
After Width: | Height: | Size: 247 KiB |
BIN
2 Longterm/DDV 240814/smooth_surv_tables.png
Executable file
|
After Width: | Height: | Size: 271 KiB |
17
2 Longterm/DDV 241031/event_sankey_data.csv
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
pase_0_quartile,pase_4_quartile,n
|
||||
1,1,56
|
||||
1,2,35
|
||||
1,3,14
|
||||
1,4,7
|
||||
2,1,38
|
||||
2,2,41
|
||||
2,3,22
|
||||
2,4,22
|
||||
3,1,15
|
||||
3,2,29
|
||||
3,3,46
|
||||
3,4,39
|
||||
4,1,10
|
||||
4,2,16
|
||||
4,3,34
|
||||
4,4,74
|
||||
|
BIN
2 Longterm/DDV 241031/pa_events_analyses.docx
Executable file
BIN
2 Longterm/DDV 241031/pa_events_summaries.docx
Executable file
BIN
2 Longterm/DDV 241031/sens_cox.docx
Executable file
BIN
2 Longterm/DDV 241106/pase_extra_cox.docx
Normal file
BIN
2 Longterm/DDV 241212/coll_mrs0_0.docx
Executable file
BIN
2 Longterm/DDV 241212/coll_pase_change.docx
Executable file
BIN
2 Longterm/DDV 241212/coll_pase_change_mrs0.docx
Executable file
BIN
2 Longterm/DDV 241212/coll_prestroke_pase.docx
Executable file
BIN
2 Longterm/DDV 241212/mrs_sensitivity.docx
Executable file
114
2 Longterm/Project B - DAG.Rmd
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
---
|
||||
title: "Project B - DAG"
|
||||
author: "AGDamsbo"
|
||||
date: "`r Sys.Date()`"
|
||||
output: html_document
|
||||
---
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
```
|
||||
|
||||
# Hypothesis
|
||||
|
||||
```{r}
|
||||
labels_all<-list(rtreat~"Trial treatment",
|
||||
pase_0~"PASE score",
|
||||
age~"Age",
|
||||
sex~"Sex",
|
||||
smoker~"History of smoking",
|
||||
civil~"Cohabitation",
|
||||
diabetes~"Known diabetes",
|
||||
hypertension~"Known hypertension",
|
||||
afli~"Known Atrialfibrillation",
|
||||
ami~"Previos myocardial infarction",
|
||||
tci~"Previos TIA",
|
||||
pad~"Known peripheral artery disease",
|
||||
nihss_0~"Acute NIHSS score",
|
||||
thrombolysis~"Thrombolytic therapy",
|
||||
thrombechtomy~"Endovascular treatment",
|
||||
SES~"Socio economic status",
|
||||
education~"Education",
|
||||
ad_treat~"Anti depression treatment",
|
||||
vasc_event~"Vascular event")
|
||||
```
|
||||
|
||||
```{r}
|
||||
vars <- c(
|
||||
"pase_0",
|
||||
"age",
|
||||
"sex",
|
||||
"civil",
|
||||
"smoker",
|
||||
"rtreat",
|
||||
"alc",
|
||||
"afli",
|
||||
"hypertension",
|
||||
"diabetes",
|
||||
"mrs_0",
|
||||
"nihss_c",
|
||||
"thrombolysis",
|
||||
"pad",
|
||||
"thrombechtomy",
|
||||
"ami",
|
||||
"tci",
|
||||
"compliant",
|
||||
"SES",
|
||||
"education"
|
||||
)
|
||||
```
|
||||
|
||||
```{r}
|
||||
library(ggdag)
|
||||
library(ggplot2)
|
||||
```
|
||||
|
||||
```{r}
|
||||
|
||||
dag <-
|
||||
dagify(
|
||||
vasc_event ~ pase_0 + age + sex + civil + smoker + rtreat + alc + afli +
|
||||
hypertension + diabetes + mrs_0 + nihss_0 + thrombolysis + pad + thrombechtomy +
|
||||
ami + tci + SES + education + ad_treat + svd,
|
||||
pase_0 ~ sex + civil + alc + pad + SES + education + hypertension + diabetes,
|
||||
diabetes ~ civil,
|
||||
svd~hypertension + diabetes + alc,
|
||||
mrs_0 ~ tci + ami + hypertension + diabetes + svd,
|
||||
age ~ smoker+SES+education,
|
||||
civil ~ sex + age + SES + civil,
|
||||
# smoker~ ,
|
||||
alc ~ sex+SES+education,
|
||||
# afli~ ,
|
||||
hypertension~ alc,
|
||||
nihss_0 ~ hypertension + diabetes + pase_0 + age,
|
||||
thrombolysis ~ mrs_0+nihss_0,
|
||||
# pad~ ,
|
||||
thrombechtomy ~ mrs_0+nihss_0,
|
||||
# ami~ ,
|
||||
# tci~ ,
|
||||
# compliant~ ,
|
||||
# SES~ ,
|
||||
# education,
|
||||
ad_treat~education+SES,
|
||||
# labels = labels_all,
|
||||
latent = c("svd"),
|
||||
exposure = "pase_0",
|
||||
outcome = "vasc_event"
|
||||
)
|
||||
```
|
||||
|
||||
```{r}
|
||||
dag |> ggdag(text = TRUE) + theme_dag(6) + geom_dag_edges_arc()
|
||||
```
|
||||
|
||||
```{r}
|
||||
dag |> ggdag_parents("svd")
|
||||
```
|
||||
|
||||
```{r}
|
||||
dag |> ggdag_paths(text = TRUE, shadow = TRUE)
|
||||
```
|
||||
|
||||
```{r}
|
||||
dag |> ggdag_adjustment_set(text = TRUE, shadow = TRUE,stylized = TRUE)
|
||||
```
|
||||
496
2 Longterm/Project-B---DAG.html
Normal file
643
2 Longterm/assigndata.csv
Normal file
|
|
@ -0,0 +1,643 @@
|
|||
"pase_0","age","sex","civil","smoke_ever","rtreat","alc","afli","hypertension","diabetes","mrs_0","nihss_c","thrombolysis","pad","thrombechtomy","ami","tci","pase_6","mrs_1","mfi_gen_1","mfi_phys_1","mfi_act_1","mfi_mot_1","mfi_men_1","mdi_1","who5_score_1"
|
||||
"356.44","76","male","partner","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","yes","no","260.52","0","10","4","4","4","8","6","84"
|
||||
"277","49","male","partner","never","Placebo","guideline","no","no","no","0","4","no","no","no","no","no","113.11","2","12","15","5","6","11","11","64"
|
||||
"192.6","43","male","alone","never","Placebo","guideline","no","yes","yes","0","2","yes","no","no","no","no","123.05","4","12","17","7","4","4","3","76"
|
||||
"30","89","female","alone","ever","Placebo","guideline","yes","no","no","0","3","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"44.14","80","male","partner","ever","Active","guideline","no","no","no","2","4","no","no","no","no","no","115.15","3","16","20","17","10","6","11","64"
|
||||
"128.76","72","male","partner","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"224.84","71","female","partner","ever","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","198.08","1","8","8","12","7","9","1","80"
|
||||
"100","66","female","alone","never","Active","guideline","no","no","no","0","4","no","no","yes","no","no","32.36","4","17","16","12","12","15","14","52"
|
||||
"144.8","64","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","171.84","1","14","13","14","6","14","3","84"
|
||||
"136.8","64","male","partner","never","Placebo","guideline","no","yes","no","0","3","no","yes","no","no","no","9.7","2","10","17","18","9","15","7","36"
|
||||
"134.33","65","female","alone","ever","Placebo","guideline","no","yes","yes","0","2","no","no","no","no","no","178.97","2","10","10","6","4","4","4","80"
|
||||
"118.2","63","male","partner","never","Active","guideline","no","yes","no","0","9","yes","no","no","no","no","33.14","2","4","16","13","9","14","3","48"
|
||||
"99.28","62","male","partner","never","Active","more","no","yes","no","0","1","no","no","no","no","no","209.68","1","15","11","13","12","12","9","48"
|
||||
"101.3","73","male","partner","never","Placebo","more","no","no","no","1","16","yes","no","yes","no","no","34.6","1","14","15","15","12","8","12","0"
|
||||
"75.5","59","female","alone","never","Placebo","guideline","no","no","no","0","5","no","no","no","no","no","123.97","2","20","20","19","4","20","22","44"
|
||||
"81","73","male","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","yes","no","184.6","1","16","15","19","10","9","10","44"
|
||||
"79.08","70","male","partner","never","Active","guideline","yes","no","no","0","5","yes","no","no","no","no","235.75","2","17","14","14",NA,NA,"9","60"
|
||||
"27.2","83","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","81","0","6","7","8","6","4","3","68"
|
||||
"173.25","80","male","partner","ever","Active","guideline","no","yes","no","0","5","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"255.8","63","male","alone","never","Placebo","guideline","no","no","no","0","9","no","no","no","no","no","101.4","1","4","8","8","6","4","5","84"
|
||||
"27.2","82","male","alone","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"309.51","72","male","partner","ever","Placebo","guideline","yes","no","no","1","11","yes","no","no","no","no","486.35","2","11","4","11","6","15","2","80"
|
||||
"199.91","58","female","alone","ever","Active","guideline","no","yes","no","0","0","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"218.09","64","male","partner","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","117.25","0","4","4","5","6","5","1","92"
|
||||
"166.8","49","female","partner","ever","Placebo","guideline","no","no","no","0","5","no","no","no","no","no","183.58","0","5","8","9","7","7","6","76"
|
||||
"25","99","female","alone","ever","Placebo","guideline","yes","no","no","0","8","yes","no","no","no","no","9.03","2","12","16","14","6","7","14","52"
|
||||
"90","79","female","alone","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","yes","yes","116.4","0","16","4","8","4","12","11","96"
|
||||
"232.91","60","male","partner","never","Active","guideline","no","yes","no","0","5","no","no","no","no","no","228.25","2","12","12","12","10","9","9","72"
|
||||
"208.24","51","male","alone","never","Placebo","guideline","no","no","no","0","10","no","no","no","no","no","98.35","2","12","11","10","11","6","4","76"
|
||||
"28.11","77","male","alone","never","Placebo",NA,"yes","yes","no","0","9","no","no","no","no","no","8.6","4","10","14","16","10","9","14","52"
|
||||
"116","54","female","partner","never","Active","guideline","no","yes","no","0","6","no","no","no","no","no","111.28","0",NA,NA,NA,NA,NA,NA,"0"
|
||||
"271.5","71","female","partner","ever","Placebo","guideline","no","yes","no","0","16","yes","no","no","no","no","244.88","3","13","4","5","4","10","10","72"
|
||||
"155.8","67","female","alone","never","Placebo","more","no","yes","no","0","1","no","yes","no","no","no","187.4","0","6","10","9","4","4","0","100"
|
||||
"96.4","31","male","alone","never","Active","guideline","no","no","no","0","5","no","no","no","no","no","81.32","1","4","6","7","6","9","5","92"
|
||||
"88.99","72","female","partner","never","Active","guideline","yes","yes","no","1","5","no","no","no","no","no","106.65","1","11","13","14","4","4","8","64"
|
||||
"78.92","71","female","partner","never","Active","guideline","no","no","no","1","15","yes","no","no","no","no","152.73","0","4","6","6","7","6","4","80"
|
||||
"98.68","75","female","partner","ever","Active","guideline","no","no","no","0","4","no","no","no","no","no","60.83","2","9","11","10","14","6","3","84"
|
||||
"183.3","78","male","partner","never","Active","guideline","no","no","no","0","2","no","no","no","no","no","220.04","1","12","7","9","6","4","1","76"
|
||||
"192.5","74","male","partner","never","Active","guideline","no","no","no","0","3","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"218.05","62","female","partner","ever","Placebo","guideline","no","yes","no","1","3","yes","no","no","no","no","185.18","1","11","13","11","13","11","6","64"
|
||||
"144.7","86","male","partner","ever","Active","guideline","no","yes","no","0","2","yes","no","no","no","no","130.37","1","5","6","9","9","5","5","84"
|
||||
"85","82","male","partner","never","Active","guideline","no","yes","no","0","3","yes","no","no","no","no","62.8","0","20","19","19","16","9","18","48"
|
||||
"168.87","60","female","partner","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no","230.14","2","15","16","11","6","12","14","40"
|
||||
"115.56","63","female","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","168.73","2","13","15","12","13","9","12","60"
|
||||
"126","53","male","partner","never","Placebo","guideline","no","no","no","0","3","yes","no","no","no","no","136","1","17","8","8",NA,"14","6","92"
|
||||
"58.53","86","female","alone","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no","246.47","0","14","14","13","7","9","4","52"
|
||||
"75.8","75","male","partner","never","Placebo","guideline","yes","no","yes","0","2","yes","no","no","no","no","108.2","2","11","13","16","10","7","14","64"
|
||||
"133.01","70","female","alone","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","228.24","2","7","8","4","4","4","3","88"
|
||||
"114.93","63","male","partner","never","Placebo","guideline","no","no","yes","0","3","no","no","no","no","no","188.05","2","18","18","12","6","12","5","72"
|
||||
"243.33","57","male","alone","never","Placebo",NA,"no","no","no","0","6","no","no","yes","no","no","200.09","3","7","5","6","4","10","5","8"
|
||||
"218.89","77","male","alone","ever","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","32.09","1","5","13","16","11","5","11","88"
|
||||
"116.05","76","female","alone","ever","Active","guideline","no","no","no","0","7","no","no","no","no","no","66.52","4","8","9","4","5","5","6","88"
|
||||
"126.31","65","male","partner","never","Active","guideline","yes","yes","no","0","2","yes","no","no","no","no","259.37",NA,NA,NA,NA,NA,NA,NA,"0"
|
||||
NA,"82","female","alone","ever","Placebo","guideline","yes","no","no","1","16","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"81.72","77","male","partner","never","Active","more","yes","yes","no","1","1","no","yes","no","no","no","35.91","2",NA,NA,NA,NA,NA,NA,NA
|
||||
"155.83","63","female","alone","never","Placebo","guideline","no","no","no","0","0","no","no","no","yes","no","221.5","0","10","8","9","7","4","5","56"
|
||||
"136","55","male","alone","never","Placebo","guideline","no","no","no","0","7","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"247.12","53","female","partner","never","Placebo","guideline","no","no","no","0","8","yes","no","no","no","no","203.62","1","17","10","15","6","4","6","60"
|
||||
NA,"73","male","alone","never","Active","guideline","no","no","no","0","7","no","no","no","no","no","42.63","3","20","20","16","8","8","29","4"
|
||||
"33.6","62","female","alone","never","Active","guideline","no","no","no","1","8","no","no","no","no","no","192.4",NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"296","60","male","partner","never","Active","guideline","no","no","no","0","12","no","no","no","no","no","112.82","4","8","12","15","4","4","3","92"
|
||||
"59.2","87","female","alone","never","Active","guideline","yes","yes","no","2","4","no","no","no","no","no","99.89","2","14","17","20","10","4","12","72"
|
||||
"214.48","74","male","alone","never","Placebo","guideline","no","no","yes","0","4","no","no","no","no","no","337.61","1","6","4","11","5","11","6","80"
|
||||
"418.9","54","female","alone","ever","Active","guideline","no","yes","yes","0","3","no","no","no","no","no","295.91","1","18","14","12",NA,"16","8","48"
|
||||
"114.5","69","male","partner","never","Placebo","guideline","no","yes","no","0","10","yes","no","no","yes","no","105.8","1","4","6","4","4","8","1","88"
|
||||
"56","67","male","partner","never","Active","guideline","no","no","no","0","4","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"292.24","63","male","partner","ever","Active","guideline","no","no","no","0","2","yes","no","no","yes","no","52.5","3","4","8","8","4","4","4","96"
|
||||
"155.83","45","male","partner","ever","Active","guideline","no","yes","no","0","4","no","no","no","no","no","335.69","1","9","7","9","8","4","3","92"
|
||||
"106","78","male","alone","never","Active","guideline","no","no","no","0","4","no","no","no","no","no",NA,"1","4","5","5","5","8","3","96"
|
||||
"114.6","52","male","partner","never","Active","guideline","no","yes","no","0","2","yes","no","no","yes","no","31.4","1","19","13","11","8",NA,"22","44"
|
||||
"0","86","female","alone","never","Placebo","guideline","no","no","no",NA,"2","yes","no","no","no","no","35","3","4","20","16","8","4","0","88"
|
||||
"55","67","male","partner","never","Active","guideline","no","yes","no","0","7","no","yes","no","no",NA,"3.3","2","10","7","14","10","5","2","88"
|
||||
"0","76","male","partner","never","Active","guideline","no","yes","no","0","3","yes","no","no","yes","no",NA,"1","16","19","17","18","4","15","44"
|
||||
"158.5","67","male","partner","ever","Active","guideline","no","yes","no","0","16","yes","no","no","no","no","222.07","1","14","8","5","4","16","4","80"
|
||||
"246.85","70","male","partner","ever","Placebo","guideline","no","yes","no","0","4","no","no","no","no",NA,"0","1","10","11","8","4","10","10","72"
|
||||
"196","81","male","alone","never","Placebo","guideline","no","no","no","0","2","yes","no","no","no","no","33.6","3","4","4","11","4","11","5","88"
|
||||
"249.9","62","male","partner","ever","Active","guideline","no","yes","no","0","1","yes","no","no","no","yes",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"61","64","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","35.4","3","17","18","18","4","4","10","72"
|
||||
"0","60","male","alone","ever","Active","guideline","no","yes","no","2","3","no","no","no","no","no",NA,"4",NA,NA,NA,NA,NA,"16","52"
|
||||
"156.21","68","male","partner","never","Active","guideline","no","no","no","0","2","no","no","no","no","no","158.5","1","12","14","10","5","12","12","72"
|
||||
"200.76","69","male","partner","never","Active","guideline","no","yes","no","0","3","yes","no","no","no","no","231.5","0","5","6","9","9","6","12","76"
|
||||
"270.6","63","male","partner","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","86.11","3","11","13","11","8","14","9","76"
|
||||
"268.72","45","male","alone",NA,"Active","guideline","no","no","no","0","0","no","no","no","no","no","245.77","1","13","10","7","4","5","2","72"
|
||||
"215.8","64","male","partner","ever","Placebo","guideline","no","no","no","0","6","yes","no","no","no","no","250.3","1","13","12","15","9","6","5","60"
|
||||
"187.4","51","female","partner","ever","Active","more","no","yes","no","0","4","no","no","no","no","no","140.61","2","16","13","12","6","6","5","80"
|
||||
"66.04","77","female","alone","ever","Active","guideline","no","no","no","0","2","yes","no","no","no","no","50","0","7","4","4","4","6","2","100"
|
||||
"53.97","83","male","partner","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","66.5","2","10","17","18","10","4","4","72"
|
||||
"133.8","63","male","partner",NA,"Placebo",NA,"no","yes","yes","0","2","no","no","no","no","no","111","1","8","10","11","8","5","0","80"
|
||||
"54.51","71","male","alone","never","Placebo","guideline","no","yes","yes","0","5","no","no","no","no","no","50.02","1","11","13","12","13","11","6","60"
|
||||
"327.72","57","male","alone","never","Active","more","no","no","no","0","0","yes","no","no","no","no","206.05","1","16","17","9","5","15","24","44"
|
||||
"198.89","81","male","partner","ever","Active","guideline","no","yes","no","1","7","yes","no","no","no","no","164.51","1","10","6","5","5","8","5","80"
|
||||
"138.2","76","male","alone","ever","Placebo","guideline","yes","yes","no","1","6","no","no","no","no","no","185.92","2","10","11","4","7","9","2","100"
|
||||
"91.9","74","male","alone","never","Placebo","guideline","no","yes","no","0","8","yes","yes","no","no","no",NA,"6","8","9","14","5","4","2","80"
|
||||
"68.6","54","female","partner","never","Placebo","guideline","no","no","no","1","1","no","no","no","no","no","117.2","1","14","12","14","12","11","5","68"
|
||||
"137","44","male","partner","ever","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no","255.14","0","8","14","16","10","8","5","72"
|
||||
"214.2","64","male","partner","never","Active","guideline","no","no","no","0","17","yes","no","yes","no","no","176.57","2","11","14",NA,"9","11","20","40"
|
||||
"85.8","52","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","211","2","15","11","8","4","12","10","64"
|
||||
"216.47","48","female","partner","never","Placebo","guideline","no","yes","no","0","0","no","no","no","no","no","256.12","1","10","16","13","8","4","5","76"
|
||||
"207.53","85","male","partner","never","Placebo","guideline","yes","yes","no","0","6","yes","no","no","no","no","136","3","9","13","7","6","6","4","80"
|
||||
"27.2","61","male","alone","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","no","no","65","1","13","17","15","4","6","1","68"
|
||||
"189.71","49","female","alone","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no","52.2","2","20","16","16","7","18","18","24"
|
||||
"197","63","male","alone","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","231.73","2","15","7","11","10","11","11","52"
|
||||
"116","70","male","partner","never","Active","more","no","no","no","0","4","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"157.4","64","male","partner","ever","Active","guideline","no","yes","no","0","0","no","no","no","no","no","205","2","16","11","12","4","4","9","80"
|
||||
"88.2","63","male","partner","never","Placebo","guideline","no","no","no","1","28","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"50","85","female","alone","never","Active","guideline","yes","no","no","0","27","yes","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"114.6","83","male","alone","ever","Active","guideline","no","no","yes","0","7","no","no","no","yes","no","106.8","1","8","6","8","8","4","4","80"
|
||||
"148.96","75","female","partner","never","Placebo","guideline","no","yes","no","0","1","yes","no","no","no","no","95.8","1","14","8","11","10","16","9","52"
|
||||
"100","72","male","partner","never","Active","guideline","no","yes","no","0","4","yes","no","yes","no","no","52.53","3","4","6","9","13","8","6","92"
|
||||
"195.92","64","female","alone","ever","Placebo","guideline","no","no","no","0","2","yes","no","no","no","no","158.51","1","6","7","7","4","6","5","80"
|
||||
"180.22","69","male","partner","never","Placebo","guideline","yes","no","no","0","5","yes","no","no","no","no","190","1","4","8","5","4","4","0","100"
|
||||
"116.12","65","male","partner","never","Active","guideline","no","yes","no","0","17","yes","no","yes","no","no","199.16","2","16","14","19","7","8","9","68"
|
||||
NA,"73","male","alone","never","Placebo","guideline","no","yes","yes",NA,NA,"no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"22.2","66","male","partner","ever","Active","guideline","yes","yes","yes","1","4","no","no","no","no","no","64.11","3","14","14","6","8","10","8","84"
|
||||
"29.73","79","male","alone","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","31.4","1","16","6","8","8","4","4","48"
|
||||
"216.86","69","male","partner","ever","Active","guideline","yes","no","no","1","6","yes","no","yes","no","no","252.43","1","6","4","4","5","4","3","76"
|
||||
"226.8","55","male","partner","never","Active","guideline","no","no","yes","0","0","no","no","no","no","no","142.4","1","10","12","15","8","8","6","92"
|
||||
"166","81","male","alone","never","Active","more","no","no","no","0","3","yes","no","no","no","yes","79.7","4","4","9","10","4","5","5","92"
|
||||
"131.8","69","male","alone","never","Placebo","guideline","no","yes","no","0","16","yes","no","yes","no","no","9.03","4","17","17","16","8","12","5","100"
|
||||
"161.5","53","female","partner","ever","Placebo","guideline","yes","no","no","0","2","no","no","no","no","no","302.77","0","16","10","7","4","6","8","80"
|
||||
"256","74","male","partner","ever","Active","guideline","yes","yes","no","0","0","no","no","no","no","no","311.8","1","4","8","6","6","8","1","100"
|
||||
"238.6","62","male","partner","ever","Active","more","no","no","no","0","12","yes","no","no","no","no","288.93","1","12","14","13","6","6","7","64"
|
||||
"252.8","51","male","partner","never","Placebo","guideline","no","no","no","0","5","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"84.6","45","male","partner","never","Placebo","guideline","no","yes","yes","0","3","no","no","no","no","no","73.61","2","16","17","17","12","10","14","60"
|
||||
"341.4","54","male","partner","never","Placebo","more","no","no","no","0","3","no","no","no","no","no",NA,"0","20","14","17","11","12","29","16"
|
||||
"117.8","87","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","131.8","2","11","9","13","7","4","4","72"
|
||||
"113.21","79","female","partner","ever","Active","more","no","no","no","0","5","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"82.36","69","male",NA,"never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","254.51","0","12","6","9","8","8","2","76"
|
||||
"30","62","male","partner","never","Placebo","more","no","no","no","0","2","yes","no","no","no","yes","95","2","10","14","11","9","7","13","60"
|
||||
"241.3","45","male","partner","ever","Placebo","guideline","no","no","no","0","32","yes","no","yes","no","no","315.97","2","11","7","8","4","7","14","80"
|
||||
"137.4","83","female","partner","ever","Active","guideline","no","no","no","1","4","no","no","no","no","no","155.01","3","13",NA,"9","7",NA,NA,"52"
|
||||
"260.5","50","male","partner","ever","Active","guideline","no","no","no","0","4","no","no","no","no","no","238.05","1","11","7","11","10","6","2","76"
|
||||
"289","63","male","partner","never","Placebo","more","yes","no","no","0","6","yes","no","no","no","no","253.4","1","14","17","15","9","14","10","64"
|
||||
"30","77","female","partner","ever","Active","guideline","no","no","no",NA,"7","no","no","no","no","no","31.72","4","15","20","16","4","4","9","76"
|
||||
"25","77","male","alone","never","Active","guideline","yes","yes","yes","2","2","no","no","no","no","no","0","2","8","11","13","12","17","6","92"
|
||||
"130.56","37","female","alone","ever","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","288.72","1","16","14","10","8","10","13","32"
|
||||
"59.8","81","male","alone","never","Active","more","no","yes","no","0","2","no","no","no","no","no","154.84","1","4","6","6","6","4","0","100"
|
||||
"117.13","71","male","partner","ever","Active","guideline","no","yes","no","0","3","yes","no","no","no","no","89.6","2","12","12","10","4","8","1","100"
|
||||
"286.47","50","male","partner","never","Active","guideline","no","no","no","0","3","yes","no","no","no","no","306.55","1","12","9","16","11","10","5","56"
|
||||
"117.63","72","female","partner","ever","Active","guideline","no","yes","no","1","4","yes","no","no","no","yes","191.4","1","9","8","8","4","4","3","68"
|
||||
"27.2","80","female","alone","never","Active","guideline","no","no","no","1","14","no","no","no","no","no","4.84","4","20","19","20","4","4","14","64"
|
||||
"211.4","51","male","partner","ever","Active","guideline","no","no","no","0","1","yes","no","no","no","no","288.4","2","14","19","18","8","13","11","52"
|
||||
"100","73","female","partner","ever","Active","guideline","no","yes","no","0","3","no","no","no","no","no","102.89","2","15","16","20","12",NA,"19","56"
|
||||
"299.19","52","male","partner","ever","Placebo","guideline","no","yes","no","1","7","yes","no","no","no","no","149.05","1","11","10","14","11","8","7","64"
|
||||
"75.8","64","male","partner","never","Placebo","more","no","no","no","0","4","no","no","no","no","no","224.62","1","8","4","4","5","8","10","88"
|
||||
"25","77","male","partner","never","Active","more","no","yes","no","2","6","no","yes","no","no","no","116.59","3","13","15","9","11","13","16","60"
|
||||
"90","58","male","alone","never","Active","guideline","yes","yes","yes","0","0","no","no","no","no","no","55","1","15","18","12","10","9","13","60"
|
||||
"147.13","74","male","partner","never","Placebo","more","no","yes","no","0","5","no","no","no","no","no","135.1","2","15","14","11","7","4","5","72"
|
||||
"131.8","69","male","partner","never","Placebo","guideline","yes","no","no","2","3","no","no","no","no","no","167.45","2","5","12","10","5","4","1","92"
|
||||
"104.16","65","female","partner","ever","Placebo","guideline","yes","yes","no","0","12","yes","no","yes","yes","no","156.58","1","18","14","20","14","4","16","44"
|
||||
"54.51","85","male","partner","never","Placebo","more","no","yes","yes","0","2","no","no","no","no","no",NA,"2","20","16","19","20","17","14","16"
|
||||
"50","81","male","alone","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","115.43","1","14","14","13","11","5","6","72"
|
||||
"297.4","71","male","partner","never","Active","guideline","no","no","no","1","5","no","no","no","no","no","149.4","2","9","15","9","6","12","5","88"
|
||||
"131.8","67","male","partner","never","Placebo","guideline","no","yes","yes","0","5","yes","no","no","no","no","244.23","0","10","5","6","4","11","2","84"
|
||||
"190","61","male","alone","ever","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","230.37","1","10","8","12","8","11","3","88"
|
||||
"191.81","58","male","alone","never","Active","more","no","no","no","0","1","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"248.3","52","male","alone","never","Active","guideline","no","no","no","0","1","no","no","no","no","no","161.8","1","14","9","10","7","11","6","64"
|
||||
"348.97","49","male","partner","ever","Placebo","guideline","no","no","no","1","1","yes","no","no","no","no","255.66","0","7","4","6","5","5","3","80"
|
||||
"252","60","male","partner","ever","Active","guideline","no","yes","no","0","1","no","no","no","no","no","226.08","2","14","9","8","9","14","4","68"
|
||||
"85","67","male","partner","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","no","no","225.11","1","4","5","7","7","6","0","92"
|
||||
"161","49","male","partner","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","259.5","1","5","10","4","4","5","6","84"
|
||||
"87.47","45","male","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","167.07","1","4","7","5","5","4","3","96"
|
||||
"167.8","83","male","partner","never","Active","guideline","yes","yes","no","0","5","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"86.72","72","female","partner","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","109.25","1","10","6","8","9","8","3","64"
|
||||
"116.75","67","male","alone","never","Placebo","guideline","no","yes","yes","0","4","no","no","no","yes","no","62.36","3","17","18","20","16","8","15","52"
|
||||
"183.91","78","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","72.91","1","5","5","5","4","5","0","92"
|
||||
"269.28","63","male","partner","never","Placebo","guideline","no","yes","no","0","13","yes","no","no","no","no","184.72","0","6","6","6","5","7","12","72"
|
||||
"215.8","51","female","partner","ever","Active","guideline","yes","no","no","0","2","no","no","no","no","no",NA,"2","17","16","15","15","9","20","48"
|
||||
"91","72","female","partner","never","Active","guideline","no","no","no","1","7","yes","no","no","no","no","76.4","0","10","6","10","4","12","3","88"
|
||||
"221","44","female","alone","never","Active","guideline","no","no","yes","0","3","yes","no","no","no","no","146","2","18",NA,"16","9",NA,"17","44"
|
||||
"49.73","66","female","partner","never","Placebo","more","yes","no","no","0","18","yes","no","yes","no","no","87.09","2","12","9","19","8","8","13","80"
|
||||
"184.6","48","female","partner","never","Active","guideline","no","no","no","0","5","yes","no","yes","no","no","146.66","1","14","20","13","8","8","19","60"
|
||||
"64.35","76","female","partner","never","Active","guideline","yes","yes","no","2","17","yes","no","yes","no","no","71.48","2","18","18","17","11","6","20","48"
|
||||
"132.32","76","female","alone","ever","Active","guideline","no","yes","no","0","3","no","no","no","no","no","70.93","0","9","7","7","4","4","1","88"
|
||||
"190.67","54","female","partner","never","Placebo","guideline","no","yes","no","0","4","no","no","no","no","no","243.56","1","12","9","9","5","4","5","56"
|
||||
"58.6","83","female","partner","ever","Active","guideline","no","yes","no","0","10","yes","no","no","no","no","19.45","4","11","17","16","4","4","7","88"
|
||||
"316.76","44","male","partner","never","Placebo","guideline","no","yes","no","0","4","no","no","no","no","no","281.83","1","4","4","7","4","4","1","100"
|
||||
NA,"84","female","partner","ever","Active","guideline","no","yes","yes","0","2","no","no","no","no","no","58.6","2","12","16","20","8","7","7","80"
|
||||
"147.1","37","male","partner","ever","Active","guideline","no","no","no","0","2","yes","no","no","no","no","227.83","1","14","9","9","11","12","9","72"
|
||||
"132.4","69","male","partner","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no","88.3","1","11","16",NA,"6","12","18","68"
|
||||
"192.4","81","male","partner","never","Placebo","guideline","no","no","no","1","3","no","no","no","no","no","108.34","0","10","12","6","5","5","1","92"
|
||||
"237.2","80","male","partner","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","322.4","1","7","5","4","4","10","4","84"
|
||||
"85","75","female","alone","never","Placebo","guideline","no","yes","no","0","7","no","no","no","no","no","60.91","2","14","7","4","4","4","12","88"
|
||||
"106.93","84","male","partner","never","Active","more","yes","no","no","0","3","no","no","no","no","no","207.86","2","12","20","4","4","16","5","76"
|
||||
"221","57","female","alone","never","Placebo","guideline","no","yes","no","0","11","yes","no","no","yes","no","205.72","3","18","13","6","14","13","7","28"
|
||||
"25.8","48","male","partner","ever","Active","guideline","no","no","no","0","1","no","no","no","no","no","281.41","0","9","9","11","6","8","3","68"
|
||||
"30","87","female","alone","never","Active","guideline","no","yes","no","1","2","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"179.73","57","female","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","240.38","1","17","14","16","13","4","15","36"
|
||||
"293.12","46","male","partner","ever","Placebo","guideline","yes","no","yes","0","1","yes","no","no","no","no","335.46","1","8","14","10","8","9","7","72"
|
||||
"60","65","female","partner","ever","Active","guideline","no","yes","no","0","4","no","no","no","no","no","98.31","1","12","12","14","12","11","5","72"
|
||||
"88.77","61","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","243.98","2","10","15","10","5","12","12","84"
|
||||
"202.72","45","female","partner","ever","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no","248.13","1","9","4","4","4","7","5","88"
|
||||
"147.35","76","male","alone","never","Placebo","guideline","yes","yes","no","0","2","yes","yes","no","yes","no","245.8","2","10","8","9","4","4","13","80"
|
||||
"172.2","63","male","alone","never","Placebo","guideline","yes","no","no","0","19","no","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"282.7","48","male","partner","ever","Active","guideline","no","no","no","0","18","yes","no","yes","no","no","67.27","3","20","5","14","8","15","14","20"
|
||||
"254.6","64","female","partner","never","Placebo","guideline","no","no","no","0","11","yes","no","no","no","no","125.38","4","11","6","5","4","4","1","96"
|
||||
"149.71","64","female","alone","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no",NA,"0","4","8","8","4","4","0","96"
|
||||
"141.8","60","male","alone","never","Active","guideline","no","no","yes","1","6","no","no","no","no","no","118.06","4","7","10","4","4","4","2","100"
|
||||
"256","54","male","partner","never","Active","guideline","no","yes","no","0","5","yes","no","no","no","no","158.43","0","5","8","10","7","5","7","72"
|
||||
"163.55","68","male","partner","never","Active","guideline","yes","yes","no","0","6","no","no","no","yes","no","232.27","1","16","13","13","8","4","3","76"
|
||||
"40","66","female","partner","ever","Placebo","guideline","no","yes","no","0","4","yes","no","no","no","no","85","0","9","13","12","9","4","5","64"
|
||||
"37.84","84","female","alone","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","98.13","1","12","9","8","7","6","2","80"
|
||||
"106.2","72","male","partner","ever","Placebo","guideline","yes","yes","no","0","11","yes","no","no","no","no","93.5","1","12","10","18","8","6","7","40"
|
||||
"142.15","33","female","alone","ever","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","56.87","1","19","16","14","14","18","15","44"
|
||||
NA,"70","male","partner","ever","Active","guideline","no","no","no","0","19","yes","no","no","no","no","62.87","3","11","9","11","9","10","7","84"
|
||||
"52.36","88","male","alone","ever","Active","more","yes","no","no","0","12","no","no","no","no","no","25.8","3","7","18","15","12","10","4","72"
|
||||
"191.8","84","male","partner","ever","Placebo","guideline","no","no","no","1","1","no","no","no","no","no","64.6","4","20","20","20","10","16","19","4"
|
||||
"75.8","45","male","partner","never","Placebo","guideline","no","no","no","0","3","yes","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"252","74","male","partner","never","Placebo","guideline","no","yes","no","0","0","no","yes","no","no","no","224.64","0","8","5","4","4","5","3","80"
|
||||
"195.5","63","male","alone","never","Active","guideline","no","no","no","0","5","no","no","no","no","no","175.58","3","11","11","6","4","6","5","80"
|
||||
"151.4","62","male","partner","never","Placebo","guideline","no","no","yes","0","9","no","no","no","no","no","194.9","3","10","8","8","4","9","3","84"
|
||||
"123.29","67","female","partner","never","Active","guideline","no","no","no","0","3","yes","no","no","no","no","223.92","1","8","6","10","8","8","5","76"
|
||||
"110.8","66","male","alone","never","Placebo","guideline","no","yes","no","0","3","yes","no","no","no","no","38.27","2",NA,NA,NA,NA,NA,NA,NA
|
||||
"0","65","male","alone","never","Placebo","guideline","no","yes","yes",NA,NA,"no","no","no","yes","no","25","4","10","16","10","4","6","2","72"
|
||||
NA,"63","male","alone","never","Active","guideline","no","yes","no","0","16","no","yes","no","yes",NA,"21.35","5","16","14","12","7","14",NA,"20"
|
||||
"222.8","58","male","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","377.58","2","12","10","5","8","9","6","80"
|
||||
"184.49","79","female","partner","ever","Placebo","guideline","no","yes","no","0","3","yes","no","no","no","no",NA,"0","7","6","6","4","4","1","96"
|
||||
"191","60","male","alone","never","Active","guideline","no","yes","no","1","3","yes","no","no","no","no","141.08","2","4","6","6","4","4","1","96"
|
||||
"184.47","54","female","partner","ever","Active","guideline","no","yes","no","0","1","no","no","no","no","no","277.76","2","15","18","15","10","4","12","52"
|
||||
"225.6","65","female","partner","ever","Active","guideline","no","no","no","0","19","yes","no","yes","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
NA,"52","male",NA,NA,"Placebo",NA,NA,NA,"no","0","10","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"92.19","77","female","partner","never","Active","guideline","yes","yes","no","0","0","no","no","no","yes","no","56.56","2","9","13","10","8","10","24","40"
|
||||
"53.11","72","female","alone",NA,"Placebo","guideline","no","no","no","0","4","yes","no","no","no","no","277.5","1","4","4","5","4","8","0","100"
|
||||
"161","61","male","partner","never","Placebo","guideline","yes","yes","no","0","1","no","no","no","no","no","140.83","0","8","11","12","10","8","2","68"
|
||||
"75","62","female","partner","never","Placebo",NA,"no","no","no","0","24","no","no","no","no","no","27.09","4","14",NA,"15","9","9","10","64"
|
||||
"143.2","66","female","partner","ever","Placebo","guideline","no","no","no","0","9","yes","no","no","no","yes","111.4","2","13","8","8","7","11","1","88"
|
||||
"61.72","50","male","alone","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no",NA,"2","12","20","13","16","6","17","60"
|
||||
"33.6","82","female","partner","never","Placebo","guideline","no","yes","no","0","19","no","no","no","no","no",NA,"4","15","20","18","10","12","28","4"
|
||||
"75","70","female","partner","ever","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","93.14","1",NA,"13","11","11","9","5","76"
|
||||
"123","69","male","partner",NA,"Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","58.6","1","7","14","10","6","6","3","84"
|
||||
"145","58","male","partner","ever","Placebo","guideline","yes","no","no","0","14","no","no","no","no","no","276.47","2","10","12","6","4","6","7","44"
|
||||
"52.2","72","female","alone","never","Active","guideline","no","no","no","0","4","yes","no","no","no","no","31.4","1","4","4","7","5","4","0","100"
|
||||
"141.2","79","male","partner","ever","Placebo","guideline","no","no","no","0","4","yes","no","no","no","no","107.3","2","12","16","9","6","10","13","72"
|
||||
"144.6","79","male","partner","ever","Placebo","guideline","no","no","no","2","9","no","no","no","no","no",NA,"6","18","14","20","11","16","11","40"
|
||||
"65","67","male","alone","never","Placebo","guideline","no","yes","yes","2","2","no","no","no","no","no","97.13","2","16","14","14","12","12","7","56"
|
||||
"110.8","87","male","partner","never","Placebo","guideline","no","no","no","0","4","yes","no","no","no","no","33.6","1","10","14","9","12","4","5","68"
|
||||
"131.8","67","male","partner","never","Placebo","guideline","yes","yes","no","2","3","yes","no","no","yes","no","70.8","0","7","10","10","13","4","4","76"
|
||||
"52.2","19","female","alone","never","Placebo","guideline","no","no","no","0","19","yes","no","yes","no","no","78.85","1","8","8","5","4","5","3","84"
|
||||
"106.8","83","female","alone","ever","Active","guideline","no","yes","no",NA,"16","yes","no","no","no","no","27.2","3",NA,NA,NA,NA,NA,NA,NA
|
||||
"27.53","72","female","alone","never","Placebo","guideline","no","yes","no",NA,"1","yes","no","no","no","no","39.4","1","14","13","10","6","11","3","64"
|
||||
"258.4","72","male","partner","ever","Active","guideline","yes","yes","yes","0","4","yes","no","no","no","no","65","2","6","6","9","4","4","3","84"
|
||||
"168.37","76","male","partner","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","164.8","2","11","13","8","8","11","2","100"
|
||||
"17.63","83","female","alone","never","Active","guideline","no","yes","no",NA,"2","no","no","no","no","no","8.6","3","12","12","17","8","8","9","72"
|
||||
"52.2","91","female","alone","ever","Placebo","guideline","no","yes","no","1","5","no","no","no","no","no","63.13","2","12","14","12","6","7","6","72"
|
||||
"51.4","67","male","partner","never","Placebo","guideline","no","no","no","0","5","yes","no","no","no","no","68.43","1","10","12","11","9","4","3","88"
|
||||
"144.6","72","male","partner","never","Active","guideline","no","no","no","1","20","yes","no","yes","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"109.25","89","male","partner","ever","Active","guideline","yes","no","no","0","3","yes","no","no","no","no","33.6","2","11","12","13","8","10","4","84"
|
||||
"95.42","64","male","alone","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","85.82","1","15","15","16","8","10","16","60"
|
||||
"146","57","female","alone","never","Active","guideline","no","no","no","0","7","no","no","no","no","no","252.8","1","10","7","5","8","9","3","80"
|
||||
"179.2","80","male","partner","never","Active","guideline","no","yes","no","0","8","no","no","no","no","no","86","2","13","14","20","11",NA,NA,"48"
|
||||
"229.9","76","male","partner","ever","Active","guideline","no","no","no","0","3","yes","no","no","no","no","195.8","1","7","5","6","6","6","2","100"
|
||||
"241","57","male","partner","never","Placebo","guideline","no","no","no","0","8","no","no","yes","no","no","282","0","4","9","4","4",NA,"1","92"
|
||||
"186.8","60","male","alone","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","154.18","2","11","8","12","10","9","7","52"
|
||||
"163.09","81","female","alone","never","Active","guideline","no","yes","no","0","5","yes","no","no","no","no","121","1","12","7","5","4","4","2","88"
|
||||
"152.53","48","male","alone","never","Placebo","guideline","no","no","no","0","5","no","no","no","no","no","108.76","3","15","17","16","10","12","16","52"
|
||||
"98.63","86","male","alone","never","Active","guideline","no","yes","yes","2","3","yes","no","no","no","no","41.38","2","12","13","16",NA,"19","34","24"
|
||||
"50.8","74","male",NA,NA,"Active",NA,NA,NA,"no","0","1","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"84.83","67","female","partner","ever","Placebo","guideline","no","no","no","0","6","yes","no","no","no","no","98.85","0","8","8","4","4","9","6","92"
|
||||
"254.15","64","male","partner","never","Placebo","guideline","no","no","yes","0","5","yes","no","no","no","no","107.31","2","7","6","4","4","5","2","88"
|
||||
"221.4","61","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","117.4","2","9","15",NA,"6","7","5","60"
|
||||
"291.47","58","male","partner","never","Placebo","more","no","no","no","0","7","no","no","no","no","no","484.8","1","9","7","4","4","4","3","88"
|
||||
"27.2","83","male","partner","never","Placebo","guideline","no","yes","no","1","1","no","no","no","no","no","121.8","2","13","12","7","6","5","2","88"
|
||||
"208","68","male","partner","never","Placebo","guideline","no","no","yes","0","2","yes","no","no","yes","no","207.5","0","7","14","8","6","9","4","92"
|
||||
"178.6","53","male","alone","never","Active","more","no","no","no","0","14","no","no","no","no","no","63.27","4","12","14","11","8","10","10","32"
|
||||
NA,"52","male","partner","never","Active","guideline","no","yes","no","0","5","no","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"197.3","84","female","alone","ever","Active","guideline","yes","yes","no","0","0","no","no","no","no","no","80","1","13","16","15","12","7","7","64"
|
||||
"331.59","63","male","partner","never","Placebo","guideline","yes","no","no","0","15","yes","no","no","no","no","312","1","6","4","4","5","10","2","88"
|
||||
"111","58","male","alone","ever","Placebo","guideline","no","no","no","0","4","no","no","no","no","no","219.54","2","10","8","9","8","7","1","100"
|
||||
"30","89","female","alone","never","Placebo","more","no","yes","no","0",NA,"no","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"78.33","84","female","alone","never","Active","guideline","no","yes","no","2","0","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"14.21","79","male","partner","never","Active","guideline","yes","no","no","2","6","no","yes","no","no","no","135.42","4","7","11","12","9","4","0","100"
|
||||
"95.8","86","female","alone","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","50.8","2","15","15","15","9","8","14","68"
|
||||
"75.39","73","male","partner","ever","Placebo","guideline","yes","yes","no","1","8","no","no","no","no","no",NA,"1","4","8","4","4","4","2","100"
|
||||
"170.25","69","female","partner","ever","Placebo","guideline","no","no","no","0","4","yes","no","no","no","yes","193.3","0","12","10","10","9","4","1","92"
|
||||
"61","70","male","partner","never","Placebo","guideline","no","no","no","0","3","yes","no","yes","no","no","220.8","0","6","6","7","7","5","6","80"
|
||||
"236.8","49","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","227.05","1","9","12","10","4","7","7","76"
|
||||
"163.2","53","male","partner","never","Active","guideline","no","no","no","0","5","no","no","no","no","no","179.49","1","13","20","19","8","7","14","68"
|
||||
"29.51","77","female","alone","never","Active","guideline","yes","yes","no","0","3","yes","no","no","no","no","61.96","0","10","16","11","13","11","3","76"
|
||||
"206.4","51","male","partner","never","Placebo","guideline","no","no","yes","0","7","yes","no","no","yes","no",NA,"2","17","15","16","14","14","30","20"
|
||||
"116","74","male","partner","never","Placebo","guideline","yes","yes","no","0","7","yes","no","no","yes","no","123.81","0","4","4","6","5","4","1","84"
|
||||
"323.17","58","male","partner","ever","Placebo","guideline","no","no","no","0","0","no","no","no","no","no","383","1","10","7","6","8","6","3","80"
|
||||
"107.81","79","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","163.08","1","16","15","19","10","13","5","68"
|
||||
"211.4","48","male","partner","never","Active","guideline","no","no","no","0","2","no","no","no","no","no","210.16","1","13","16","16","12","11","4","60"
|
||||
"157.4","78","male","partner","ever","Placebo","guideline","no","no","no","0","4","no","no","no","no","no","117.15","0","6","12","8","8","10","10","64"
|
||||
"126.64","52","male","partner","ever","Placebo","guideline","no","yes","no","0","4","no","no","no","no","no","251.15","2","6","12","9","4","4","2","100"
|
||||
"69.36","78","female","alone","never","Active","guideline","no","no","no","0","5","yes","no","no","no","no","128.04","1","20","17","20","18","15","23","32"
|
||||
"107.52","78","male","partner","never","Placebo","more","yes","yes","no","2","2","no","no","no","no","no","88.78","2","14","6","10","7","4","5","68"
|
||||
"60","69","male","partner","never","Active","guideline","no","yes","yes","0","8","yes","no","no","yes","no","107.16","1","13","4","16","6","16","10","60"
|
||||
"169.6","60","female","alone","ever","Placebo","guideline","no","no","yes","0","3","no","no","no","no","no","196.32","2","5","5","13","5","4","6","76"
|
||||
"106","68","male","partner","never","Active","guideline","yes","no","no","0","12","yes","no","yes","no","no","127","0","6","6","8","7","4","0","88"
|
||||
"132.5","68","female","partner","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","131.16","0","4","5","5","5","4","0","92"
|
||||
"141.55","73","female","alone","ever","Active","guideline","no","yes","no","0","2","no","no","no","no","no","106.55","2","16","14","14","12","8","8","48"
|
||||
"247.23","37","female","partner","never","Active","guideline","no","no","no","0","1","no","no","no","no","no","172.14","1",NA,NA,"9","9","14","5","64"
|
||||
"71.72","44","male","alone","never","Active","guideline","no","no","no","0","12","yes","no","yes","no","no","50.8","2","19","17","17","15","15","24","16"
|
||||
"217.05","79","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","147.74","2","10","11","12","10","7","3","60"
|
||||
"140.75","56","male","partner","ever","Placebo","guideline","no","yes","no","0","5","no","no","no","no","no","120.56","0","12","9","6","6","7","4","76"
|
||||
"95.8","84","female","alone","ever","Active","guideline","no","yes","no","0","3","no","no","no","no","yes",NA,"0","12","12","12","12","12","50","100"
|
||||
"140.85","73","male","partner","never","Active","guideline","no","no","no","0","2","yes","no","no","no","no","290.77","1","7","9","4","4","4","6","80"
|
||||
"2.2","71","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","50.8","2","11","10","16","12","6","10","84"
|
||||
"56.4","67","male","partner","ever","Active","guideline","yes","no","no","1","2","no","no","no","no","no","103.12","2","9","10","12","8","9","4","84"
|
||||
"59.24","80","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","yes",NA,NA,"3","18","16","20","20","12","29","8"
|
||||
"77","77","female","partner",NA,"Placebo","guideline","no","yes","no","0","9","yes","yes","no","yes","no","100","1","12","10","10","6","8","11","80"
|
||||
"188.8","49","female","partner","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","78.65","1","12","16","10","8","4","4","76"
|
||||
"163.2","63","female","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","231.54","2","14","9","12","9","15","20","56"
|
||||
"0","88","female","partner","ever","Placebo","guideline","no","yes","no","0","2","yes","no","no","yes","no","25","0","7","5","7","6","4","0","96"
|
||||
"50","86","female","alone","ever","Placebo","guideline","no","no","no","2","4","no","no","no","no","no","52.2","2","13","15","11","15","12","5","72"
|
||||
"249.9","67","female","partner","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","111.1","2","12","11","12","8","8","10","64"
|
||||
"170.72","75","male","alone","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no","170.12","1","6","4","4","4","8","2","92"
|
||||
"70","79","female","alone","never","Active","guideline","no","no","no","0","5","no","no","no","no","no","55","3","17","8","12","10","10","13","48"
|
||||
"144.13","80","female","alone","never","Placebo","guideline","no","no","no","0",NA,"no","no","no","yes","no","215.43","0","4","4","4","6","4","0","96"
|
||||
"315.91","68","male","partner","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","241.05","1","5","4","9","4","6","4","88"
|
||||
"50.8","72","male","partner","ever","Active","guideline","no","no","yes","1","22","yes","no","no","no","no","44.6","4","6","7","6","10","18","9","88"
|
||||
"80.75","69","female","partner","ever","Placebo","guideline","no","yes","no","0","0","no","no","no","no","no","161.07","0","6","6","5","6","7","0","96"
|
||||
"25","97","female","alone",NA,"Active","guideline","yes","yes","no","2","24","no","no","no","no","no",NA,"5",NA,NA,NA,NA,NA,NA,"0"
|
||||
"277.11","54","male","partner","never","Placebo","guideline","no","no","no","0","3","yes","no","no","no","no",NA,"0","14","7","14","11","10","11","36"
|
||||
"112.4","47","female","partner","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","52.2","0",NA,NA,NA,NA,"4","3","100"
|
||||
"105","64","female","partner","never","Active",NA,"yes","no","no","0","23","no","no","yes","no","no","112.57","4","7","7","4","4","6","1","92"
|
||||
"181.32","54","female","partner","never","Placebo","guideline","no","no","no","2","5","yes","no","no","no","no","158.84","2","13","12","10","8","4","1","68"
|
||||
"27.31","52","male","alone","never","Placebo","guideline","no","yes","no","1","2","no","no","no","no","no","151.92","2","7","15","11","5","8","8","52"
|
||||
"37.8","76","female","alone","never","Placebo","guideline","no","yes","yes","0","4","no","yes","no","no","no","25","1","12","13","13","13","12","7","56"
|
||||
"108.76","79","male","partner",NA,"Active","guideline","no","no","no","0","2","no","no","no","yes","no","300.85","2","4","8","9","6","5","2","92"
|
||||
"152.03","71","female","partner","ever","Active","guideline","no","yes","no","0","7","yes","no","no","no","no","222.55","1","7","5","6","4","12","8","100"
|
||||
"55","66","male","partner","never","Active","guideline","no","yes","no","0","20","yes","no","yes","yes","no","139.51","1","11","10","14","7","5","7","64"
|
||||
"80.25","80","male","partner","never","Placebo","guideline","yes","yes","no","2","9","no","no","no","no","no",NA,"6","6","13","20","18","15","13","32"
|
||||
"50","72","male","partner","never","Placebo","more","no","no","no","0","2","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"188.47","70","male","partner","never","Active","guideline","no","yes","yes","0","0","no","yes","no","yes","no","158.89","1",NA,NA,NA,NA,NA,"0","96"
|
||||
"236.9","64","female","partner","ever","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","297.6","0","7","10","4","4","4","1","100"
|
||||
"300.72","57","male","partner","ever","Active","guideline","no","no","no","0","1","no","no","no","no","no","280.13","0","4","4","5","4","4","1","100"
|
||||
"116.28","77","male","partner","ever","Placebo","guideline","yes","yes","no","1","9","yes","no","no","no","no","170.74","4","9","10","12","4","5","8","76"
|
||||
"156.31","65","female","alone","never","Active","guideline","no","yes","no","0","6","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"50","73","male","alone","never","Placebo","guideline","no","no","no","2","0","no","no","no","no","no","27.2","1","19","19","17","18","8","20","28"
|
||||
"27.2","85","female","alone","ever","Active","guideline","no","no","no","1","1","no","no","no","no","no",NA,"1","19","13","18","11","4","26","28"
|
||||
NA,"79","female","alone","never","Placebo","guideline","yes","no","no",NA,"9","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"129.63","75","male","partner","never","Placebo","guideline","no","no","no","0","18","no","no","yes","yes","no",NA,"6","15","16","11","8","12","26","24"
|
||||
"82.63","75","female","partner","ever","Active","guideline","no","yes","no","0","4","no","no","no","no","no","119.68","2","16","16","14","7","12","10","76"
|
||||
"114.59","70","female","alone","ever","Active","guideline","no","no","yes","0","7","yes","no","no","no","yes","83.16","1","13","13","15","8","16","18","56"
|
||||
"117","70","male","partner","never","Placebo","guideline","yes","no","no","0","5","no","no","no","no","no","102.03","2","13","12","8","8","4","3","0"
|
||||
"99.92","82","male","alone","never","Placebo","guideline","no","no","no","0","4","no","yes","no","no","no","98.63","0","14","15","11","6","8","8","72"
|
||||
"323.68","56","male",NA,NA,"Active",NA,NA,NA,"no","0","3","no","no","no","no",NA,"448.38","2","5","8","4","4","4","1","96"
|
||||
"76.4","84","female","alone","ever","Placebo","guideline","no","yes","yes","0","0","no","no","no","no","no","56.4","1","16","17","12","14","12","7","68"
|
||||
"95.75","69","female","alone","ever","Active","guideline","no","yes","no","0","13","yes","no","no","no","no","82.09","4","8","7","6","4","4","3","88"
|
||||
"160.56","67","male","partner","never","Active","more","no","no","no","0","2","no","no","no","no","yes","349.48","2","17","17","13","9","17","9","72"
|
||||
"162.6","59","male","partner","ever","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","249.67","1","4","9","4","5","4","1","88"
|
||||
"151","69","male","partner","never","Placebo","guideline","no","yes","no","0","1","yes","no","yes","no","no","254.61","1","13","10","12","8","10","11","56"
|
||||
"98.2","40","male","partner","never","Placebo","more",NA,"yes","no","0","2","yes","no","no","no","no","315.11","0","7","12","13","5","4","9","80"
|
||||
"148.15","72","male","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","136","1","12","16","20","12","4","8","68"
|
||||
"111.8","73","male","partner","ever","Placebo","guideline","no","yes","yes","0","1","no","no","no","no","no","121","1","10","4","12","8","4","3","88"
|
||||
"179.23","50","male","partner","ever","Placebo","guideline","no","no","no","0","0","no","no","no","no","no","336.27","0","5","4","4","5","4","0","92"
|
||||
"107","44","female","alone","never","Placebo","guideline","no","yes","yes","1","5","no","no","no","no","no","70","1","12","13","11","10","10","6","68"
|
||||
"229.5","72","male","partner","never","Placebo","guideline","yes","yes","no","0","5","no","no","no","no","no","58.6","2","10","4","12","5","8","18","48"
|
||||
"365.28","64","male","partner","never","Placebo","more","no","no","no","0","9","yes","no","no","no","no","142.93","2","8","8","8","4","10","2","100"
|
||||
"412.9","55","male","partner","never","Active","guideline","no","no","no","0","5","yes","no","no","no","no","222.84","3","10","7","10","8","4","3","100"
|
||||
"108.31","67","female","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","116.25","1","15","12","13","9","9","8","72"
|
||||
"153.63","86","male","partner","never","Active","guideline","yes","no","no","0","4","no","no","no","no","no","108.2","1","4","4","6","6","5","0","92"
|
||||
"111.8","78","female","alone","ever","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"101.16","74","male","alone","ever","Active","guideline","no","no","no","0","3","no","no","no","no","no","96","3","6","10","11","8","10","2","96"
|
||||
"157","73","male","partner","never","Active","guideline","no","yes","no","1","3","no","no","no","no","no",NA,"0","8","6","5","5","4","1","88"
|
||||
"290.84","61","male","partner","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","262","1","9","8","9","4","4","0","88"
|
||||
"88.2","74","female","alone","ever","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","130","1","17","10","16","12","12","16",NA
|
||||
"170.89","45","male","alone","ever","Active","guideline","yes","yes","no","0","13","no","no","no","no","no","170.84","1","6","10","10","8","4","0","52"
|
||||
"107.72","82","male","partner","ever","Placebo","guideline","no","yes","no","0","10","yes","no","yes","no","no","138.38","1","9","10","11","9","9","4","64"
|
||||
"225.6","61","male","partner","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","219.55","0","9","7","8","9","11","6","60"
|
||||
"235.16","57","male","partner","never","Active","guideline","yes","no","no","0","0","no","no","no","no","no","255.33","0","9","6","8","7","6","2","72"
|
||||
"50","82","female","partner","never","Active","guideline","no","no","no","0","17","yes","no","yes","no","no","30.5","2","15","15","13","4","4","8","84"
|
||||
"99.55","74","female","alone","never","Active","guideline","no","yes","no","0","7","no","no","no","no","no","59.03","4","13","10","14","8","4","8","76"
|
||||
"105.61","80","female","alone","never","Active","guideline","no","yes","yes","1","0","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"29.46","78","male","partner","never","Placebo","more","no","yes","no","0","2","yes","no","no","no","no","167.32","1","10","17","4","4","4","4","92"
|
||||
"179.5","71","male","alone","ever","Placebo","guideline","no","yes","no","0","5","yes","no","no","yes","no","157.34","2","12","10","10","11","7","8","76"
|
||||
"245.11","56","male","alone","never","Active","guideline","no","no","no","0","2","no","no","no","no","no","92.4","1","7","6","5","7","4","8","84"
|
||||
"315.8","45","male","partner","never","Active","guideline","no","no","no","0","3","yes","no","no","no","no","378.79","0","6","6","13","7","5","5","72"
|
||||
"120","70","female","partner","ever","Active","guideline","yes","no","no","0","11","no","no","yes","no","no","78.6","1","17","17","18","9","5","26","56"
|
||||
"58.6","84","female","partner","never","Placebo","guideline","yes","yes","no","0","4","yes","no","no","no","no","204.55","2","17","15","13","5","10","7","56"
|
||||
"56.4","66","female","alone","never","Active","guideline","yes","no","no","0","12","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"159.11","54","male","partner","never","Active","guideline","no","yes","no","0","1","yes","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"156.53","52","male","partner","ever","Active","guideline","no","yes","no","0","17","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"186.8","62","female","partner","ever","Active","guideline","no","yes","yes","0","8","yes","no","no","no","no","165.6","2","16","16","18","9","20","18","24"
|
||||
"142.36","67","male","partner","never","Active","more","no","no","no","0","2","no","no","no","no","no","213.2","2","4","4","8","8","4","5","100"
|
||||
"222.4","64","male",NA,"never","Active",NA,"no","no","no","0","0","no","no","no","no","no","192.4","2","9","15","9","7","4","2","96"
|
||||
"58.6","93","male","alone","never","Placebo","guideline","no","yes","no","1","11","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"62.79","89","male","partner","never","Placebo","guideline","no","yes","no","2","3","yes","no","no","no","no","122.81","2","14","16","18","14","12","10","36"
|
||||
"105.72","74","male","partner","never","Placebo","guideline","yes","yes","no","0","2","no","yes","no","no","no","140.26","1","10","9","6","8","5","8","76"
|
||||
"258.2","66","male","partner","never","Placebo","more","no","yes","no","0","2","no","no","no","no","no","138.25","1","8","8","11","9","7","6","76"
|
||||
"256","51","female","alone","never","Active","guideline","no","no","no","0","4","yes","no","yes","no","no","77.25","2","15","17","7","7","20","29","60"
|
||||
"52.2","69","male","alone","ever","Placebo","guideline","yes","yes","yes","0","1","no","no","no","no","no","108.2","2","4","9","11","12","6","3","100"
|
||||
"50","93","female","alone","ever","Placebo","guideline","no","yes","yes","2","1","no","no","no","no","no","25","4","15","19","16","7","5","5","76"
|
||||
"103.49","66","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","21.93","4","13","19","19","13","13","40","56"
|
||||
"229.73","64","male","alone","never","Active","guideline","no","yes","no","0",NA,"no","no","no","yes","no","29.51","4","5","8","12","7","4","1","88"
|
||||
"196.8","71","male","partner","never","Placebo","guideline","no","yes","no","1","1","yes","no","no","no","no","146.8","1","12","13","10","6","6","2","76"
|
||||
"163.4","66","male","alone","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","140.8","1","7","5","4","7","4","1","88"
|
||||
"76.4","73","female","partner","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no",NA,"2","18","8","15","4","19","3","88"
|
||||
"33.6","75","male","alone","never","Active","guideline","yes","no","no","0","2","no","no","no","no","no","106.8","1","7","9","10","7","4","1","84"
|
||||
"75","69","female","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","25","2","16","19","20","12","9","12","72"
|
||||
"65","78","male","partner","never","Active","guideline","no","no","no","2","2","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"185.15","74","female","partner","never","Active","guideline","no","no","no","0","4","no","no","no","no","no","183.79","1","4","6","4","4","4","3","84"
|
||||
"155.52","68","male","partner","ever","Active","guideline","yes","yes","no","0","3","no","no","no","no","no","134.8","0","7","7","7","6","5","3","76"
|
||||
"34.56","78","female","alone","never","Placebo","guideline","no","yes","no","0","1","yes","no","no","no","no","103.7","2","10","12","11","10","8","2","96"
|
||||
"76.21","65","male","partner","never","Placebo","guideline","no","no","no","0","2","no","no","no","no","no","67.76","0","13","14","15","9","10","27","24"
|
||||
"65","70","male","alone","never","Active","more","no","yes","no","0","1","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"133.89","79","male","partner","never","Active","guideline","no","yes","yes","2","19","yes","no","yes","no","no","82.76","3","12","20","20","4","4","11","48"
|
||||
"50","75","female","partner","ever","Active","guideline","yes","yes","no","1","1","no","no","no","no","no","109.72","2","7","9","5","6","4","2","80"
|
||||
"111","72","male","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","113.53","0","20","16","19","16","12","29","16"
|
||||
"213.6","56","male","partner","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","182.9","2","17","10","13","12","19","18","24"
|
||||
"50.8","56","male","alone","never","Placebo","guideline","no","yes","no","1","12","yes","no","no","no","no","68.3","2","18","19","15","14","12","21","28"
|
||||
"213.25","55","male","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","224.53","1",NA,"8","8","7","11","8","76"
|
||||
"145.56","80","male","partner","never","Active","guideline","yes","no","no","0","6","no","no","no","no","no","150.03","2","7","9","16","7","4","1","84"
|
||||
"50","80","male","alone","ever","Active","guideline","yes","no","no","0","8","yes","no","no","no","no","79.03","2","17","19","18","14","16","9","52"
|
||||
"76.4","66","male","partner","never","Active","guideline","yes","no","no","0","2","no","no","no","no","no","161","0","13","14","15","13","10","9","60"
|
||||
"136","63","female","partner","ever","Active","guideline","no","yes","yes","0","2","no","no","no","no","no","239.04","1","11","8","4","4","4","6","68"
|
||||
"230.9","54","male","partner","ever","Active","guideline","no","yes","no","0","2","no","no","no","no","no","143.53","1","8",NA,"11","7","7","3","72"
|
||||
"248.25","45","male","partner","ever","Active","guideline","yes","no","no","0","0","no","no","no","no","no","153.25","1","12","6","8","13","7","8","88"
|
||||
"101","88","female","alone","ever","Active","guideline","no","yes","no","0","4","no","no","no","no","no",NA,"3",NA,NA,NA,NA,NA,NA,NA
|
||||
"113.4","71","male","partner","never","Active","guideline","no","yes","no","0","10","yes","no","no","no","no","125.4","0","4","9",NA,"9","8","0","96"
|
||||
"113.52","73","male","partner","never","Placebo","guideline","no","no","yes","2","19","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"141.8","67","male","partner","never","Active","guideline","no","yes","no","0","7","yes","no","no","yes","no","218.39","1","18","14","16","15","17","37","48"
|
||||
"170.8","64","male","partner","never","Placebo","guideline","no","yes","yes","0","5","yes","no","no","no","no","210.24","1","12","8","16","12","4","2","80"
|
||||
"50.8","58","female","partner","never","Active","guideline","no","yes","no","1","4","no","no","no","no","no","35","3","16","13","19","10","15","37","40"
|
||||
"78.33","71","male","alone","never","Active","more","no","no","no","1","4","no","no","no","no","no","4.51","4","20","16","20","17","19","38","20"
|
||||
"146.8","71","female","partner","ever","Active","guideline","no","no","no","0","20","yes","no","no","no","no",NA,"3","14","6","4","8","12","7","88"
|
||||
"108.2","87","male","alone","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","67.63","2","5","7","11","4","4","4","88"
|
||||
"180","61","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","281.28","2","10",NA,"12","13","6","6","76"
|
||||
"130.8","76","male","partner","ever","Placebo","guideline","yes","no","no","0","0","no","no","no","no","no","402.45","2","4","11","4","4","4","1","92"
|
||||
"135.63","70","female","alone","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","94.6","1","5","8","8","7","4","6","80"
|
||||
"201.8","69","male","partner","never","Placebo","guideline","no","yes","yes","0","2","no","no","no","no","no","204.55","2","11","9","8","5","11","6","44"
|
||||
"52.2","67","male","alone","never","Placebo","more","no","no","no","1","5","no","no","no","no","no","74.25","1","11","5","6","6","11","9","72"
|
||||
"282","60","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","yes","no","177.4","2","10","13","7","4","4","7","80"
|
||||
"89.61","82","male","alone","never","Placebo","guideline","no","yes","yes","0","4","no","no","no","no","no","158.52","0","4","10","6","5","4","0","96"
|
||||
"77.31","78","female","alone","ever","Active","guideline","no","yes","no","0","2","no","no","no","no","no","189.9","2","16","17","20","18","13",NA,"44"
|
||||
"204.67","71","female","partner","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no","91","2","4","4","4","4","4","0","100"
|
||||
"200.9","59","male","partner","never","Active","guideline","no","no","no","1","3","yes","no","no","no","no","174.43","2","13","15","12","11","13","9","40"
|
||||
"233.73","56","male","alone","never","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no","144.7","1",NA,NA,NA,NA,NA,NA,NA
|
||||
"325.6","46","male","partner","ever","Placebo","guideline","no","no","no","0","3","yes","no","no","no","no","177.87","2","16","14","13","14","17","19","44"
|
||||
"113","76","female",NA,"never","Placebo","guideline","no","no","no","1","4","no","yes","no","no","no","79.45","2","20","18","19","16","14","36","12"
|
||||
"91.91","64","male","partner","never","Active","more","no","yes","yes","0","5","yes","no","no","no","no",NA,"1",NA,NA,NA,NA,NA,NA,NA
|
||||
"195.8","58","female","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","111","1","11","13","6","4","7","11","76"
|
||||
"196.95","49","female","partner","ever","Active","guideline","no","no","no","0","5","yes","no","no","no","no","193.8","0","13","11","6","4","10","8","76"
|
||||
"207.31","52","male","alone","ever","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","208.5","2","12","13","10","8","8","2","68"
|
||||
"53.6","88","male","partner","never","Placebo","guideline","no","yes","no","2","3","no","yes","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"45","82","male","partner","never","Placebo","guideline","no","no","no","0","7","no","no","no","no","no",NA,"4","7","18","16","7","12","15","48"
|
||||
"25","82","female","alone","never","Placebo","guideline","no","no","no","1","6","no","no","no","no","no","25.8","3","16","19","19","13","10","9","72"
|
||||
"147.4","34","female","partner","ever","Active","guideline","no","no","no","0","10","yes","no","no","no","no","139.05","2","20","14","15","16","18","36","24"
|
||||
"85","78","female","partner","ever","Active","guideline","no","no","no","0","3","no","no","no","no","no","131.8","1","12","8","4","12","4","1","92"
|
||||
"27.2","74","female","alone","never","Active","more","no","yes","no","2","2","no","no","no","no","no","36.23","2","10","11","15","9","7","3","84"
|
||||
"15","64","female","partner","never","Active","guideline","no","no","no","0","0","no","no","no","no","no","30.75","0","13","13","15","11","12","9","76"
|
||||
"225.6","51","male","partner","ever","Active","guideline","no","no","no","0","4","yes","no","no","no","no","211","0","7","4","4","5","7","1","88"
|
||||
"75.8","85","male","alone","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","75.8","1","17","16","13","10","12","12","36"
|
||||
"196.2","59","male","partner","never","Active","guideline","no","no","no","0","7","yes","no","no","no","no","122","1","11","13","11","10","4","3","84"
|
||||
"173.73","70","male","partner","ever","Placebo","guideline","no","no","no","0","4","yes","no","no","no","no","131.8","0","4","4","4","4","4","0","100"
|
||||
"40.32","77","male","partner","never","Placebo","guideline","yes","yes","no","0","1","yes","no","no","no","no","224.49","2","13","13","14","12","12","2","92"
|
||||
"106","82","male","partner","ever","Placebo","guideline","yes","no","no","0","19","yes","no","yes","no","no",NA,"2",NA,NA,NA,NA,NA,NA,NA
|
||||
"63.59","73","female","partner","never","Active","guideline","no","no","no","0","0","no","no","no","no","no","153.35","1","11","4","6","4","4","4","72"
|
||||
NA,"42","male","partner","ever","Placebo","guideline","no","no","no","0","7","yes","no","no","no","no","202.67","2","5","7","6","9","9","5","84"
|
||||
"155.11","62","male","partner","never","Active","guideline","no","yes","no","0","26","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"314.76","58","male","partner","never","Placebo","guideline","no","yes","no","0","0","yes","no","no","no","yes",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"196.47","84","male","partner","ever","Placebo","guideline","no","yes","no","0","6","no","no","no","no","no","7.31","4","16","17","9","5","9","15","64"
|
||||
NA,"71","female","alone","never","Active","guideline","yes","yes","no",NA,NA,"no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"247","54","male","partner","never","Active","more","no","yes","no","1","3","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"81.87","70","female","partner","ever","Active","guideline","no","yes","yes","0","3","yes","no","no","no","no","59.89","1","12","11","9","8","4","5","88"
|
||||
"132.12","87","male","partner","ever","Active","more","no","no","no","0","6","no","no","no","no","no","36.72","3","14","20","7","10","4","5","84"
|
||||
"50","84","male","alone","never","Active","guideline","yes","yes","no","2",NA,"no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
NA,"76","female","alone","never","Active","guideline","no","no","yes",NA,NA,"no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"247","67","male","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","278.9","1","14","19","20","16","12","16","16"
|
||||
"166.72","52","male","partner","ever","Active","guideline","no","no","no","0","13","yes","no","yes","yes","no","161.4","1","13","12","14","10","15","5","64"
|
||||
"81.9","80","female","alone","ever","Active","guideline","no","yes","no","0","7","no","no","no","no","no","164.61","2","17","13","12","10","10","17","48"
|
||||
"148","63","female","alone","never","Placebo","guideline","no","yes","no","0","7","no","no","no","no","no","133","0","4","4","4","4","4","0","100"
|
||||
"43.8","67","male","partner","never","Placebo","guideline","no","yes","no","1","9","yes","no","yes","no","no","54.11","2","12","19","18","13","11","14","32"
|
||||
"143.31","67","male",NA,NA,"Placebo",NA,NA,NA,"no","0","0","no","no","no","no",NA,"27.2","1","18","20","20","17","8","27","40"
|
||||
"14.72","52","male","partner","never","Active","more","no","yes","yes","0","3","yes","no","no","no","no","97.4","0","14","19","16","9","6","6","68"
|
||||
"155.15","69","female","alone","never","Placebo","guideline","yes","yes","no","0","5","no","no","no","no","no","203.78","1","12","10","15","5","16","13","64"
|
||||
"247","71","male","partner","never","Active","guideline","yes","no","no","0","11","yes","no","no","no","no","61.2","2","8","7","4","4","15","5","96"
|
||||
"74.1","79","female","alone","never","Placebo","guideline","no","no","no","0","18","yes","no","yes","no","no","131.3","2","9","12","10","9","7","4","72"
|
||||
"122.55","75","male","partner","never","Active","guideline","no","no","no","0","3","no","yes","no","yes","no","81.59","0","7","6","9","11","11","4","76"
|
||||
"65","74","female","partner","never","Placebo","guideline","no","yes","no","0","6","no","no","no","no","no","75.8","1","16","12","8","8","12","7","72"
|
||||
"75","76","female","partner","ever","Active","guideline","no","yes","yes","0","2","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"64.67","75","female","alone","never","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no","125.61","0","11","8","12","7","9","5","76"
|
||||
"115.48","72","female","alone","ever","Active","guideline","yes","no","no","0","1","no","no","no","no","no","108.8","1","7","5","12","7","4","0","96"
|
||||
"106.27","65","female","alone","ever","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","92.09","1","5","4","10","4","12","5","84"
|
||||
"232.4","48","male","alone","never","Placebo","more","no","yes","no","0","2","no","no","no","no","no","282.48","1","7","8","9","4","7","7","76"
|
||||
"107.5","63","male","partner","ever","Active","guideline","no","yes","no","0","1","yes","no","no","no","no","210.17","1","8","6","9","6","6","2","96"
|
||||
"109.61","74","male","partner","never","Placebo","guideline","yes","yes","no","1","2","yes","no","no","no","no","111","2","4","4","8","8","4","3","40"
|
||||
"116.8","73","male","partner","never","Placebo","guideline","yes","no","no","0","2","yes","no","no","no","no",NA,"0",NA,NA,NA,NA,NA,NA,NA
|
||||
"114.92","78","male","partner","ever","Active","guideline","no","no","no","0","2","no","no","no","no","no","99.77","5","13","20","12","7","10","9","52"
|
||||
"85.5","45","male","partner","never","Placebo","guideline","no","no","no","0","5","no","no","no","no","yes","203.12","1","8","7","10","7","4","3","80"
|
||||
"124.27","66","male","alone","never","Active","guideline","no","no","no","0","3","no","no","no","yes","no","50.8","3","13","13","19","11","10","1","84"
|
||||
"263.33","37","male","partner","ever","Active","guideline","no","no","no","0","1","no","no","no","no","no","148.05","0","8","4","13","6","4","9","60"
|
||||
"166.8","54","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","236.8","0","4","8","4","4","4","1","100"
|
||||
NA,"83","male","partner","ever","Active","guideline","yes","no","no",NA,"27","no","no","yes","yes","yes",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"124.11","66","female","alone","never","Placebo","guideline","no","no","no","0","6","no","no","no","no","no","238.43","2","16","16","4","4","8","7","44"
|
||||
"150","55","male","partner","never","Active","guideline","yes","yes","yes","0","5","no","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"39.43","92","female","alone","ever","Placebo","guideline","no","yes","no","2","9","no","no","no","no","no","2.2","4","18","19","12","10","7","25","20"
|
||||
"79.03","88","female","partner","never","Active","guideline","yes","yes","no","0","21","yes","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"270.93","57","male","partner","ever","Placebo","guideline","no","no","no","0","3","no","no","no","no","no","276.72","0","12","10","13","8","6","8","72"
|
||||
"431.8","55","male","partner","never","Active","guideline","yes","yes","no","0","1","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"65","79","female","alone","never","Active","guideline","no","no","no","0","8","no","no","no","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"173.85","78","female","partner","ever","Active","guideline","yes","no","no","0","0","yes","no","no","no","no","210.58","1","8","4","6","5","4","5","72"
|
||||
"196.8","48","male","partner","ever","Active","guideline","no","no","no","0","2","yes","no","no","no","no","144.16","1","11","11","11","11","12","14","100"
|
||||
"58.6","80","male","alone","never","Placebo","guideline","no","no","no","2","2","no","no","no","no","no","78.6","3","14","16","13","5","14","10","80"
|
||||
"40","49","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","yes","no","no","no","122.98","0","14","11","12","11","11","30","60"
|
||||
"90.55","75","male","partner","ever","Placebo","guideline","no","yes","yes","0","5","yes","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"55.2","74","male","alone","never","Placebo","guideline",NA,"yes","no","0","5","no","yes","no","yes","no",NA,"2","18","20","20","8","10","12","68"
|
||||
"102.31","85","female","alone","never","Placebo","guideline","yes","no","no","0","1","no","no","no","no","no","171.28","0","11","12","13","6","6","8","76"
|
||||
"60.69","82","male","alone","ever","Active","guideline","no","yes","no","0","5","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"27.2","79","male","partner","never","Placebo","guideline","yes","yes","yes","2","3","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"68.6","75","male","partner","never","Active","guideline","no","yes","yes","1","5","no","no","no","no","yes","2.2","2","16","20","20","20","4","12","48"
|
||||
"221.47","70","male","partner","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","yes","no","187.3","2","5","8","10","7","13","7","76"
|
||||
"272.8","57","male","partner","never","Active","guideline","no","no","no","0","4","no","no","no","no","no","259.84","2","9","8","9","8","14","2","100"
|
||||
"35.25","85","female","alone","ever","Active","guideline","no","yes","no",NA,"23","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"68.09","83","female","alone",NA,"Placebo",NA,"no","yes","no","0","5","no","no","no","no","no","92","1",NA,"10","13","12","10","8","84"
|
||||
"137.52","77","female","alone","ever","Active","guideline","no","no","no","0","5","yes","no","no","no","no","241.65","1","10","13","10","7","5","4","64"
|
||||
NA,"76","female","alone","never","Active","guideline","no","yes","no","1","7","no","no","no","no","no","30","3","16","14","20","10","6","11","28"
|
||||
"227.91","54","male","partner","ever","Active","guideline","no","no","no","0","4","yes","no","no","no","no","206.06","2","15","12","12","9","8","5","72"
|
||||
"56.4","78","female","alone","ever","Active","guideline","yes","yes","no","0","11","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"16","85","male","partner","never","Active","guideline","no","yes","no",NA,"2","no","no","no","no","no","4.51","3","4","11","17","6","5","4","84"
|
||||
"135.1","82","male","partner","ever","Placebo","more","no","no","no","1","3","yes","no","no","no","no","144.77","1","12","11","6","5","4","4","72"
|
||||
NA,"80","male","partner","never","Placebo","more","yes","yes","no","0","12","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"42.63","91","female","alone","never","Placebo","guideline","no","yes","yes","0","0","no","yes","no","no","no","42.63","1","20","16","19","12","4","7","36"
|
||||
"52.2","78","male","alone","never","Placebo","guideline","no","yes","no","0","4","no","no","no","no","no","171.56","3","10","11","13","14","6","6","64"
|
||||
"0","78","male","partner","never","Placebo","guideline","no","yes","no","1","2","no","no","no","no","no","14.86","4","11","19","17","7","11","1","84"
|
||||
"155.19","77","male","partner","ever","Placebo","guideline","no","yes","no","1","2","yes","no","no","no","no","107.5","2","18","19","18","9","13","12","40"
|
||||
"38.2","71","male","partner","never","Placebo","guideline","no","yes","yes","0","1","no","no","no","no","no","95","1","20","16","16","16","12","24","64"
|
||||
"135.69","66","male","partner","never","Active","guideline","no","no","yes","0","2","no","no","no","no","no","139.86","2","9","13","8","10","9","12","68"
|
||||
"205.6","55","male","alone","never","Placebo","guideline","no","yes","yes","0","2","no","no","no","no","no","60","1","17","20","20","14","9","8","40"
|
||||
"81.67","71","female","alone","never","Placebo","guideline","no","yes","no","0","5","no","no","no","no","no","44.16","3","16","20","17","4","17","20","20"
|
||||
"85.05","84","male","partner","never","Placebo","more","no","no","no","1","2","yes","no","no","no","no","128.11","1","5","5","7","8","8","5","88"
|
||||
"71.6","80","male","alone",NA,"Placebo","guideline","yes","yes","yes","0","3","yes","no","yes","no","no","151","1","16","12","14","6","10","5","80"
|
||||
"101.74","71","female","alone","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no","27.9","1","12","14","14","13","13","6","88"
|
||||
"290.56","69","male","partner","never","Active","more","no","no","no","0","1","no","no","no","yes","no","254.35","1","7","9","10","7","6","3","80"
|
||||
"251.2","62","male","partner","never","Active","guideline","no","no","no","0","2","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"274.11","57","male","partner",NA,"Placebo",NA,"yes","yes","yes","0","7","yes","yes","yes","no","no","358.76","0","9","6","12","7","6","3","64"
|
||||
"226","61","male","alone","ever","Placebo","guideline","no","yes","no","0","5","yes","no","no","no","no","275.76","0","4","8","9","8","4","0","92"
|
||||
"59.56","75","male","alone","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","135.72","2","6","6","5","4","8","6","92"
|
||||
"53.11","93","female","alone","never","Placebo","guideline","no","yes","no","1","2","no","no","no","no","no","39.03","2","18","18","16","9","9","9","56"
|
||||
"150.6","86","male","partner","never","Placebo","guideline","no","no","no","0","3","no","yes","no","no","no","111","1","10","12","12","11","11","5","64"
|
||||
"119.76","84","male","alone","ever","Placebo","guideline","no","yes","no","0","2","yes","no","no","no","no","74.76","2","12","14","10","4","5","11","72"
|
||||
"101.4","80","male","partner","never","Placebo","guideline","no","yes","yes","2","4","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"186.56","70","male","partner","never","Placebo","guideline","no","yes","no","0","2","yes","no","no","yes","no","249.46","2","14","15","12","10",NA,"20","72"
|
||||
"337.8","68","female","partner",NA,"Active","guideline","no","no","no","2","1","yes","no","no","no","no","181.72","2","5","4","5","5","4","0","92"
|
||||
"170.05","40","female","partner","never","Placebo","guideline","no","no","no","0","15","no","no","yes","no","no","27.2","4","14","10","12","7","6","17","76"
|
||||
"95.8","77","female","partner","ever","Placebo","guideline","no","no","no","1","7","yes","no","no","no","no","131.8","1","15","9","5","7","4","12","100"
|
||||
"120.65","70","female","partner","never","Placebo","guideline","no","no","no","0","6","yes","no","no","no","no",NA,"4","12","20","16","8","18","14","72"
|
||||
"108.2","84","male","partner","ever","Active","guideline","yes","yes","yes","0","9","no","no","no","no","no","112.08","4","8","16","18","10","11","5","40"
|
||||
"188.16","71","male","partner","never","Active","guideline","yes","yes","no","0","9","no","no","no","no","no","183.93","4","5","9","11","5","7","3","80"
|
||||
"362.13","44","male","partner","never","Placebo","guideline","no","no","no","0","2","yes","no","no","no","no","241.4","2","14","14","13","9","10","16","68"
|
||||
"228.61","80","male","partner","never","Active","guideline","no","no","no","0","3","no","no","no","no","no","313.27","2","14","9","10","9","10","8","76"
|
||||
"65","65","female","alone","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no","153.05","3","17","16","12","7","9","4","76"
|
||||
"259.53","60","male","partner","never","Placebo","more","no","yes","no","0","4","no","no","no","no","no","169.75","3","4","6","5","5","8","4","92"
|
||||
"272.72","69","female","alone","never","Placebo","guideline","no","yes","no","0","1","no","no","no","no","no","27.2","2","15","13","7","4","6","9","92"
|
||||
"169.6","47","male","partner","never","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no","139.57","2","9","11","10","7","12","11","92"
|
||||
"88.31","63","male","partner","never","Placebo","more","no","yes","no","0","3","yes","no","no","no","no","81.41","2",NA,NA,NA,NA,NA,NA,NA
|
||||
"236","57","male","alone","never","Placebo","more","no","no","no","0","1","no","no","no","no","yes","217","1","4","12","14","8","9","2","88"
|
||||
"78.44","78","female","partner","never","Active","guideline","yes","yes","no","0","12","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"249.6","33","male",NA,NA,"Active",NA,NA,NA,"no","0","1","no","no","no","no",NA,"205.02","1","4","6","6","5","7","1","84"
|
||||
"94.6","81","female","alone","ever","Active","guideline","no","yes","no","1","2","no","no","no","yes","no","35.91","3","18","19","20","16","10","23","48"
|
||||
"194.12","70","male","partner","never","Placebo","guideline","no","no","no","0","0","no","no","no","no","no","191.8","1","16","14","15","10","7","11","60"
|
||||
"205.6","68","female","alone","ever","Placebo","guideline","no","no","no","0","3","yes","no","no","no","no","258.55","1","10","5","5","4","4","5","92"
|
||||
"139.3","67","female","alone","never","Placebo","guideline","yes","no","no","0","12","yes","no","yes","no","no","245.73","2","13","17","13","4","6","6","68"
|
||||
"217.87","73","male",NA,NA,"Active",NA,NA,NA,"no","0","4","no","no","no","no",NA,"169.58","1","9","8","13","6","4","2","96"
|
||||
"219.76","36","male","partner","ever","Active","guideline","no","no","no","0","0","no","no","no","no","no","161.4","2","18","20","17","7","11","8","56"
|
||||
"106.98","78","female","partner","never","Active","guideline","no","yes","no","0","4","no","no","no","no","no","199.56","2","6","16","12","9","13","5","76"
|
||||
"50","71","female","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","no","no","52.2","3","17","20","19","11","8","14","48"
|
||||
"52.2","38","male","partner","ever","Placebo","guideline","no","no","no","0","5","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"85.45","79","male","partner","never","Active","guideline","no","yes","no","0","6","no","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"59.56","78","female","partner","ever","Active","more","no","yes","no","0","7","yes","no","no","no","no","110.2","4","16","17","17","8","12","12","68"
|
||||
"168.6","77","female","partner","ever","Active","guideline","no","yes","no","0","16","no","no","no","no","no","0","4","16","18","19","7","16","18","52"
|
||||
"232","63","male","partner","ever","Placebo","guideline","no","yes","yes","0","3","no","no","no","no","no","162.08","2","14","19","19","8","17","15","68"
|
||||
"116.73","77","male","partner","never","Placebo","guideline","no","yes","yes","0","8","yes","no","yes","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"89.12","75","male","partner","never","Active","guideline","no","yes","no","0","6","no","no","no","no","no","159.71","1","13","10","16","10","6","13","64"
|
||||
"50","68","female","alone","never","Active","guideline","no","no","no","0","2","no","no","no","no","no","129.1","0","12","15","11","10","6","4","72"
|
||||
"199.72","56","male","partner","never","Active","guideline","no","no","no","0","2","yes","no","no","no","no","172.25","1","18","13","10","4","9","7","76"
|
||||
"176.89","83","female","alone","never","Active","guideline","no","yes","no","0","5","no","no","no","no","no","138.53","0","13","8","7","8","10","2","92"
|
||||
"143.71","71","male","partner","never","Placebo","more","no","no","no","0","5","no","no","no","no","no","68.25","1","20","17","20","13","8","19","16"
|
||||
"148.11","68","male","partner","never","Active","more","no","yes","no","2",NA,"no","no","no","no","no","58.6","2","20","20","20","20","16","45","4"
|
||||
"91.4","74","male","partner","ever","Placebo","guideline","no","yes","no","0","5","no","no","no","yes","no","170.79","1","13","11","8","5","6","3","76"
|
||||
"406.8","79","female","alone",NA,"Placebo",NA,"no","yes","no","0","21","no","yes","no","no","no","0","4","10","16","10","12","4","15","20"
|
||||
"58.6","69","male","partner","ever","Placebo","guideline","yes","yes","no","0","17","yes","no","no","no","no","149.77","1","14","13","15","4","4",NA,"56"
|
||||
"162.99","67","female","partner","never","Active","guideline","no","no","no","0","4","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"108.2","76","female","alone","never","Active","guideline","yes","no","no","2","2","no","no","no","no","no","27.2","2","11","12","13","8",NA,"12","52"
|
||||
"119.51","48","female","partner","never","Active","guideline","no","no","no","0","15","yes","no","yes","no","no","167.11","2","14","5","14","6","12","6","68"
|
||||
"475.61","67","male","partner","never","Active","guideline","no","yes","no","0","1","no","no","no","yes","no","250","0","5","6","5","6","4","3","72"
|
||||
"31.4","82","female","alone","never","Placebo","guideline","no","yes","no","0","5","no","no","no","no",NA,NA,"4",NA,NA,NA,NA,NA,NA,NA
|
||||
"161.86","70","female","partner","never","Placebo","guideline","no","no","no","1","7","yes","no","no","no","no","96.86","2",NA,"5","4","4",NA,"5","84"
|
||||
"25","94","female","alone","ever","Placebo","guideline","yes","yes","no",NA,"12","no","no","no","no","no",NA,"4","13","19","19","4","4","32","80"
|
||||
"54.51","93","female","alone","never","Placebo","guideline","yes","yes","no","0","7","no","no","no","no","no",NA,"5","15","15","7","8","4","18","28"
|
||||
"144.6","53","male","partner","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","60.4","3","4","6","8","4","8","0","100"
|
||||
"55","42","male","alone","never","Active","guideline","no","no","no","0","2","yes","no","no","no","yes","58.6","1","18","19","15","16","7","8","48"
|
||||
"294.3","56","male","partner","never","Placebo","guideline","no","yes","no","0","5","yes","no","no","no","no",NA,"1","6","6","6","4","5","5","88"
|
||||
"110.8","61","female","partner","never","Active","guideline","no","yes","yes","0","22","yes","no","yes","no","no",NA,"6",NA,NA,NA,NA,NA,NA,NA
|
||||
"256.8","59","female","alone","never","Placebo","guideline","no","no","no","0","0","no","no","no","no","no","95.8","1","14","10","12","4","10","10","64"
|
||||
"232.91","69","female","partner","ever","Active","guideline","no","yes","no","2","5","yes","no","no","no","no","240.34","2","16","15","17","9","16","10","44"
|
||||
"264.65","47","male","partner","ever","Active","guideline","no","no","no","0","3","yes","no","no","no","no","305.28","1","16","15","14","10","9","4","68"
|
||||
"93.44","44","male","alone","never","Active","more","no","no","no","0","3","no","no","no","no","no","161.94","3","12","11","12","11","13","7","64"
|
||||
"132.5","69","male","partner","ever","Placebo","guideline","no","no","no","0","2","yes","no","no","no","no","179.53","0","12","6","10","10","11","6","60"
|
||||
"78.08","77","female","partner","never","Placebo","guideline","no","yes","no","0","15","yes","no","yes","no","no",NA,"1",NA,NA,NA,NA,NA,NA,NA
|
||||
"108.6","75","male","alone","ever","Placebo","guideline","no","no","no","0","1","yes","no","no","no","no",NA,"2","14","15","15","10","9","6","36"
|
||||
"33.93","86","female","alone","ever","Placebo","guideline","yes","no","no","2","24","yes","no","no","no","no","0","4","10","20","11","8","11","2","68"
|
||||
"574.26","70","male","partner","never","Placebo","guideline","no","yes","no","0","2","no","no","no","no","no","225.16","1","8","7","6","6","6","3","80"
|
||||
"309.5","56","male","partner","never","Active","guideline","no","no","no","0","1","yes","no","no","no","no","415.76","1","13","8","11","7","11","5","76"
|
||||
"247","48","female","partner","never","Placebo","guideline","no","no","no","0","12","yes","no","no","no","no","138.2","2","15","13","17","9","5","3","68"
|
||||
"136","55","male","partner","never","Active","guideline","no","no","no","0","13","yes","no","yes","no","no","172.2","0","13","7","13","7","7","6","52"
|
||||
"302.8","45","male","alone","never","Active","guideline","no","yes","no","0","0","no","no","no","no","no","101.4","2","12","17","13","9","7","4","92"
|
||||
NA,"79","male","partner","ever","Active","guideline","yes","yes","no","0","19","yes","no","yes","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"173.2","81","male","partner","never","Placebo","guideline","no","no","no","0","5","no","no","no","no","no","111.4","1","10","13","12","8","8","7","84"
|
||||
"129.11","79","male","alone","ever","Placebo","guideline","no","yes","no","0","1","no","no","no","yes","no","395.56","0","10","6","9","12","6","7","96"
|
||||
"218.23","57","male","alone","ever","Placebo","guideline","no","no","no","0","12","no","no","no","no","no","216.36","2","8","16","4","4","20","1","44"
|
||||
"229.16","83","male","alone","ever","Active","guideline","no","no","no","0","11","no","no","no","no","no","256.23","4","12","9","9","5","4","1","100"
|
||||
"136","82","male","alone","never","Placebo","guideline","no","yes","yes","1","18","no","no","no","no","no",NA,"4","17","20","20","4","4","18","16"
|
||||
"61","79","male","partner","never","Placebo","guideline","no","yes","no","2","2","no","yes","no","yes","no","27.2","2",NA,NA,NA,NA,NA,NA,NA
|
||||
"221.8","77","male","alone","never","Active","guideline","yes","yes","no","0","22","no","no","no","no","no","41.55","4",NA,NA,NA,NA,NA,"4","52"
|
||||
"149.16","49","male","partner","never","Placebo","guideline","no","no","no","1","2","no","no","no","no","no","256.55","2","10","7","6","6","5","1","80"
|
||||
"373.58","47","male","partner","ever","Active","guideline","no","no","no","0","6","yes","no","no","no","no","176.61","2","19","14","16","13","18","24","28"
|
||||
"204.6","81","female","alone","never","Active","guideline","no","no","no","0","6","no","no","no","no","no","115.03","1","17","9","13","5","5","9","60"
|
||||
"173.2","24","female","partner","ever","Active","guideline","no","no","no","0","1","no","no","no","no","no","171.2","2","10","13","8","8","6","6","64"
|
||||
"121","70","male","partner","never","Active","more","no","no","no","0","2","no","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"0","68","male","partner","ever","Placebo","guideline","yes","yes","yes","0","8","no","no","no","no","no",NA,"2","7","13","12","7","4","4","16"
|
||||
"121.4","80","male","partner","never","Active","guideline","no","no","no","0","5","no","no","no","no","no","4.51","2","5","6","7","7","4","0","88"
|
||||
"46","67","male","partner","never","Active","guideline","no","yes","no","1","18","yes","yes","no","no","no",NA,"4","18","20","20","9","4","18","68"
|
||||
"206","55","male","alone","ever","Active","guideline","no","no","no","0","1","no","no","no","no","no",NA,"1","9","10","8","4","4","6","88"
|
||||
"160.11","77","male","partner","ever","Placebo","guideline","no","no","no","0","4","no","no","yes","no","no","124.44","1","9","13","13","8","9","6","68"
|
||||
"60.61","71","female","partner","never","Active","guideline","no","yes","no","0","5","no","no","no","no","no","58.94","1","20","13","15","11","4","22","24"
|
||||
"128.49","63","female","partner","never","Placebo","guideline","no","yes","no","0","3","no","no","no","no","no","95.05","0",NA,NA,NA,NA,NA,NA,NA
|
||||
"5","62","male","partner","ever","Placebo","guideline","no","yes","yes","2","19","yes","no","no","yes","no","103.93","2","18","15","18","12","16","36","36"
|
||||
"98.17","61","male","partner","never","Active","more","no","yes","no","0","2","no","no","no","no","yes","157.12","3","5","10","5","8","9","9","80"
|
||||
"282.4","77","female","alone","never","Placebo","guideline","yes","yes","no","0","11","yes","no","no","no","no","180.6","3","11","9","9","7","5","9","72"
|
||||
"110.8","77","male","partner","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","58.6","1","11","7","7","7","5","7","72"
|
||||
"166.8","90","male","alone","never","Placebo","more","yes","yes","no","0","10","no","no","no","no","no","58.6","3","13","10","13","10","15","6","80"
|
||||
"162.45","71","female","alone","ever","Placebo","guideline","no","yes","no","0","1","yes","no","no","no","no","160.89","1","5","6","5","5","4","1","92"
|
||||
"156","68","female","alone","never","Active","more","no","yes","no","0","12","yes","no","no","no","no","85.69","2","4","4","4","8","11","1","100"
|
||||
"390.27","62","male","partner","ever","Active","guideline","no","no","yes","0","2","no","no","no","no","no","240.19","2","8","15","8","8","4","12","100"
|
||||
"155.96","57","male","partner","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","151.06","1","10","7","12","8","6","8","64"
|
||||
"58.6","72","male","alone","never","Placebo","more","no","no","no","0","7","no","no","no","no","no",NA,"2","15","18","15","6","4","5","56"
|
||||
"179.87","79","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","yes","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
"75.8","76","female","partner","never","Active","guideline","no","yes","no","0","3","no","no","no","no","no","59.7","2","19","14","18","8","4","8","64"
|
||||
"0","67","male","partner","never","Active","guideline","no","no","no","0","3","no","no","no","no","no","119.05","2","6","14","10","8","10","5","80"
|
||||
"131.8","66","male","partner","never","Placebo","guideline","no","no","no","0","1","no","no","no","no","no","101.4","1","10","10","8","7","5","4","76"
|
||||
"95.8","83","female","partner","never","Active","more","no","yes","no","1","2","no","no","no","no","no","56.4","2","10","12","20","9","5","15","24"
|
||||
"90","71","male","alone","never","Placebo","guideline","no","no","no","0","6","no","no","no","no","no","55","1","4","4","4","8","8","4","100"
|
||||
"67.63","68","male","alone","never","Placebo","guideline","no","yes","no","1","2","yes","no","no","no","no","137.89","2","8","11","9","5","8","3","84"
|
||||
"162.72","52","male","partner","never","Placebo","more","no","yes","no","0","3","yes","no","no","no","no","347.78","0","6","6","7","6","6","3","76"
|
||||
"227.33","80","male","partner","never","Active","guideline","no","yes","no","0","2","no","no","no","no","no","284.33","1","6","4","8","4","4",NA,"100"
|
||||
"168.48","84","male","partner","never","Placebo","guideline","yes","yes","yes","1","1","no","no","no","no","no","152.72","1","10","9","8","8","8","6","76"
|
||||
"229.2","50","male","partner","never","Placebo","guideline","no","no","no","0","3","no","no","no","no","no",NA,"2","11","10","14",NA,"15","16","76"
|
||||
"197.15","44","male","partner","ever","Placebo","guideline","no","no","no","0","7","yes","no","no","no","no","245.75","1","8","4","9","5","7","6","76"
|
||||
NA,"63","male","partner","never","Placebo","guideline","no","no","no","0","2","yes","no","no","no","no",NA,NA,NA,NA,NA,NA,NA,NA,NA
|
||||
|
145
2 Longterm/dags.R
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
## Everything
|
||||
|
||||
dag <- 'dag {
|
||||
bb="-4.79,-6.035,4.818,5.504"
|
||||
SES [pos="-4.463,-2.925"]
|
||||
ad_treat [pos="2.007,-1.567"]
|
||||
afli [pos="0.028,-1.851"]
|
||||
age [pos="-1.242,-0.765"]
|
||||
alc [pos="-3.716,-0.111"]
|
||||
ami [pos="-3.137,3.986"]
|
||||
civil [pos="-4.099,0.703"]
|
||||
diabetes [pos="-3.838,3.579"]
|
||||
education [pos="-3.632,-3.678"]
|
||||
gen_PA [pos="-2.820,-1.247"]
|
||||
hypertension [pos="-4.034,2.468"]
|
||||
mrs_0 [pos="-1.746,2.715"]
|
||||
mrs_1 [pos="1.326,-0.469"]
|
||||
nihss_0 [pos="0.271,1.296"]
|
||||
pase_0 [exposure,pos="-0.542,0.173"]
|
||||
revasc [pos="0.980,2.332"]
|
||||
rtreat [pos="2.334,2.036"]
|
||||
sex [pos="-4.538,-0.778"]
|
||||
smoker [pos="-1.877,-2.160"]
|
||||
stroke [adjusted,pos="0.766,0.321"]
|
||||
svd [latent,pos="-2.400,1.493"]
|
||||
tci [pos="-2.418,4.467"]
|
||||
vasc_event [outcome,pos="3.754,0.358"]
|
||||
SES -> ad_treat
|
||||
SES -> age
|
||||
SES -> alc
|
||||
SES -> gen_PA
|
||||
SES -> stroke
|
||||
SES -> vasc_event
|
||||
ad_treat -> vasc_event
|
||||
afli -> pase_0
|
||||
afli -> stroke
|
||||
afli -> vasc_event
|
||||
age -> afli
|
||||
age -> civil
|
||||
age -> mrs_1
|
||||
age -> nihss_0
|
||||
age -> vasc_event
|
||||
alc -> hypertension
|
||||
alc -> pase_0
|
||||
alc -> stroke
|
||||
alc -> svd
|
||||
alc -> vasc_event
|
||||
ami -> afli
|
||||
ami -> mrs_0
|
||||
ami -> stroke
|
||||
ami -> vasc_event
|
||||
civil -> pase_0
|
||||
civil -> stroke
|
||||
civil -> vasc_event
|
||||
diabetes -> mrs_0
|
||||
diabetes -> nihss_0
|
||||
diabetes -> stroke
|
||||
diabetes -> svd
|
||||
diabetes -> vasc_event
|
||||
education -> SES
|
||||
education -> ad_treat
|
||||
education -> age
|
||||
education -> alc
|
||||
education -> gen_PA
|
||||
education -> stroke
|
||||
education -> vasc_event
|
||||
gen_PA -> ami
|
||||
gen_PA -> diabetes
|
||||
gen_PA -> hypertension
|
||||
gen_PA -> pase_0
|
||||
gen_PA -> smoker
|
||||
gen_PA -> tci
|
||||
hypertension -> afli
|
||||
hypertension -> mrs_0
|
||||
hypertension -> nihss_0
|
||||
hypertension -> stroke
|
||||
hypertension -> svd
|
||||
hypertension -> vasc_event
|
||||
mrs_0 -> pase_0
|
||||
mrs_0 -> revasc
|
||||
mrs_1 -> ad_treat
|
||||
mrs_1 -> vasc_event
|
||||
nihss_0 -> revasc
|
||||
pase_0 -> ad_treat
|
||||
pase_0 -> nihss_0
|
||||
pase_0 -> stroke
|
||||
revasc -> mrs_1
|
||||
rtreat -> mrs_1
|
||||
rtreat -> vasc_event
|
||||
sex -> ad_treat
|
||||
sex -> alc
|
||||
sex -> education
|
||||
sex -> mrs_1
|
||||
sex -> pase_0
|
||||
sex -> stroke
|
||||
sex -> vasc_event
|
||||
smoker -> age
|
||||
smoker -> mrs_1
|
||||
smoker -> vasc_event
|
||||
stroke -> mrs_1
|
||||
stroke -> nihss_0
|
||||
stroke -> rtreat
|
||||
stroke -> vasc_event
|
||||
svd -> mrs_0
|
||||
svd -> pase_0
|
||||
svd -> vasc_event
|
||||
tci -> mrs_0
|
||||
tci -> stroke
|
||||
tci -> vasc_event
|
||||
}'
|
||||
|
||||
|
||||
## Simplified
|
||||
|
||||
dag <- 'dag {
|
||||
bb="-4.79,-6.035,4.818,5.504"
|
||||
"Higher SES" [pos="-1.671,-1.740"]
|
||||
"U: higher svd score" [latent,pos="-3.091,2.172"]
|
||||
"active treat" [pos="1.914,3.209"]
|
||||
"higher PA" [exposure,pos="-0.999,0.555"]
|
||||
"lower mrs_0" [pos="-2.437,1.259"]
|
||||
ad_treat [pos="-0.448,-0.358"]
|
||||
cardio_vasc [pos="-4.202,0.839"]
|
||||
male [pos="-3.119,-0.926"]
|
||||
vasc_event [outcome,pos="3.754,0.358"]
|
||||
"Higher SES" -> "higher PA"
|
||||
"Higher SES" -> ad_treat
|
||||
"Higher SES" -> vasc_event
|
||||
"U: higher svd score" -> "lower mrs_0"
|
||||
"U: higher svd score" -> vasc_event
|
||||
"active treat" -> vasc_event
|
||||
"higher PA" -> ad_treat
|
||||
"higher PA" -> vasc_event
|
||||
"lower mrs_0" -> "higher PA"
|
||||
ad_treat -> vasc_event
|
||||
cardio_vasc -> "U: higher svd score"
|
||||
cardio_vasc -> "higher PA" [pos="-2.876,-0.185"]
|
||||
cardio_vasc -> "lower mrs_0"
|
||||
cardio_vasc -> vasc_event [pos="-4.762,5.060"]
|
||||
male -> "higher PA"
|
||||
male -> vasc_event [pos="-2.540,-5.134"]
|
||||
}'
|
||||
|
||||
dag |> ggdag::ggdag_adjustment_set(node_size = 14, text_col = "black") +
|
||||
theme(legend.position = "bottom")
|
||||
260
2 Longterm/data.R
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
##
|
||||
## Data pull and export for Forskermaskinen
|
||||
##
|
||||
## Exports are made in REDCap instead
|
||||
##
|
||||
## Data set is made here, not in REDCap, as data here is better organised.
|
||||
##
|
||||
|
||||
library(haven)
|
||||
library(dplyr)
|
||||
library(purrr)
|
||||
|
||||
## All data
|
||||
# source("2 Longterm/data_import_files.R")
|
||||
source("/Users/au301842/PAaSO/2 Longterm/data_import_api.R")
|
||||
|
||||
## Helpers
|
||||
source("/Users/au301842/PAaSO/2 Longterm/funs.R")
|
||||
|
||||
# Streamlining missings for easier handling
|
||||
|
||||
# NA values
|
||||
## Empty fields ("") are not included as NA, to ease later corrections.
|
||||
nas <- c("9.", "9. NA", "Not available", "Not relevant (filter/fold)")
|
||||
|
||||
# Replaces all NAs in factors, and rejoins data frame
|
||||
# Factors keeps old levels; doesn't matter when exported as .csv and reimported...
|
||||
ls_nas <- lapply(seq_along(ls_sel), function(i) {
|
||||
ds <- ls_sel[[i]] |> select(starts_with("talos_")
|
||||
# & where(is.factor)
|
||||
) |>
|
||||
data.frame()
|
||||
|
||||
ds_n <- lapply(seq_len(ncol(ds)),function(j){
|
||||
as.character(if_else(ds[,j] %in% nas, NA, ds[,j]))
|
||||
}) |> bind_cols()
|
||||
|
||||
colnames(ds_n) <- colnames(ds)
|
||||
|
||||
ds_sub <- ls_sel[[i]] |> select(-colnames(ds_n))
|
||||
|
||||
ds_fin <- tibble(ds_sub,ds_n)
|
||||
|
||||
ds_fin |> select(colnames(ls_sel[[i]])) |> select(-grep("[0-9]x$",colnames(ls_sel[[i]])))
|
||||
})
|
||||
|
||||
names(ls_nas) <- names(ls_sel)
|
||||
|
||||
|
||||
|
||||
## MFI domain scores
|
||||
|
||||
# MFI variables to reverse
|
||||
# -> Create MFI function
|
||||
mfi_rev <- tolower(c("TALOS_MFI02","TALOS_MFI05","TALOS_MFI09","TALOS_MFI10","TALOS_MFI13","TALOS_MFI14","TALOS_MFI16","TALOS_MFI17","TALOS_MFI18","TALOS_MFI19"))
|
||||
|
||||
match(mfi_rev,colnames(ls_nas$mfi|> select(matches(paste0("talos_mfi",stRoke::add_padding(1:20))))))
|
||||
|
||||
domain_scores <- ls_nas$mfi |> select(matches(paste0("talos_mfi",stRoke::add_padding(1:20)))) |> mfi_domains(var = mfi_rev)
|
||||
|
||||
colnames(domain_scores) <- paste0("talos_mfi_",colnames(domain_scores))
|
||||
|
||||
ls_nas$mfi <- tibble(ls_nas$mfi,domain_scores)
|
||||
|
||||
## SDMT score correction
|
||||
|
||||
# Correction table
|
||||
#
|
||||
# Holds manually determined 90 second times, additionally, "2015-02-18" is used
|
||||
# as cut date for change from 60 seconds to 90 seconds
|
||||
#
|
||||
#
|
||||
|
||||
if (FALSE){
|
||||
sdmt_time<-openxlsx::read.xlsx("/Volumes/Data/source/tid.sdmt.xlsx") |>
|
||||
tidyr::pivot_longer(cols = c(tid.1md, tid.6md)) |> mutate(deltager=as.character(deltager))
|
||||
sdmt_time$name <- as.double(as.character(factor(sdmt_time$name,labels = c("2","4"))))
|
||||
|
||||
# Setting cut date
|
||||
sdmt_cut<-as.Date("2015-02-18")
|
||||
|
||||
# Joining datasets to have date of visit
|
||||
sdmt_corr <- left_join(ls_nas$sdmt,sdmt_time |> mutate(name=as.character(name)), by = c("rnumb"="deltager","instance"="name"))
|
||||
|
||||
# Modyfying old correction table to be complete
|
||||
sdmt_corr$value <- if_else(sdmt_corr$talos_sdmt00<sdmt_cut|sdmt_corr$value==60,60,90,missing = 90)
|
||||
|
||||
# Write for database upload and easier future handling
|
||||
# write.csv(select(sdmt_corr, rnumb, instance, value),"2 Longterm/sdmt_time_correction.csv")
|
||||
|
||||
# Multiplying meassure by correction valued turned weight and rounded
|
||||
sdmt_corr$talos_sdmt01a <- round(as.numeric(sdmt_corr$talos_sdmt01a)*(90/sdmt_corr$value),0)
|
||||
|
||||
|
||||
|
||||
ls_nas$sdmt <- sdmt_corr
|
||||
}
|
||||
|
||||
## PASE sum score
|
||||
|
||||
pase_index <- stRoke::str_extract(colnames(stRoke::pase),"[0-9]{2}.*$")
|
||||
|
||||
## Sourcing the newest pase_calc()
|
||||
source("/Users/au301842/stRoke/R/pase_calc.R")
|
||||
|
||||
pase_scores <- ls_nas$pase |> select(ends_with(pase_index)) |>
|
||||
pase_calc(adjust_work = FALSE)
|
||||
|
||||
ensure_prefix <- function(vec,prefix){
|
||||
ifelse(!grepl(paste0("^",prefix),vec),paste0(prefix,vec),vec)
|
||||
}
|
||||
|
||||
colnames(pase_scores) <- colnames(pase_scores)# |> ensure_prefix(prefix="pase_")
|
||||
|
||||
last_cols <- function(ds, n){
|
||||
ds[,(ncol(ds)-n+1):ncol(ds)]}
|
||||
|
||||
pase_scores_work <- ls_nas$pase |> select(ends_with(pase_index)) |>
|
||||
pase_calc(adjust_work = TRUE) |> last_cols(4) %>%
|
||||
rename_with(~ paste0(., "_w"))
|
||||
|
||||
colnames(pase_scores_work) <- colnames(pase_scores_work) #|> ensure_prefix(prefix="pase_")
|
||||
|
||||
ls_nas$pase <- tibble(ls_nas$pase,pase_scores,pase_scores_work)
|
||||
|
||||
## Registration correction
|
||||
|
||||
# Mutate all ends_with "00" as.Date in original data import file
|
||||
# source("2 Longterm/funs.R")
|
||||
|
||||
ls_corr <- lapply(ls_nas,time_reg_correction, ref=subjects)
|
||||
|
||||
run_eval=FALSE
|
||||
if (run_eval){
|
||||
library(compareDF)
|
||||
|
||||
ls_comp <- lapply(seq_along(ls_nas),function(i){
|
||||
compare_df(ls_corr[[i]],ls_nas[[i]],group_col = c("rnumb","instance"),stop_on_error = FALSE)
|
||||
})
|
||||
|
||||
ls_comp[[1]] |>
|
||||
create_output_table()
|
||||
}
|
||||
|
||||
ls_wide <- ls_corr |> longlist2wide()
|
||||
|
||||
df_wide <- ls_wide |> purrr::reduce(full_join,by="rnumb")
|
||||
|
||||
## The final assembly
|
||||
|
||||
df_ddv <- subjects |>
|
||||
mutate(rnumb=as.character(rnumb)) |>
|
||||
left_join(df_wide %>%
|
||||
## Keep only first "SITE" occurance
|
||||
## Using magrittr pipe for easy placeholder use
|
||||
select(-grep("_site_",colnames(.))[-1])
|
||||
)
|
||||
|
||||
# write.csv(df_ddv,"/Volumes/Data/REDCap/DDV/talos_ddv.csv",row.names = FALSE)
|
||||
|
||||
|
||||
## Generate data description
|
||||
attr_files <- list.files("/Users/au301842/PAaSO/REDCap/attr",pattern = ".csv$",full.names = TRUE)
|
||||
attr_files_short <- list.files("/Users/au301842/PAaSO/REDCap/attr",pattern = ".csv$",full.names = FALSE)
|
||||
|
||||
nms <- do.call(c,lapply(strsplit(attr_files_short,"_"),"[[",2)) |> gsub("['.']csv","",x=_) |> tolower()
|
||||
|
||||
attr_lst <- lapply(attr_files,read.csv)
|
||||
names(attr_lst) <- nms
|
||||
|
||||
attr_df <- lapply(seq_along(attr_lst),function(i){
|
||||
|
||||
data.frame(name = tolower(ifelse(
|
||||
!grepl("^TALOS|cpr|record_id", attr_lst[[i]][, 1]),
|
||||
paste0(nms[i], "_", attr_lst[[i]][, 1]),
|
||||
attr_lst[[i]][, 1]
|
||||
)),
|
||||
attr = attr_lst[[i]][, 2],
|
||||
instr = paste(toupper(nms[i]),"instrument"))
|
||||
|
||||
}) |> bind_rows()
|
||||
|
||||
attr_df$attr[grepl("sys_date$",attr_df$name)] <- "System date"
|
||||
attr_df$attr[grepl("sys_site$",attr_df$name)] <- "Trial site"
|
||||
attr_uni <- attr_df[!duplicated(attr_df$name),]
|
||||
|
||||
# data.frame(variabel=colnames(df_ddv),
|
||||
# visit=stRoke::str_extract(colnames(df_ddv),"[0124]$"),
|
||||
# attr_df[match(gsub("_[0124]$","",colnames(df_ddv)),attr_df$name),-1]) |>
|
||||
# write.csv("REDCap/ddv_variabelbeskrivelse_raw.csv",row.names = FALSE)
|
||||
#
|
||||
# read.csv("REDCap/ddv_variabelbeskrivelse.csv") |>
|
||||
# filter_at(1,all_vars(.%in%colnames(df_ddv))) |>
|
||||
# write.csv("REDCap/ddv_variabelbeskrivelse_mod.csv",row.names = FALSE)
|
||||
|
||||
|
||||
is.na(ds$talos_pase01_0) |> summary()
|
||||
|
||||
|
||||
|
||||
## Cumulated data
|
||||
|
||||
# dta<-read.csv("/Volumes/Data/exercise/source/background.csv",colClasses = "character", na.strings = c("NA","","unknown"))
|
||||
#
|
||||
# export<-dta[,c("pase_0",
|
||||
# "age",
|
||||
# "sex",
|
||||
# "civil",
|
||||
# "smoker",
|
||||
# "rtreat",
|
||||
# "alc",
|
||||
# "afli",
|
||||
# "hypertension",
|
||||
# "diabetes",
|
||||
# "mrs_0",
|
||||
# "nihss_c",
|
||||
# "thrombolysis",
|
||||
# "pad",
|
||||
# "thrombechtomy",
|
||||
# "ami",
|
||||
# "tci",
|
||||
# "rdate",
|
||||
# "cpr",
|
||||
# "rnumb",
|
||||
# "height",
|
||||
# "weight",
|
||||
# "weight_est",
|
||||
# "inc_time",
|
||||
# "compliant",
|
||||
# "mrs_1",
|
||||
# "mrs_6",
|
||||
# "pase_6",
|
||||
# "visit_1",
|
||||
# "visit_6")]
|
||||
|
||||
# export$diabetes[is.na(export$diabetes)]<-"no"
|
||||
# export$hypertension[is.na(export$hypertension)]<-"no"
|
||||
# export$thrombolysis[is.na(export$thrombolysis)]<-"no"
|
||||
# export$thrombechtomy[is.na(export$thrombechtomy)]<-"no"
|
||||
# export$pad[is.na(export$pad)]<-"no"
|
||||
# export$ami[is.na(export$ami)]<-"no"
|
||||
# export$inc_time[export$inc_time<0]<-0
|
||||
# export$compliant<-as.numeric(factor(export$compliant))
|
||||
# export$rdate<-as.Date(export$rdate)
|
||||
# export$mrs_0[export$mrs_0==3]<-NA
|
||||
|
||||
# export <- export|>
|
||||
# mutate(any_rep=factor(ifelse(thrombolysis=="yes"|thrombechtomy=="yes","yes","no")), # If not noted, no therapy was received
|
||||
# weight=ifelse(is.na(weight),weight_est,weight))|>
|
||||
# select(-c(weight_est))
|
||||
#
|
||||
# dput(names(export))
|
||||
|
||||
# write.csv(export|>select(c(rnumb,rtreat)),"/Volumes/Data/SDS upload/study_treatment.csv",row.names = FALSE)
|
||||
# write.csv(export,"/Volumes/Data/SDS upload/data_all.csv",row.names = FALSE)
|
||||
# write.csv(export|>select(-c(rtreat)),"/Volumes/Data/SDS upload/background.csv",row.names = FALSE)
|
||||
|
||||
# max(export$visit_6[!is.na(export$visit_6)])
|
||||
|
||||
|
||||
110
2 Longterm/data_import_api.R
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
|
||||
token=keyring::key_get("TALOS_REDCAP_API")
|
||||
|
||||
## Primary data set of recorded data
|
||||
|
||||
inst <- REDCapR::redcap_instruments(redcap_uri = "https://redcap.au.dk/api/",token = token)$data
|
||||
|
||||
tools <- tolower(c(
|
||||
"PASE",
|
||||
"MFI",
|
||||
"mdi",
|
||||
"mmse",
|
||||
"mrs",
|
||||
"SDMT",
|
||||
"who",
|
||||
"ham",
|
||||
"bi",
|
||||
"grad",
|
||||
"nihss"
|
||||
))
|
||||
|
||||
vec_starts_with <- function(d,v){
|
||||
filt <- paste0("^(", paste(v, collapse="|"), ")")
|
||||
|
||||
d[grep(filt,d)]
|
||||
}
|
||||
|
||||
vec_ends_with <- function(d,v){
|
||||
filt <- paste0("(", paste(v, collapse="|"), ")$")
|
||||
# sub(paste0(".*?_(",paste(v,collapse = "|"),")$"),"\\1",colnames(d))
|
||||
d[grep(filt,d)]
|
||||
}
|
||||
|
||||
# vec_starts_with(inst$instrument_name,tools)
|
||||
|
||||
data <- REDCapR::redcap_read(redcap_uri = "https://redcap.au.dk/api/",token = token,
|
||||
forms = vec_starts_with(inst$instrument_name,tools),
|
||||
fields = "record_id")$data
|
||||
|
||||
ds <- data |> select(!ends_with("complete"))
|
||||
|
||||
talos2long <- function(ds,exclude=c("talos","record"),instance_vals=c("0","1","2","4"),exclude_col_ends=c("user","lock")){
|
||||
nms <- unique(do.call(c,lapply(strsplit(colnames(ds),"_"),"[[",1)))
|
||||
nms <- nms[!nms %in% exclude]
|
||||
|
||||
ls <- lapply(seq_along(nms),function(i){
|
||||
cols <- c("record_id",vec_starts_with(colnames(ds),c(paste0("talos_",nms[i]),nms[i])))
|
||||
|
||||
d <- select(ds,all_of(cols))
|
||||
|
||||
ends <- unique(do.call(c,lapply(strsplit(colnames(d),"_"),function(i){
|
||||
i[length(i)]
|
||||
})))
|
||||
|
||||
ins <- colnames(d) %in% vec_ends_with(colnames(d),paste0("_",instance_vals))
|
||||
|
||||
ls_ins <- split.default(d[-1],factor(stRoke::str_extract(colnames(d[ins]),paste0("[",paste(instance_vals,collapse=""),"]$"))))
|
||||
|
||||
dat <- lapply(seq_along(ls_ins),function(i){
|
||||
dr <- cbind(d[1],instance=names(ls_ins)[i],ls_ins[[i]])
|
||||
colnames(dr) <- unique(gsub(pattern = paste0("_[",paste(instance_vals,collapse=""),"]$"),"",colnames(dr)))
|
||||
dr |> select(record_id,contains("_sys_"),instance,everything())
|
||||
}) |> bind_rows() |> rename(rnumb=record_id) |> mutate(rnumb=as.character(rnumb))
|
||||
|
||||
## Col name ending on 00 is date col of measure in all tools
|
||||
dat[,vec_ends_with(colnames(dat),"00")] <- as.Date(dat[,vec_ends_with(colnames(dat),"00")])
|
||||
|
||||
dat |> select(!ends_with(exclude_col_ends))
|
||||
})
|
||||
|
||||
names(ls) <- nms
|
||||
ls
|
||||
|
||||
}
|
||||
|
||||
ls_sel <- data |> select(!ends_with("complete"))|> talos2long()
|
||||
|
||||
## Data set of baseline and DAP data
|
||||
|
||||
subjects_raw <-
|
||||
REDCapR::redcap_read(
|
||||
redcap_uri = "https://redcap.au.dk/api/",
|
||||
token = token,
|
||||
forms = vec_starts_with(inst$instrument_name, c("end", "inkl", "reg", "basis")),
|
||||
fields = "record_id"
|
||||
)$data
|
||||
|
||||
subjects <- subjects_raw |>
|
||||
select(
|
||||
record_id,
|
||||
talos_end00,
|
||||
talos_end01,
|
||||
rdate,
|
||||
rtreat,
|
||||
cpr,
|
||||
basis_kon,
|
||||
starts_with("reg_")
|
||||
) |> select(!ends_with("complete")) |>
|
||||
rename(rnumb = record_id,
|
||||
enddate = talos_end00,
|
||||
eos_early = talos_end01,
|
||||
sex=basis_kon) |>
|
||||
mutate(
|
||||
enddate = as.Date(enddate),
|
||||
rdate = as.Date(rdate),
|
||||
inc_time = as.numeric(difftime(enddate, rdate, units = "days")),
|
||||
age = stRoke::age_calc(as.Date(stRoke::cpr_dob(cpr,"%Y-%m-%d")),enddate=rdate)
|
||||
)
|
||||
|
||||
# colnames(subjects) <- gsub("^reg_","",colnames(subjects))
|
||||
49
2 Longterm/data_import_files.R
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Specifying needed data collection files
|
||||
data_source <- c(
|
||||
"PASE_rev_v13.dta",
|
||||
"MFI_rev_v13.dta",
|
||||
"mdi_rev_v13.dta",
|
||||
"mmse_rev_v13.dta",
|
||||
"mrs_rev_v13.dta",
|
||||
"SDMT_rev_v13.dta",
|
||||
"who_rev_v13.dta"
|
||||
)
|
||||
|
||||
## Cumulated data
|
||||
dta<-read.csv("/Volumes/Data/exercise/source/background.csv",colClasses = "character", na.strings = c("NA","","unknown"))
|
||||
|
||||
# Getting full filenames
|
||||
file_nms <- list.files("/Volumes/Data/STATA13",full.names = TRUE)[match(data_source,list.files("/Volumes/Data/STATA13"))]
|
||||
|
||||
# Loading datafiles
|
||||
|
||||
dta<-read.csv("/Volumes/Data/exercise/source/background.csv",colClasses = "character", na.strings = c("NA","","unknown"))
|
||||
|
||||
ls <- lapply(file_nms,function(i){
|
||||
d <- read_dta(i)
|
||||
colnames(d) <- tolower(gsub("instance","INSTANCE",colnames(d))) #in the sdmt dataset, instance column is lower case
|
||||
d
|
||||
})
|
||||
|
||||
# Selecting desired variables
|
||||
ls_sel <- lapply(seq_along(ls), function(i) {
|
||||
ls[[i]] |> select(cpr,
|
||||
SYS_SITE,
|
||||
INSTANCE,
|
||||
starts_with("TALOS_")) |> as_factor() |>
|
||||
full_join(select(dta,cpr, rnumb)) |> select(rnumb,everything())
|
||||
})
|
||||
|
||||
# Naming lists according to file names
|
||||
names(ls_sel) <- tolower(unlist(lapply(data_source,function(x){strsplit(x,"_")[[1]][1]})))
|
||||
|
||||
## Screening list and EOS data
|
||||
subjects <- read_dta("/Volumes/Data/STATA13/inkl_rev_v13.dta") |>
|
||||
select(c("cpr", "rnumb", "rdate", "rtreat")) |>
|
||||
filter(rnumb != 999) |>
|
||||
left_join(read_dta("/Volumes/Data/STATA13/end_rev_v13.dta") |>
|
||||
select(c("cpr", "TALOS_end00", "TALOS_end01"))
|
||||
) |>
|
||||
rename(enddate = TALOS_end00,
|
||||
eos_early = TALOS_end01) |>
|
||||
as_factor()
|
||||
33
2 Longterm/flowchart.R
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
data <- list(a=1000, b=800, c=600, d=400)
|
||||
|
||||
|
||||
DiagrammeR::grViz("
|
||||
digraph graph2 {
|
||||
|
||||
graph [layout = dot]
|
||||
|
||||
# node definitions with substituted label text
|
||||
node [shape = rectangle, width = 4, fillcolor = Biege]
|
||||
a [label = '@@1']
|
||||
b [label = '@@2']
|
||||
c [label = '@@3']
|
||||
node [shape = rectangle, width = 2, fillcolor = Biege]
|
||||
d [label = '@@4']
|
||||
e [label = '@@5']
|
||||
|
||||
a -> b -> c [dir=s]
|
||||
a -> d [dir=e]
|
||||
b -> e [dir=e]
|
||||
# c -> f
|
||||
|
||||
{rank=same; a -> b -> c [dir=s]}
|
||||
|
||||
}
|
||||
|
||||
[1]: paste0('All patients in TALOS (n = ', data$a, ')')
|
||||
[2]: paste0('Patients with PASE (n = ', data$b, ')')
|
||||
[3]: paste0('Patients with first event after follow-up (n = ', data$c, ')')
|
||||
[4]: paste0('Excluded due to missing PASE (n = ', data$d, ')')
|
||||
[5]: paste0('Excluded due to early event (n = ', data$d, ')')
|
||||
# [6]: paste0('Excluded due to missing PASE (n = ', data$d, ')')
|
||||
")
|
||||
248
2 Longterm/funs.R
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
|
||||
## Utils
|
||||
|
||||
multi_rev <- function(ds, var){
|
||||
ndx <- match(var,colnames(ds))
|
||||
for (i in seq_along(ndx)){
|
||||
j <- ndx[i]
|
||||
ds[[j]]<-as.character(factor(ds[[j]],labels = c(rev(levels(factor(ds[[j]]))))))
|
||||
}
|
||||
ds
|
||||
}
|
||||
|
||||
reg2score <- function(ds){
|
||||
# Removes all padding from registred scores
|
||||
l <- c()
|
||||
for (i in seq_len(ncol(ds))){
|
||||
l[[i]] <- gsub("[^a-zA-Z0-9]","",ds[[i]])
|
||||
}
|
||||
|
||||
d <- do.call(cbind,l) |> data.frame()
|
||||
|
||||
colnames(d) <- colnames(ds)
|
||||
d |> tibble()
|
||||
}
|
||||
|
||||
|
||||
|
||||
## MFI modding
|
||||
|
||||
mfi_domains <- function(ds, reverse=TRUE, var){
|
||||
|
||||
# Subscore indexes
|
||||
indexes <- list(
|
||||
data.frame(grp="gen", ndx=c(1, 5, 12, 16)),
|
||||
data.frame(grp="phy", ndx=c(2, 8, 14, 20)),
|
||||
data.frame(grp="act", ndx=c(3, 6, 10, 17)),
|
||||
data.frame(grp="mot", ndx=c(4, 9, 15, 18)),
|
||||
data.frame(grp="men", ndx=c(7, 11, 13, 19))
|
||||
) |> bind_rows() |> arrange(ndx)
|
||||
|
||||
# Assumes reverse scores are not correctly reversed
|
||||
if (reverse){ds <- ds |> multi_rev(var)}
|
||||
|
||||
# Removes padding and converts to numeric
|
||||
d <- ds |> reg2score() |>
|
||||
mutate_if(is.character, as.numeric)
|
||||
|
||||
split.default(d, factor(indexes$grp)) |>
|
||||
lapply(function(x){
|
||||
apply(x, MARGIN = 1, sum)
|
||||
}) |> bind_cols()
|
||||
|
||||
}
|
||||
|
||||
## Registration correction
|
||||
|
||||
# 1. If the inc_time is 38 days or less MDI 6 scores are moved to MDI 1 and visit 6 is defined as visit 1.
|
||||
# 2. If both visit 1 and 6 dates are NA, use enddate as visit 1 date. This is the case if patients were excluded early.
|
||||
# 3. If visit 6 is recorded later than enddate, use enddate instead. MDI 6 score is dropped.
|
||||
# 4. If visit delay is 7 days or less, and inclusion time is more than 38, MDI 1 is moved to MDI 6 and dropped. If MDI 1 and 6 are different both are kept. Enddate is moved to visit 6 date.
|
||||
# 5. Defining the visit 6 date as same as enddate if visit delay is <7.
|
||||
|
||||
# ds <- ls_nas$mdi
|
||||
# ref <- subjects
|
||||
|
||||
|
||||
time_reg_correction <- function(ds, ref) {
|
||||
|
||||
# Splitting by rnumb, to treat each subj
|
||||
ls <- split(ds, ds$rnumb)
|
||||
|
||||
# ref: https://r-coder.com/progress-bar-r/
|
||||
# Setting up simple progress bar
|
||||
pb <- txtProgressBar(min = 0, max = length(ls), style = 3)
|
||||
|
||||
|
||||
# Getting the rnumbs for subsetting in order of the list
|
||||
nms <- names(ls)
|
||||
# Applying correction to each element in list
|
||||
ls_c <- lapply(seq_along(ls), function(i) {
|
||||
cat(paste(i,"af",length(ls)))
|
||||
# Updates the current state
|
||||
setTxtProgressBar(pb, i)
|
||||
|
||||
# Current rnumb
|
||||
nm <- nms[i]
|
||||
# print(i)
|
||||
df <- ls[[i]]
|
||||
# Only run if both instance 2 and 4 are present
|
||||
if (all(c(2, 4) %in% select(df, matches("instance", ignore.case = TRUE))[[1]])) {
|
||||
|
||||
# Define common variables
|
||||
inc_time <- as.numeric(ref$inc_time[ref$rnumb == nm])
|
||||
end_date <- as.Date(ref$enddate[ref$rnumb == nm])
|
||||
rdate <- as.Date(ref$rdate[ref$rnumb == nm])
|
||||
inst <- grep("instance", tolower(colnames(df)))
|
||||
|
||||
# Define relevant data columns to substitute/modify
|
||||
cols <- (inst + 1):ncol(df)
|
||||
|
||||
# Define date column index
|
||||
date_col_index <-
|
||||
match(colnames(select(df, ends_with("00"))), colnames(df))
|
||||
|
||||
# Step 1
|
||||
|
||||
## Correction if inc_time is performed
|
||||
if (inc_time <= 38 & all(is.na(df[df[inst] == 2, cols]))) {
|
||||
# Substitutions to transfer instance 4 meassures and leave as NA
|
||||
df[df[inst] == 2, cols] <- df[df[inst] == 4, cols]
|
||||
df[df[inst] == 4, -c(inst,date_col_index)] <- NA
|
||||
}
|
||||
|
||||
# Step 2
|
||||
|
||||
if (all(is.na(df[date_col_index]))) {
|
||||
# If both visit dates are missing, instance 2 date is substituted with enddate
|
||||
df[date_col_index][df[inst] == 2] <-
|
||||
as.character(end_date)
|
||||
}
|
||||
|
||||
# Step HELPA
|
||||
## Extra help step to impute enddate as visit 4 if instance 4 is present but no date.
|
||||
if (is.na(df[date_col_index][df[inst] == 4])){
|
||||
df[date_col_index][df[inst] == 4] <- as.character(end_date)
|
||||
}
|
||||
|
||||
## Last steps are only performed if date values are available for both instance 2 and 4
|
||||
if (!any(is.na(df[date_col_index]))){
|
||||
|
||||
# Step 3
|
||||
end_delay <- as.numeric(difftime(df[date_col_index][df[inst] == 4],
|
||||
end_date,
|
||||
units = "days"))
|
||||
|
||||
# If enddate is before last visit, the last visit data is dropped.
|
||||
if (end_delay > 2) {
|
||||
df[df[inst] == 4,-c(inst,date_col_index)] <- NA
|
||||
}
|
||||
|
||||
# Step 4
|
||||
visit_delay <-
|
||||
as.numeric(difftime(df[date_col_index][df[inst] == 4], df[date_col_index][df[inst] ==
|
||||
2], units = "days"))
|
||||
|
||||
if (purrr::is_empty(visit_delay)){
|
||||
visit_delay <- NA
|
||||
}
|
||||
|
||||
|
||||
## Test if data has manually been inserted at visit 2, though should should be visit 4 time wise
|
||||
second2fourth <-
|
||||
if_else((visit_delay <= 7 |
|
||||
all(is.na(df[df[inst] == 2, cols]))) &
|
||||
inc_time > 38,
|
||||
TRUE,
|
||||
FALSE,
|
||||
missing = FALSE)
|
||||
|
||||
## Move data from 2. visit to 4.
|
||||
if (second2fourth) {
|
||||
# df[date_col_index][df[inst] == 2]
|
||||
|
||||
## If all missing at last visit, 1. visit is copied
|
||||
if (all(is.na(df[df[inst] == 4, cols]))) {
|
||||
df[df[inst] == 4, cols] <- df[df[inst] == 2, cols]
|
||||
}
|
||||
|
||||
## If entries at visit 2 and 4 are identical, vist 2 is deleted
|
||||
if (identical(df[df[inst] == 4, cols], df[df[inst] == 2, cols])) {
|
||||
df[df[inst] == 2, -c(inst,date_col_index)] <- NA
|
||||
}
|
||||
|
||||
## If data entries are NA at visit 2, the date is also deleted
|
||||
if (all(is.na(df[df[inst] == 2, cols]))) {
|
||||
df[,date_col_index][df[inst] == 2] <- NA
|
||||
}
|
||||
|
||||
## The registered enddate is copied to the visit 4 date
|
||||
df[,date_col_index][df[inst] == 4] <-
|
||||
as.character(end_date)
|
||||
}
|
||||
|
||||
# Step 5
|
||||
## Ensure enddate is visit 4 if visit delay is <7
|
||||
if (visit_delay < 7) {
|
||||
df[,date_col_index][df[inst] == 4] <- as.character(end_date)
|
||||
}
|
||||
}
|
||||
}
|
||||
df
|
||||
})
|
||||
|
||||
ls_c |> bind_rows()
|
||||
|
||||
}
|
||||
|
||||
longlist2wide <-
|
||||
function(list,
|
||||
id.name = "rnumb",
|
||||
instance = "instance",
|
||||
inst.glue = "{.value}_{instance}") {
|
||||
|
||||
# ref: https://r-coder.com/progress-bar-r/
|
||||
# Setting up simple progress bar
|
||||
pb <- txtProgressBar(min = 0, max = length(list), style = 3)
|
||||
|
||||
l <- lapply(seq_along(list), function(i) {
|
||||
|
||||
# Updates the current state
|
||||
setTxtProgressBar(pb, i)
|
||||
|
||||
lst <- list[[i]] |> data.frame()
|
||||
|
||||
rep_inst <-
|
||||
length(levels(factor(lst[, colnames(lst) == instance]))) > 1
|
||||
|
||||
|
||||
k <- lapply(split(lst, f = lst[[id.name]]), function(j) {
|
||||
cname <- colnames(j)
|
||||
vals <-
|
||||
cname[!cname %in% c(id.name,
|
||||
instance)]
|
||||
s <- tidyr::pivot_wider(
|
||||
j,
|
||||
names_from = instance,
|
||||
values_from = all_of(vals),
|
||||
names_glue = inst.glue
|
||||
)
|
||||
s[!colnames(s) %in% instance]
|
||||
})
|
||||
|
||||
k |> dplyr::bind_rows()
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
na_recode <- function(ds,vars_na,new_na="no"){
|
||||
for (i in seq_along(vars_na)){
|
||||
ds[i][is.na(ds[i])] <- new_na
|
||||
}
|
||||
ds
|
||||
}
|
||||
|
||||
|
||||
|
||||
9
2 Longterm/generalised odds ratio.R
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
## Generaloised odds ratio
|
||||
##
|
||||
## Tournament based approach
|
||||
##
|
||||
|
||||
|
||||
library(genodds)
|
||||
|
||||
|
||||
26
2 Longterm/grotta_bars.R
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
library(rankinPlot)
|
||||
|
||||
?rankinPlot::grottaBar
|
||||
|
||||
dta<-read.csv("/Volumes/Data/exercise/source/background.csv",colClasses = "character", na.strings = c("NA","","unknown"))[,c("rtreat","mrs_0","mrs_1","mrs_6","hypertension","diabetes","civil")]
|
||||
|
||||
df <- dta |> select(c("rtreat","mrs_0","mrs_1","mrs_6")) |> pivot_longer(cols = -rtreat)
|
||||
|
||||
x<-table(mRS=df$value,
|
||||
Group=df$rtreat,
|
||||
Time = df$name)
|
||||
|
||||
grottaBar(x,groupName="Group",
|
||||
scoreName = "mRS",
|
||||
strataName="Time",
|
||||
colourScheme ="custom"
|
||||
) +
|
||||
scale_fill_viridis_d(direction=-1)
|
||||
|
||||
dta |> select(-c("mrs_0","mrs_1")) |> generic_stroke(group = "rtreat", score = "mrs_6", variables = c("hypertension","diabetes","civil"))
|
||||
|
||||
library(stRoke)
|
||||
cc<-dta[complete.cases(dta),]
|
||||
talos <- cc[sample(1:nrow(cc),200),] |> select(-mrs_0)
|
||||
|
||||
save(talos,file="talos.rda")
|
||||
173
2 Longterm/hr coef plot.R
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
source(here::here("1 PA Decline/dst import.R"))
|
||||
|
||||
file <- project.aid::docx2list("/Users/au301842/Library/CloudStorage/OneDrive-Personal/Research/PhD/2 TALOS opfølgning/Manuskript/Arkiv/Longterm risk_v1_0.docx", data.type = "table cell")
|
||||
|
||||
ds <- file |>
|
||||
purrr::pluck(3) |>
|
||||
(\(.x){
|
||||
setNames(.x, letters[seq_len(ncol(.x))])
|
||||
})() |>
|
||||
dplyr::filter(dplyr::row_number() <= dplyr::n() - 1) |>
|
||||
setNames(c("var", purrr::map(1:3, \(.x)paste0(c("hr", "ci"), .x)) |> purrr::list_c())) |>
|
||||
dplyr::mutate(dplyr::across(dplyr::everything(), ~ gsub("—", "", .x))) |>
|
||||
(\(.x){
|
||||
split.default(.x, factor(project.aid::str_extract(names(.x), "\\d$"), labels = c("Univariable", "Multivariable", "Imputed"))) |>
|
||||
purrr::imap(\(.y, .i){
|
||||
dplyr::bind_cols(var = .x[1], .y) |>
|
||||
tidyr::separate_wider_delim(
|
||||
col = dplyr::starts_with("ci"),
|
||||
delim = ", ",
|
||||
# names_sep = "_",
|
||||
too_few = "align_start",
|
||||
names = c("low", "high")
|
||||
) |>
|
||||
(\(.z){
|
||||
names(.z)[2] <- "hr"
|
||||
.z
|
||||
# setNames(c("var","hr","low","high"))
|
||||
})() |>
|
||||
dplyr::mutate(model = .i)
|
||||
})
|
||||
})() |>
|
||||
dplyr::bind_rows()
|
||||
|
||||
create_log_tics <- function(data) {
|
||||
sort(round(unique(c(1 / data, data)), 2))
|
||||
}
|
||||
|
||||
forest_plot <- function(data,
|
||||
group.colors = viridisLite::viridis(3,option = "D"),
|
||||
x.tics = create_log_tics(c(1, 1.5, 3, 6)),
|
||||
point.shape = rep(23, 3),
|
||||
legend.title = "",
|
||||
dodge.width = .8,
|
||||
wrap.col) {
|
||||
|
||||
data |>
|
||||
ggplot2::ggplot(ggplot2::aes(x = log(hr), y = labels, color = model, fill = model)) +
|
||||
ggplot2::geom_vline(ggplot2::aes(xintercept = 0), linewidth = .5, linetype = "dashed") +
|
||||
ggplot2::geom_point(ggplot2::aes(shape = model),
|
||||
# position = ggplot2::position_dodge(width = dodge.width),
|
||||
size = 7
|
||||
) +
|
||||
ggplot2::geom_errorbarh(ggplot2::aes(xmax = log(high), xmin = log(low)),
|
||||
# position = ggplot2::position_dodge(width = dodge.width),
|
||||
size = .5,
|
||||
height = .2,
|
||||
color = "gray50"
|
||||
) +
|
||||
# ggplot2::position_dodge(width = 2, preserve = "total")+
|
||||
ggplot2::scale_x_continuous(
|
||||
breaks = log(x.tics),
|
||||
labels = x.tics,
|
||||
limits = log(range(x.tics))
|
||||
) +
|
||||
ggplot2::scale_color_manual(values = group.colors) +
|
||||
ggplot2::scale_fill_manual(values = group.colors) +
|
||||
ggplot2::scale_shape_manual(values = point.shape) +
|
||||
ggplot2::theme_bw() +
|
||||
ggplot2::theme(
|
||||
panel.grid.minor = ggplot2::element_blank(),
|
||||
# legend.title = ggplot2::element_text(""),
|
||||
legend.position = "bottom"
|
||||
) +
|
||||
ggplot2::ylab("") +
|
||||
ggplot2::xlab("Hazards ratio (log)") +
|
||||
ggplot2::labs(
|
||||
shape = legend.title,
|
||||
color = legend.title,
|
||||
fill = legend.title
|
||||
) +
|
||||
ggplot2::facet_wrap(facets = ggplot2::vars(model), ncol = wrap.col)
|
||||
}
|
||||
|
||||
# LETTERS[1:8] |> purrr::map(\(.x){
|
||||
# viridisLite::viridis(3,option = .x)|>
|
||||
# project.aid::color_plot(ncol = 3)
|
||||
# }) |> patchwork::wrap_plots(ncol=1)
|
||||
|
||||
headers <- c("Clinical data","Lifestyle factors","Socioeconomic factors","Assessments at follow-up")
|
||||
|
||||
ds_new <- ds |>
|
||||
dplyr::mutate(dplyr::across(c("hr", "low", "high"), ~ as.numeric(.x)),
|
||||
var = factor(var, levels = rev(unique(var))),
|
||||
model = factor(model, levels = unique(model))
|
||||
) |>
|
||||
dplyr::mutate(level=apply(is.na(dplyr::pick(hr,low,high))|dplyr::pick(hr,low,high) == "",1,sum),
|
||||
labels=dplyr::case_when(level==3&var%in%headers~marquee::marquee_glue("**{var}**"),
|
||||
level==3&var!="Body mass index"~marquee::marquee_glue("*{var}*"),
|
||||
.default=marquee::marquee_glue("{var}")),
|
||||
labels = factor(labels, levels = rev(unique(labels))))
|
||||
|
||||
(p1 <- ds_new |> (\(.x){
|
||||
forest_plot(.x, wrap.col = length(levels(.x$model)))
|
||||
})()+
|
||||
ggplot2::theme(axis.text.y =marquee::element_marquee(vjust = .77,
|
||||
# hjust = -1,
|
||||
size=14)))
|
||||
|
||||
|
||||
ggplot2::ggsave(
|
||||
filename = here::here("2 Longterm/hr_plot_facets.png"),
|
||||
plot = p1+
|
||||
ggplot2::theme(
|
||||
strip.background = ggplot2::element_blank(),
|
||||
strip.text.x = ggplot2::element_blank(),
|
||||
legend.text = ggplot2::element_text(size=14),
|
||||
axis.text.x=ggplot2::element_text(size=10),
|
||||
axis.ticks.length.y = ggplot2::unit(3,"mm"),
|
||||
axis.ticks.y = ggplot2::element_line(color = "white")
|
||||
),
|
||||
units = "mm",
|
||||
width = 250,
|
||||
height = 300,
|
||||
# pointsize = 10,
|
||||
dpi = 300,
|
||||
)
|
||||
|
||||
|
||||
headers <- c("Clinical data","Lifestyle factors","Socioeconomic factors","Assessments at follow-up")
|
||||
|
||||
(t <- ds |>
|
||||
dplyr::mutate(dplyr::across(dplyr::everything(), ~ gsub("—", "", .x))) |>
|
||||
dplyr::mutate(dplyr::across(c("hr", "low", "high"), ~ as.numeric(.x)),
|
||||
var = factor(var, levels = rev(unique(var))),
|
||||
model = factor(model, levels = unique(model))
|
||||
) |>
|
||||
dplyr::mutate(level=apply(is.na(dplyr::pick(hr,low,high))|dplyr::pick(hr,low,high) == "",1,sum),
|
||||
labels=dplyr::case_when(level==3&var%in%headers~glue::glue("**{var}**"),
|
||||
level==3~glue::glue("*{var}*"),
|
||||
.default=glue::glue("{var}"))) |>
|
||||
dplyr::filter(model=="Univariable") |>
|
||||
ggplot2::ggplot(
|
||||
# ggplot2::aes(x = x, y = var)
|
||||
) +
|
||||
ggtext::geom_richtext(ggplot2::aes(x = 0, y = var,label = labels),fill = NA,
|
||||
label.colour = NA,
|
||||
hjust="right") +
|
||||
ggplot2::scale_x_continuous(
|
||||
limits = c(-.1,0)
|
||||
)+
|
||||
ggplot2::theme_void())
|
||||
|
||||
(w <- patchwork::wrap_plots(list(t,
|
||||
# patchwork::plot_spacer(),
|
||||
p1+
|
||||
ggplot2::theme(
|
||||
strip.background = ggplot2::element_blank(),
|
||||
strip.text.x = ggplot2::element_blank(),
|
||||
axis.text.y = ggplot2::element_blank(),
|
||||
plot.margin = ggplot2::unit(c(1,1,1,0), 'cm'),
|
||||
# axis.ticks.y.length = ggplot2::unit(0, "pt"),
|
||||
# axis.ticks.y = ggplot2::element_blank(),
|
||||
# panel.border=ggplot2::element_blank(),
|
||||
panel.spacing = ggplot2::unit(0, "cm")
|
||||
)),ncol=2,widths = c(1.2,3),axes = "collect"))
|
||||
|
||||
ggplot2::ggsave(
|
||||
filename = here::here("2 Longterm/hr_plot_facets_labels.png"),plot = w,
|
||||
units = "mm",
|
||||
width = 200,
|
||||
height = 220,
|
||||
dpi = 300,
|
||||
)
|
||||
BIN
2 Longterm/hr_plot_facets.png
Normal file
|
After Width: | Height: | Size: 438 KiB |
BIN
2 Longterm/hr_plot_facets_labels.png
Normal file
|
After Width: | Height: | Size: 338 KiB |
0
2 Longterm/import_mfi.R
Normal file
84
2 Longterm/kamila-clustering.R
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
## Not run:
|
||||
# import and format a mixed-type data set
|
||||
library(kamila)
|
||||
data(Byar, package='clustMD')
|
||||
|
||||
ds <- readr::read_csv("2 Longterm/assigndata.csv",na = c("","NA")) |> na.omit()
|
||||
|
||||
ds <- ds |> dplyr::mutate(mrs_1 = mrs_1>2)
|
||||
|
||||
cat_i <- lapply(ds,is.character) |> purrr::list_c()
|
||||
con_i <- lapply(ds,is.double) |> purrr::list_c()
|
||||
|
||||
xor(cat_i,con_i)
|
||||
|
||||
clin_clust=2
|
||||
# Byar$logSpap <- log(Byar$Serum.prostatic.acid.phosphatase)
|
||||
|
||||
# conInd <- c(5,6,8:10,16)
|
||||
# conVars <- Byar[,conInd]
|
||||
# conVars <- data.frame(scale(conVars))
|
||||
|
||||
conVars <- ds[,con_i]
|
||||
conVars <- data.frame(scale(conVars))
|
||||
|
||||
# catVarsFac <- Byar[,-c(1:2,conInd,11,14,15)]
|
||||
# catVarsFac[] <- lapply(catVarsFac, factor)
|
||||
# catVarsDum <- dummyCodeFactorDf(catVarsFac)
|
||||
|
||||
catVarsFac <- ds[,cat_i]
|
||||
catVarsFac <- lapply(catVarsFac, factor) |> dplyr::bind_cols() |> as.data.frame()
|
||||
catVarsDum <- dummyCodeFactorDf(catVarsFac)
|
||||
|
||||
# Modha-Spangler clustering with kmeans default Hartigan-Wong algorithm
|
||||
gmsResHw <- gmsClust(conVars, catVarsDum, nclust = clin_clust)
|
||||
|
||||
# Modha-Spangler clustering with kmeans Forgy-Lloyd algorithm
|
||||
# NOTE searchDensity should be >= 10 for optimal performance:
|
||||
# this is just a syntax demo
|
||||
gmsResLloyd <- gmsClust(conVars, catVarsDum, nclust = clin_clust,
|
||||
algorithm = "Lloyd", searchDensity = 15)
|
||||
|
||||
# KAMILA clustering
|
||||
kamRes <- kamila(conVars, catVarsFac, numClust=2:7, numInit=10, calcNumClust="ps")
|
||||
|
||||
# Plot results
|
||||
# ternarySurvival <- factor(Byar$SurvStat)
|
||||
# levels(ternarySurvival) <- c('Alive','DeadProst','DeadOther')[c(1,2,rep(3,8))]
|
||||
plottingData <- cbind(
|
||||
conVars,
|
||||
catVarsFac,
|
||||
KamilaCluster = factor(kamRes$finalMemb))
|
||||
# plottingData$Bone.metastases <- ifelse(
|
||||
# plottingData$Bone.metastases == '1', yes='Yes',no='No')
|
||||
#
|
||||
# # Plot Modha-Spangler/Hartigan-Wong results
|
||||
# msPlot <- ggplot(
|
||||
# plottingData,
|
||||
# aes(
|
||||
# x=logSpap,
|
||||
# y=Index.of.tumour.stage.and.histolic.grade,
|
||||
# color=ternarySurvival,
|
||||
# shape=MSCluster))
|
||||
# plotOpts <- function(pl) (pl + geom_point() +
|
||||
# scale_shape_manual(values=c(2,3,7)) + geom_jitter())
|
||||
# plotOpts(msPlot)
|
||||
|
||||
# Plot KAMILA results
|
||||
kamPlot <- ggplot(
|
||||
plottingData,
|
||||
aes(
|
||||
x=pase_0,
|
||||
y=pase_6,
|
||||
color=KamilaCluster,
|
||||
shape=KamilaCluster))
|
||||
plotOpts(kamPlot)
|
||||
|
||||
|
||||
plotting_ls <- tibble(KamilaCluster = factor(kamRes$finalMemb),
|
||||
MSCluster = factor(gmsResHw$results$cluster)) |>
|
||||
purrr::map(\(x) cbind(x, ds))
|
||||
|
||||
plotting_ls |> purrr::map(\(y) {
|
||||
y |> gtsummary::tbl_summary(by=x) |> gtsummary::add_p() |> gtsummary::add_overall()}) |>
|
||||
gtsummary::tbl_merge()
|
||||
114
2 Longterm/kmeans-clustering.R
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
ds <- readr::read_csv("2 Longterm/assigndata.csv", na = c("", "NA")) |> na.omit()
|
||||
|
||||
ds <- ds |> dplyr::mutate(mrs_1 = mrs_1 > 2)
|
||||
|
||||
|
||||
library(tidymodels)
|
||||
library(tidyverse)
|
||||
|
||||
ds |>
|
||||
na.omit() |>
|
||||
kmeans(centers = 3)
|
||||
|
||||
|
||||
ds_num <- ds |> mutate(
|
||||
across(where(is.double), ~ scale(.x)),
|
||||
across(is.character, ~ as.numeric(factor(.x)))
|
||||
)
|
||||
|
||||
ds_num |> kmeans(centers = 3)
|
||||
|
||||
set.seed(321)
|
||||
kclusts <-
|
||||
tibble(k = 1:9) %>%
|
||||
mutate(
|
||||
kclust = map(k, ~ kmeans(ds_num, .x)),
|
||||
tidied = map(kclust, tidy),
|
||||
glanced = map(kclust, glance),
|
||||
augmented = map(kclust, augment, ds_num)
|
||||
)
|
||||
|
||||
kclusts
|
||||
|
||||
clusters <-
|
||||
kclusts %>%
|
||||
unnest(cols = c(tidied))
|
||||
|
||||
assignments <-
|
||||
kclusts %>%
|
||||
unnest(cols = c(augmented))
|
||||
|
||||
clusterings <-
|
||||
kclusts %>%
|
||||
unnest(cols = c(glanced))
|
||||
|
||||
ggplot(assignments, aes(x = pase_0, y = age)) +
|
||||
geom_point(aes(color = .cluster), alpha = 0.8) +
|
||||
facet_wrap(~k)
|
||||
|
||||
ggplot(clusterings, aes(k, tot.withinss)) +
|
||||
geom_line() +
|
||||
geom_point()
|
||||
|
||||
PCA
|
||||
|
||||
pairs(assignments[-c(2:4)],
|
||||
gap = 0,
|
||||
bg = c("red", "yellow", "blue")[assignments$k],
|
||||
pch = 21
|
||||
)
|
||||
|
||||
|
||||
pc.out <- prcomp(ds_num, center = TRUE, scale = TRUE)
|
||||
|
||||
pc.sum <- summary(pc.out)
|
||||
|
||||
pscr <- tibble(
|
||||
x = 1:dim(pc.sum$importance)[2],
|
||||
Proportion = pc.sum$importance[2, ],
|
||||
Cumulative = pc.sum$importance[3, ]
|
||||
) %>%
|
||||
pivot_longer(cols = -x) %>%
|
||||
ggplot(aes(x = x, y = value, color = name)) +
|
||||
geom_line() +
|
||||
geom_point() +
|
||||
ylim(0, 1) +
|
||||
labs(
|
||||
title = "Scree plot",
|
||||
color = "Variance"
|
||||
) +
|
||||
ylab("Variance") +
|
||||
xlab("Principal components")
|
||||
|
||||
|
||||
###
|
||||
###
|
||||
|
||||
install.packages("VarSelLCM")
|
||||
library(VarSelLCM)
|
||||
|
||||
# Please indicate the number of cores you wan to use for parallelization
|
||||
nb.CPU <- 4
|
||||
# clustering without variable selection (about than 10/20 sec on 4 CPU)
|
||||
res_without <- ds |> select(!mrs_1) |>
|
||||
mutate(across(is.character, ~ factor(.x))) |> as.data.frame() |>
|
||||
VarSelCluster(
|
||||
gvals = 1:5,
|
||||
crit.varsel = "BIC",
|
||||
vbleSelec = FALSE,
|
||||
nbcores = nb.CPU
|
||||
)
|
||||
|
||||
summary(res_without)
|
||||
|
||||
plot(res_without)
|
||||
|
||||
plot(x=res_without, y="mdi_1")
|
||||
|
||||
plot(x=res_without, y="sex")
|
||||
|
||||
print(res_without)
|
||||
|
||||
coef(res_without)
|
||||
|
||||
VarSelShiny(res_without)
|
||||
191
2 Longterm/sankey events.R
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
|
||||
# source("1 PA Decline/data_format.R")
|
||||
|
||||
# NEW QUARTILES
|
||||
|
||||
|
||||
# Visuals - sankey
|
||||
# https://stackoverflow.com/questions/50395027/beautifying-sankey-alluvial-visualization-using-r
|
||||
|
||||
|
||||
## Painting
|
||||
|
||||
df_raw <- readr::read_csv(here::here("2 Longterm/DDV 241031/event_sankey_data.csv"))
|
||||
|
||||
df <- df_raw|>
|
||||
dplyr::rename(pase_0_cut=pase_0_quartile,
|
||||
pase_6_cut=pase_4_quartile) |>
|
||||
dplyr::mutate(change=dplyr::case_when(
|
||||
pase_0_cut==1 & pase_6_cut==1 ~ "ll",
|
||||
pase_0_cut %in% 2:4 & pase_6_cut %in% 2:4 ~ "hh",
|
||||
pase_0_cut<pase_6_cut ~ "hop",
|
||||
pase_0_cut>pase_6_cut ~ "drop"
|
||||
),
|
||||
dplyr::across(c(pase_0_cut,pase_6_cut,change),as.factor))
|
||||
|
||||
|
||||
df |> sankey_ready()
|
||||
|
||||
sankey_ready <- function(data,change.var="change"){
|
||||
df <- data
|
||||
# |>
|
||||
# dplyr::count(dplyr::across(dplyr::all_of(c("pase_0_cut", "pase_6_cut",change.var)))) |>
|
||||
# dplyr::mutate(dplyr::across(dplyr::starts_with("pase_"),\(.x) factor(.x))) |>
|
||||
# setNames(c("pase_0_cut", "pase_6_cut","change","n"))
|
||||
|
||||
lbs0 <-
|
||||
c(
|
||||
paste0("1st \n(n=", sum(df$n[df$pase_0_cut == "1"]), ")"),
|
||||
paste0("2nd \n(n=", sum(df$n[df$pase_0_cut == "2"]), ")"),
|
||||
paste0("3rd \n(n=", sum(df$n[df$pase_0_cut == "3"]), ")"),
|
||||
paste0("4th \n(n=", sum(df$n[df$pase_0_cut == "4"]), ")")
|
||||
)
|
||||
|
||||
|
||||
lbs6 <-
|
||||
c(
|
||||
paste0("1st \n(n=", sum(df$n[df$pase_6_cut == "1"]), ")"),
|
||||
paste0("2nd \n(n=", sum(df$n[df$pase_6_cut == "2"]), ")"),
|
||||
paste0("3rd \n(n=", sum(df$n[df$pase_6_cut == "3"]), ")"),
|
||||
paste0("4th \n(n=", sum(df$n[df$pase_6_cut == "4"]), ")")
|
||||
)
|
||||
|
||||
|
||||
levels(df$pase_0_cut) <- lbs0[1:length(levels(df$pase_0_cut))]
|
||||
levels(df$pase_6_cut) <- lbs6[1:length(levels(df$pase_6_cut))]
|
||||
|
||||
df$pase_0_cut <- factor(df$pase_0_cut, levels = rev(levels(df$pase_0_cut)))
|
||||
df$pase_6_cut <- factor(df$pase_6_cut, levels = rev(levels(df$pase_6_cut)))
|
||||
|
||||
df$change <- factor(df$change, levels = c("hh","hop", "drop", "ll"))
|
||||
|
||||
if (change.var=="change"){
|
||||
df |> dplyr::mutate(first_grp=ifelse(substr(pase_0_cut,1,1)==1,"low","higher"))
|
||||
} else if (change.var=="change_any"){
|
||||
df |> dplyr::mutate(first_grp=dplyr::case_when(
|
||||
substr(pase_0_cut,1,1)==1 ~ "low",
|
||||
substr(pase_0_cut,1,1) %in% 2:3 ~ "mid",
|
||||
substr(pase_0_cut,1,1)==4 ~ "high"))
|
||||
}
|
||||
}
|
||||
|
||||
# hops <- "#66c1a3" # grey
|
||||
# # drops <- "#990033" # Midtrød
|
||||
# drops <- "#CE0045" # Lighter Midtrød
|
||||
# nos <- "grey80" # Light grey
|
||||
#
|
||||
# # border <- "#00596B"
|
||||
# # box <- "#008099"
|
||||
#
|
||||
# border <- "#EA571D"
|
||||
# box <- "#1E4B66"
|
||||
#
|
||||
# higher <- "yellow"
|
||||
# low <- "purple"
|
||||
|
||||
library(ggalluvial)
|
||||
|
||||
library(ggplot2)
|
||||
|
||||
# project.aid::color_plot(viridisLite::turbo(4))
|
||||
|
||||
plot_sankey <- function(data,
|
||||
# palette=viridisLite::turbo(4),
|
||||
hops = "#1AE4B6FF",
|
||||
drops = "#FABA39FF",
|
||||
hh = "#30123BFF",
|
||||
ll = "#7A0403FF",
|
||||
border = "#EA571D",
|
||||
box = "#1E4B66",
|
||||
higher = "#1E4B66",
|
||||
mid = "#1E4B66",
|
||||
low = "#1E4B66",
|
||||
alpha = 0.8,
|
||||
a1=pase_0_cut,
|
||||
a2=pase_6_cut,
|
||||
a1.grp=first_grp,
|
||||
text.size = 4
|
||||
){
|
||||
|
||||
if (length(unique(data[[ncol(data)]]))>2) {
|
||||
fills <- c(higher,low,mid)
|
||||
} else {
|
||||
fills <- c(higher,low)
|
||||
}
|
||||
|
||||
cls <- c(hh, hops, drops, ll)
|
||||
# stratum.grp <- c(df[["first_grp"]],df[["last_grp"]])
|
||||
|
||||
# cls <- palette
|
||||
# browser()
|
||||
ggplot(data, aes(y = n, axis1 = {{a1}}, axis2 = {{a2}})) +
|
||||
geom_alluvium(
|
||||
aes(fill = change, color = change),
|
||||
width = 1 / 16,
|
||||
alpha = alpha,
|
||||
knot.pos = 0.4,
|
||||
curve_type ="sigmoid"
|
||||
) +
|
||||
geom_stratum(aes(fill={{a1.grp}}),
|
||||
# geom_stratum(aes(fill=stratum_grp),
|
||||
size = 2,
|
||||
width = 1 / 3.4,
|
||||
# fill = box,
|
||||
color = border
|
||||
) +
|
||||
geom_text(stat = "stratum",
|
||||
aes(label = after_stat(stratum)),
|
||||
colour = "white",
|
||||
size = text.size,
|
||||
lineheight = 1) +
|
||||
scale_x_continuous(
|
||||
breaks = 1:2,
|
||||
labels = c("Pre-stroke\nPASE quartile", "Six months\nPASE quartile")
|
||||
) +
|
||||
scale_fill_manual(values = c(cls,fills),na.value = box) +
|
||||
scale_color_manual(values = cls) +
|
||||
ggtitle("PA level changes from \npre-stroke to post-stroke")
|
||||
}
|
||||
|
||||
# c("change","change_any") |> purrr::map(\(.x){
|
||||
# df_raw |>
|
||||
# sankey_ready(change.var = .x)
|
||||
# }) |>
|
||||
# purrr::map(\(.x){
|
||||
# .x |> plot_sankey(text.size=4.5)
|
||||
# }) |>
|
||||
# patchwork::wrap_plots()
|
||||
|
||||
pal <- viridisLite::turbo(12)
|
||||
|
||||
project.aid::color_plot(pal)
|
||||
|
||||
df |>
|
||||
sankey_ready() |>
|
||||
plot_sankey(text.size=4.5)
|
||||
|
||||
p_delta <- df |>
|
||||
sankey_ready() |>
|
||||
plot_sankey(text.size=4.5)
|
||||
|
||||
ggplot2::ggsave(filename = here::here("2 Longterm/sankey_event_stroke.png"),
|
||||
p_delta +
|
||||
theme_void() +
|
||||
theme(
|
||||
legend.position = "none",
|
||||
# panel.grid.major = element_blank(),
|
||||
# panel.grid.minor = element_blank(),
|
||||
# axis.text.y = element_blank(),
|
||||
# axis.title.y = element_blank(),
|
||||
axis.text.x = element_text(),
|
||||
# text = element_text(size = 5),
|
||||
plot.title = element_blank(),
|
||||
# panel.background = element_rect(fill = "white"),
|
||||
plot.background = element_rect(fill="white"),
|
||||
panel.border = element_blank()
|
||||
),
|
||||
units = "mm",
|
||||
width = 84,
|
||||
height = 70,
|
||||
# pointsize = 30,
|
||||
dpi = 600)
|
||||
BIN
2 Longterm/sankey_event_stroke.png
Normal file
|
After Width: | Height: | Size: 383 KiB |
24
2 Longterm/sdmt correction.R
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# During study time, the SDMT was performed in a non-standardised way until around 2015-02-18, only giving subjects 60 seconds.
|
||||
# Some filled assessments were marked and were all manually evaluated for correction.
|
||||
# A decision was reached to multiply old results by a factor of 1.5 assuming a proportional increase in completed fields.
|
||||
|
||||
|
||||
|
||||
sdmt_time<-openxlsx::read.xlsx("/Volumes/Data/source/tid.sdmt.xlsx") |>
|
||||
tidyr::pivot_longer(cols = c(tid.1md, tid.6md)) |> mutate(deltager=as.character(deltager))
|
||||
sdmt_time$name <- as.double(as.character(factor(sdmt_time$name,labels = c("2","4"))))
|
||||
|
||||
# Setting cut date
|
||||
sdmt_cut<-as.Date("2015-02-18")
|
||||
|
||||
# Joining datasets to have date of visit
|
||||
sdmt_corr <- left_join(ls_nas$sdmt,sdmt_time |> mutate(name=as.character(name)), by = c("rnumb"="deltager","instance"="name"))
|
||||
|
||||
# Modyfying old correction table to be complete
|
||||
sdmt_corr$value <- if_else(sdmt_corr$talos_sdmt00<sdmt_cut|sdmt_corr$value==60,60,90,missing = 90)
|
||||
|
||||
# Write for database upload and easier future handling
|
||||
# write.csv(select(sdmt_corr, rnumb, instance, value),"2 Longterm/sdmt_time_correction.csv")
|
||||
|
||||
# Multiplying meassure by correction valued turned weight and rounded
|
||||
sdmt_corr$talos_sdmt01a <- round(as.numeric(sdmt_corr$talos_sdmt01a)*(90/sdmt_corr$value),0)
|
||||
1204
2 Longterm/sdmt_time_correction.csv
Normal file
242
2 Longterm/survival.R
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
#survival
|
||||
|
||||
# survfit experiments
|
||||
#
|
||||
|
||||
|
||||
library(ggsurvfit)
|
||||
|
||||
|
||||
## This is what I wanted (!)
|
||||
(p <- survfit2(Surv(time, status) ~ surg, data = df_colon) |>
|
||||
ggsurvfit(linewidth = 1,) +
|
||||
add_confidence_interval() +
|
||||
add_risktable() +
|
||||
add_quantile(y_value = 0.6, color = "gray50", linewidth = 0.75) +
|
||||
# limit plot to show 8 years and less
|
||||
coord_cartesian(xlim = c(0, 8)) +
|
||||
# update figure labels/titles
|
||||
labs(
|
||||
y = "Percentage Survival",
|
||||
title = "Recurrence by Time From Surgery to Randomization",
|
||||
) +
|
||||
# reduce padding on edges of figure and format axes
|
||||
scale_y_continuous(label = scales::percent,
|
||||
breaks = seq(0, 1, by = 0.2),
|
||||
expand = c(0.015, 0)) +
|
||||
scale_x_continuous(breaks = 0:10,
|
||||
expand = c(0.02, 0)))
|
||||
|
||||
|
||||
|
||||
head(df_colon)
|
||||
|
||||
library("survival")
|
||||
library("survminer")
|
||||
|
||||
variables <- c("sex", "age", "adhere", "extent", "surg")
|
||||
|
||||
cox_model <- coxph(as.formula(paste("Surv(time, status) ~",paste(variables,collapse="+"))), data = df_colon)
|
||||
|
||||
summary(cox_model)
|
||||
|
||||
ggsurvplot(survfit(cox_model), data=df_colon, palette = "#2E9FDF",
|
||||
ggtheme = theme_minimal())
|
||||
|
||||
# Checks
|
||||
|
||||
(ph_check <- survival::cox.zph(cox_model))
|
||||
|
||||
survminer::ggcoxzph(ph_check, var=c("sex", "age", "adhere", "surg"),
|
||||
font.main = 10,
|
||||
font.x = 10,
|
||||
font.y = 10)
|
||||
|
||||
|
||||
## Below is the nest best solution
|
||||
## Try at smoothing the survival curve
|
||||
|
||||
## Working code to get satisfying object
|
||||
df <- survfit2(Surv(time, status) ~ surg, data = df_colon) |>
|
||||
tidy_survfit(type = "survival")
|
||||
|
||||
df_split <- split(df,df$strata)
|
||||
|
||||
df_smoothed <- purrr::reduce(lapply(c("estimate","conf.low", "conf.high"), function(j) {
|
||||
do.call(rbind,
|
||||
lapply(seq_along(df_split), function(i) {
|
||||
nms <- names(df_split)[i]
|
||||
y <-
|
||||
predict(mgcv::gam(as.formula(paste0(
|
||||
j[[1]], " ~ s(time, bs = 'cs')"
|
||||
)), data = df_split[[i]]))
|
||||
df <- data.frame(df_split[[i]]$time, y, nms)
|
||||
names(df) <- c("time", paste0(j[[1]], ".smooth"), "strata")
|
||||
df
|
||||
}))
|
||||
}),dplyr::full_join) |> full_join(df)
|
||||
|
||||
ggplot(data=df_smoothed) +
|
||||
geom_line(aes(x=time, y=estimate.smooth, color = strata))+
|
||||
geom_ribbon(aes(x=time, ymin = conf.low.smooth, ymax = conf.high.smooth, fill = strata), alpha = 0.50) +
|
||||
# geom_smooth(aes(x=time, y=estimate, color = strata), method = "gam", formula = y ~ s(x, bs = "cs")) +
|
||||
# reduce padding on edges of figure and format axes
|
||||
scale_y_continuous(label = scales::percent,
|
||||
breaks = seq(0, 1, by = 0.2),
|
||||
expand = c(0.015, 0), limits = c(0,1)) +
|
||||
scale_x_continuous(breaks = 0:10,
|
||||
expand = c(0.02, 0))+
|
||||
labs(
|
||||
y = "Percentage Survival",
|
||||
title = "Recurrence by Time From Surgery to Randomization",
|
||||
) +
|
||||
# limit plot to show 8 years and less
|
||||
coord_cartesian(xlim = c(0, 8))
|
||||
|
||||
|
||||
|
||||
## Dendrogram
|
||||
|
||||
df_colon[do.call(c, lapply(seq_len(ncol(df_colon)), function(i) {
|
||||
is.double(df_colon[[i]])
|
||||
}))][-1] |> scale() |> dist() |> hclust(method="average") |> ggdendro::ggdendrogram()
|
||||
|
||||
|
||||
## Better example??
|
||||
##
|
||||
|
||||
library(tidyverse)
|
||||
library(survival)
|
||||
library(purrr)
|
||||
library(ggsurvfit)
|
||||
library(cobs)
|
||||
|
||||
## Data
|
||||
plot.type <- "survival"
|
||||
|
||||
x <- survfit2(Surv(time, status) ~ surg, data = df_colon)
|
||||
df <-
|
||||
tidy_survfit(x, type = plot.type) %>% dplyr::mutate(survfit = c(list(x),
|
||||
rep_len(list(), dplyr::n() - 1L)))
|
||||
method <- "gam"
|
||||
|
||||
df_split <- split(df,df$strata)
|
||||
|
||||
df_smoothed <- purrr::reduce(lapply(c("estimate","conf.low", "conf.high"), function(j) {
|
||||
do.call(rbind,
|
||||
lapply(seq_along(df_split), function(i) {
|
||||
nms <- names(df_split)[i]
|
||||
x = df_split[[i]]$time
|
||||
if (method=="loess"){
|
||||
y <-
|
||||
predict(loess(as.formula(paste0(
|
||||
j[[1]], " ~ time"
|
||||
)), data = df_split[[i]]))
|
||||
} else if (method=="gam"){
|
||||
y <-
|
||||
predict(mgcv::gam(as.formula(paste0(
|
||||
j[[1]], " ~ s(time, bs = 'cs')"
|
||||
)), data = df_split[[i]]))
|
||||
} else if (method=="cobs") {
|
||||
|
||||
if (plot.type=="survival"){
|
||||
## This will make the plot start in (0,1)
|
||||
con <- rbind(c( 0,min(x),1))
|
||||
## This ensures a monotonic decreasing slope
|
||||
## for the estimate, not the CIs
|
||||
if (j[[1]]=="estimate"){
|
||||
direction="decrease"
|
||||
} else {direction="none"}
|
||||
|
||||
} else if (plot.type=="risk"){
|
||||
con <- rbind(c( 0,min(x),0))
|
||||
if (j[[1]]=="estimate"){
|
||||
direction="increase"
|
||||
} else {direction="none"}
|
||||
}
|
||||
|
||||
m <- cobs(x,df_split[[i]][[j]],
|
||||
constraint=direction,
|
||||
nknots = 4,
|
||||
pointwise= con,
|
||||
degree = 2,)
|
||||
y <- predict(m, x)[, 'fit']
|
||||
}
|
||||
|
||||
df <- data.frame(x, y, nms)
|
||||
names(df) <- c("time", paste0(j[[1]], ".smooth"), "strata")
|
||||
df
|
||||
}))
|
||||
}),dplyr::full_join) |> full_join(df)
|
||||
|
||||
## Plotting
|
||||
ggplot(data=df_smoothed) +
|
||||
geom_line(aes(x=time, y=estimate.smooth, color = strata))+
|
||||
geom_ribbon(aes(x=time, ymin = conf.low.smooth, ymax = conf.high.smooth, fill = strata), alpha = 0.50)
|
||||
|
||||
## Weighted GAM approach
|
||||
## https://stackoverflow.com/a/66705556/21019325
|
||||
|
||||
## It does not work. Gonna stop here due to lack of time.
|
||||
## Apparantly
|
||||
|
||||
dat_orig <- df_split[[1]][,c("time","estimate")]
|
||||
x1=0
|
||||
y1=1
|
||||
# set.seed(123)
|
||||
# N = 100
|
||||
# x <- sort(runif(N) * 4 - 1)
|
||||
# f <- exp(4*x)/(1+exp(4*x))
|
||||
# y <- f + rnorm(N) * 0.1
|
||||
# x = c(-1, x)
|
||||
# y = c(-0.1, y)
|
||||
# dat = data.frame(x = x, y= y)
|
||||
x <- do.call(c,c(x1,dat_orig[1]))
|
||||
y <- do.call(c,c(y1,dat_orig[,2]))
|
||||
dat <- data.frame(x=x,y=y)
|
||||
k <- 13
|
||||
|
||||
library(mgcv)
|
||||
|
||||
fit0 <- gam(y ~ s(x, k = k, bs = "cr"),data=dat)
|
||||
# predict from unconstrained GAM fit
|
||||
|
||||
newdata <- data.frame(x = x)
|
||||
newdata$y_pred_fit0 <- predict(fit0, newdata = newdata)
|
||||
|
||||
# Show regular spline fit (and save fitted object)
|
||||
# f.ug <- gam(y~s(x,k=k,bs="cr"))
|
||||
|
||||
# explicitly construct smooth term's design matrix
|
||||
sm <- smoothCon(s(x,k=k,bs="cr"),dat,knots=NULL)[[1]]
|
||||
# find linear constraints sufficient for monotonicity of a cubic regression spline
|
||||
# it assumes "cr" is the basis and its knots are provided as input
|
||||
f.mono <- mono.con(sm$xp,up = FALSE)
|
||||
|
||||
G <- list(
|
||||
X=sm$X,
|
||||
C=matrix(0,0,0), # [0 x 0] matrix (no equality constraints)
|
||||
sp=fit0$sp, # smoothing parameter estimates (taken from unconstrained model)
|
||||
p=sm$xp, # array of feasible initial parameter estimates
|
||||
y=dat[,2],
|
||||
w= c(1e8, rep(1,nrow(dat_orig))), # weights for data
|
||||
Ain=f.mono$A, # matrix for the inequality constraints
|
||||
bin=f.mono$b, # vector for the inequality constraints
|
||||
S=sm$S, # list of penalty matrices; The first parameter it penalizes is given by off[i]+1
|
||||
off=0 # Offset values locating the elements of M$S in the correct location within each penalty coefficient matrix. (Zero offset implies starting in first location)
|
||||
)
|
||||
|
||||
p <- pcls(G) # fit spline (using smoothing parameter estimates from unconstrained fit)
|
||||
|
||||
# predict
|
||||
newdata$y_pred_fit2 <- Predict.matrix(sm, data.frame(x = newdata$x)) %*% p
|
||||
# plot
|
||||
ggplot(data=newdata) +
|
||||
geom_line(aes(x=x, y=y_pred_fit2))
|
||||
# geom_ribbon(aes(x=time, ymin = conf.low.smooth, ymax = conf.high.smooth, fill = strata), alpha = 0.50)
|
||||
#
|
||||
plot(y ~ x, data = dat)
|
||||
lines(y_pred_fit0 ~ x, data = newdata, col = 2, lwd = 2)
|
||||
lines(y_pred_fit2 ~ x, data = newdata, col = 4, lwd = 2)
|
||||
abline(v = -1)
|
||||
abline(h = -0.1)
|
||||
132
2 Longterm/survival_two_groups.R
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
# =============================================================================
|
||||
# Retrospective Sample Size Evaluation — Event-Free Survival (2 Groups)
|
||||
# Freedman Method | works directly from hazard ratio and observed events
|
||||
# Appropriate for: unequal group sizes, single censored-at-event designs
|
||||
# =============================================================================
|
||||
|
||||
# --- 0. Install & Load Packages ----------------------------------------------
|
||||
|
||||
# Uncomment to install if needed:
|
||||
# install.packages("gsDesign")
|
||||
|
||||
library(gsDesign)
|
||||
|
||||
|
||||
# --- 1. Observed Data --------------------------------------------------------
|
||||
|
||||
# n : number of participants per group
|
||||
# events : number of observed events per group
|
||||
# person_time : total person-years of follow-up per group
|
||||
# = sum of each individual's follow-up duration
|
||||
# naturally accounts for censoring and variable follow-up
|
||||
# max_follow_up : maximum follow-up time (years)
|
||||
|
||||
n_A <- 323; events_A <- 80; person_time_A <- 2089
|
||||
n_B <- 56; events_B <- 32; person_time_B <- 294
|
||||
max_follow_up <- 9 # years
|
||||
|
||||
# Derived quantities
|
||||
hazard_A <- events_A / person_time_A # events per person-year
|
||||
hazard_B <- events_B / person_time_B
|
||||
hr <- hazard_B / hazard_A # observed hazard ratio (B vs A)
|
||||
|
||||
overall_event_rate <- (events_A + events_B) / (n_A + n_B)
|
||||
pi_A <- n_A / (n_A + n_B)
|
||||
pi_B <- n_B / (n_A + n_B)
|
||||
|
||||
cat("=== Observed Data Summary ===\n")
|
||||
cat(sprintf("Group A : N=%-4d Events=%-3d Person-years=%6.0f Hazard=%.4f\n",
|
||||
n_A, events_A, person_time_A, hazard_A))
|
||||
cat(sprintf("Group B : N=%-4d Events=%-3d Person-years=%6.0f Hazard=%.4f\n",
|
||||
n_B, events_B, person_time_B, hazard_B))
|
||||
cat(sprintf("Hazard ratio (B vs A) : %.3f\n", hr))
|
||||
cat(sprintf("Allocation (A / B) : %.1f%% / %.1f%%\n", pi_A*100, pi_B*100))
|
||||
cat(sprintf("Overall event rate : %.3f\n", overall_event_rate))
|
||||
|
||||
|
||||
# --- 2. Required Events — Freedman Method ------------------------------------
|
||||
# Freedman (1982): works directly from the hazard ratio.
|
||||
# More stable than Schoenfeld when group sizes are unequal, because it does
|
||||
# not depend on a variance term V that collapses under unequal allocation.
|
||||
#
|
||||
# Formula: E = (z_alpha/2 + z_beta)^2 * (1 + hr)^2 / (hr - 1)^2
|
||||
#
|
||||
# Note: hr must not equal 1 (no difference). If hr < 1, invert it so
|
||||
# the formula always uses the ratio > 1.
|
||||
|
||||
required_events_freedman <- function(alpha = 0.05, power = 0.80, hr) {
|
||||
if (hr == 1) stop("Hazard ratio must not equal 1 (no detectable difference).")
|
||||
hr <- ifelse(hr < 1, 1/hr, hr) # ensure hr > 1
|
||||
z_alpha <- qnorm(1 - alpha / 2)
|
||||
z_beta <- qnorm(power)
|
||||
E <- (z_alpha + z_beta)^2 * (1 + hr)^2 / (hr - 1)^2
|
||||
return(ceiling(E))
|
||||
}
|
||||
|
||||
E_required <- required_events_freedman(alpha = 0.05, power = 0.80, hr = hr)
|
||||
N_required <- ceiling(E_required / overall_event_rate)
|
||||
|
||||
cat("\n=== Freedman Method (alpha=0.05, power=0.80) ===\n")
|
||||
cat("Required total events :", E_required, "\n")
|
||||
cat("Observed total events :", events_A + events_B, "\n")
|
||||
cat("Required total N :", N_required, "\n")
|
||||
cat("Observed total N :", n_A + n_B, "\n")
|
||||
cat("Difference (req-obs) :", N_required - (n_A + n_B), "\n")
|
||||
|
||||
|
||||
# --- 3. Validation via gsDesign::nSurv ---------------------------------------
|
||||
|
||||
cat("\n=== gsDesign Validation ===\n")
|
||||
tryCatch({
|
||||
gs <- nSurv(
|
||||
lambdaC = hazard_A,
|
||||
hr = hr,
|
||||
sided = 2,
|
||||
alpha = 0.05,
|
||||
beta = 0.20,
|
||||
T = max_follow_up,
|
||||
minfup = 0
|
||||
)
|
||||
print(gs)
|
||||
}, error = function(e) {
|
||||
cat("gsDesign error:", conditionMessage(e), "\n")
|
||||
})
|
||||
|
||||
|
||||
# --- 4. Sensitivity Analysis Across Power Levels -----------------------------
|
||||
|
||||
power_levels <- c(0.70, 0.75, 0.80, 0.85, 0.90)
|
||||
|
||||
sensitivity <- data.frame(
|
||||
power = power_levels,
|
||||
events_req = sapply(power_levels, function(pw)
|
||||
required_events_freedman(0.05, pw, hr))
|
||||
)
|
||||
sensitivity$n_req <- ceiling(sensitivity$events_req / overall_event_rate)
|
||||
sensitivity$adequate <- ifelse(sensitivity$n_req <= (n_A + n_B), "Yes", "No")
|
||||
|
||||
cat("\n=== Sensitivity Analysis by Power Level ===\n")
|
||||
print(sensitivity)
|
||||
|
||||
|
||||
# --- 5. Interpretation -------------------------------------------------------
|
||||
|
||||
cat("\n=== Interpretation ===\n")
|
||||
cat(sprintf("Hazard ratio: %.3f — Group B events occur %.1fx faster than Group A\n",
|
||||
hr, hr))
|
||||
|
||||
if (E_required <= (events_A + events_B)) {
|
||||
cat("Event count : ADEQUATE — observed events meet Freedman requirement.\n")
|
||||
} else {
|
||||
cat(sprintf("Event count : INSUFFICIENT — %d observed, %d required.\n",
|
||||
events_A + events_B, E_required))
|
||||
}
|
||||
|
||||
if (N_required <= (n_A + n_B)) {
|
||||
cat("Sample size : ADEQUATELY POWERED at 80%.\n")
|
||||
} else {
|
||||
cat(sprintf(paste0("Sample size : UNDERPOWERED at 80%% — ",
|
||||
"N=%d observed, N=%d required (shortfall: %d).\n"),
|
||||
n_A + n_B, N_required, N_required - (n_A + n_B)))
|
||||
cat("Type II error risk is elevated — interpret null results with caution.\n")
|
||||
}
|
||||
0
2 Longterm/table plotting tests.R
Normal file
33
2 Longterm/varsellcm-clustering.R
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
ds <- readr::read_csv("2 Longterm/assigndata.csv", na = c("", "NA"))
|
||||
|
||||
library(VarSelLCM)
|
||||
|
||||
# Please indicate the number of cores you wan to use for parallelization
|
||||
nb.CPU <- 4
|
||||
# clustering without variable selection (about than 10/20 sec on 4 CPU)
|
||||
clusters <- ds |> select(!mrs_1) |> na.omit() |>
|
||||
mutate(across(is.character, ~ factor(.x))) |> as.data.frame() |>
|
||||
VarSelCluster(
|
||||
gvals = 1:5,
|
||||
crit.varsel = "BIC",
|
||||
vbleSelec = FALSE,
|
||||
nbcores = nb.CPU
|
||||
)
|
||||
|
||||
summary(clusters)
|
||||
|
||||
plot(clusters)
|
||||
|
||||
plot(x=clusters, y="mdi_1")
|
||||
|
||||
plot(x=clusters, y="sex")
|
||||
|
||||
print(clusters)
|
||||
|
||||
coef(clusters)
|
||||
|
||||
VarSelShiny(clusters)
|
||||
|
||||
clusters@partitions@zMAP
|
||||
|
||||
gtsummary::tbl_summary(tibble(ds |> na.omit(), class=clusters@partitions@zMAP),by=class) |> gtsummary::add_p()
|
||||
58
2 Longterm/wsc-sankey.R
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
grps <- rbind(c("low0","low6","1"),
|
||||
c("high0","low6","2"),
|
||||
c("low0","high6","3"),
|
||||
c("high0","high6","4"))
|
||||
|
||||
tmes <- c(48,62,55,323)
|
||||
|
||||
tbl <- data.frame(grps,tmes)
|
||||
|
||||
colnames(tbl) <- c("t1","t2","grp","n")
|
||||
|
||||
library(ggalluvial)
|
||||
|
||||
cls <- viridisLite::turbo(4,direction=-1)
|
||||
|
||||
cls
|
||||
stRoke::color_plot(viridisLite::turbo(4,direction=-1))
|
||||
|
||||
p <- ggplot(tbl,aes(y = n, axis1 = t1, axis2 = t2)) +
|
||||
geom_alluvium(
|
||||
aes(fill = grp, color = grp),
|
||||
width = 1 / 16,
|
||||
alpha = .6,
|
||||
knot.pos = 0.4
|
||||
) +
|
||||
# geom_stratum(aes(size=10),width = 1 / 4,
|
||||
# fill = box,
|
||||
# color = border) +
|
||||
# geom_text(stat = "stratum", aes(label = after_stat(stratum)), colour = "white", size = 20) +
|
||||
scale_x_continuous(breaks = 1:2,
|
||||
labels = c("Pre-stroke\nquartile", "Six months\nquartile")) +
|
||||
scale_y_continuous(breaks=c(0,103,488))+
|
||||
scale_fill_manual(values = cls) +
|
||||
scale_color_manual(values = cls) +
|
||||
# labs(title=NULL, legend=NULL)+
|
||||
theme_minimal()
|
||||
|
||||
png(
|
||||
filename = "sankey_change_WSC.png",
|
||||
units = "mm",
|
||||
width = 500,
|
||||
height = 500,
|
||||
pointsize = 15,
|
||||
res = 300
|
||||
); p+
|
||||
theme_minimal() +
|
||||
theme(
|
||||
legend.position = "none",
|
||||
panel.grid.major = element_blank(),
|
||||
panel.grid.minor = element_blank(),
|
||||
axis.text.y = element_blank(),
|
||||
axis.title.y = element_blank(),
|
||||
axis.text.x = element_blank(),
|
||||
plot.title = element_blank(),
|
||||
panel.background = element_rect(fill='transparent'),
|
||||
plot.background = element_rect(fill='transparent', color=NA)
|
||||
); dev.off()
|
||||