transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
29
1 PA Decline/repeated measures.R
Normal file
29
1 PA Decline/repeated measures.R
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ds <- readr::read_csv(here::here("/Volumes/Data/REDCap/DDV/talos_ddv.csv"))
|
||||
|
||||
|
||||
# Tun first 3 lines of code in 00_master.R
|
||||
|
||||
# Label attributes are removed then pivoted to long
|
||||
df <- purrr::map(X_tbl,\(.x){
|
||||
# browser()
|
||||
class(.x) <- class(.x)[-1]
|
||||
.x
|
||||
}) |>
|
||||
dplyr::bind_cols() |>
|
||||
dplyr::mutate(id=dplyr::row_number()) |>
|
||||
dplyr::select(id,dplyr::everything()) |>
|
||||
tidyr::pivot_longer(c("pase_0","pase_6"),names_to = "time",values_to = "pase") |>
|
||||
dplyr::mutate(time = as.numeric(factor(time))-1)
|
||||
|
||||
lme4::lmer(formula = pase~age+male_sex+hypertension+diabetes+nihss_c+(1|id),data = df) |>
|
||||
gtsummary::tbl_regression()
|
||||
|
||||
summary(df$male_sex)
|
||||
|
||||
df |>
|
||||
dplyr::mutate(dplyr::across(c("id","hypertension","diabetes","time"),\(.x)factor(.x)),
|
||||
female=male_sex==1) |>
|
||||
(\(.x){
|
||||
mmrm::mmrm(formula = pase~age+female+hypertension+diabetes+nihss_c+us(time|id),data=.x)
|
||||
})() |> gtsummary::tbl_regression()
|
||||
|
||||
Loading…
Reference in a new issue