Hypothesis

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")
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"
)
library(ggdag)
## 
## Attaching package: 'ggdag'
## The following object is masked from 'package:stats':
## 
##     filter
library(ggplot2)
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"
  )
dag |> ggdag(text = TRUE) + theme_dag(6) + geom_dag_edges_arc()

dag |> ggdag_parents("svd")

dag |> ggdag_paths(text = TRUE, shadow = TRUE)

dag |> ggdag_adjustment_set(text = TRUE, shadow = TRUE,stylized = TRUE)