Commit 90809689 authored by Kevin's avatar Kevin

now we have it ....

parent f52fbc4b
...@@ -21,7 +21,8 @@ df_gose <- readRDS(inputfile) %>% ...@@ -21,7 +21,8 @@ df_gose <- readRDS(inputfile) %>%
) %>% select( ) %>% select(
gupi, gupi,
Outcomes.DerivedCompositeGOSE, Outcomes.DerivedCompositeGOSE,
Outcomes.DerivedCompositeGOSEDaysPostInjury Outcomes.DerivedCompositeGOSEDaysPostInjury,
Subject.Age
) %>% ) %>%
arrange( arrange(
gupi, gupi,
...@@ -30,11 +31,12 @@ df_gose <- readRDS(inputfile) %>% ...@@ -30,11 +31,12 @@ df_gose <- readRDS(inputfile) %>%
# translate to msm formatting # translate to msm formatting
tmp <- df_gose %>% tmp <- df_gose %>%
rbind(tibble( # only predict GOSE at 180 days - takes too long otherwise group_by(gupi) %>%
gupi = df_gose$gupi %>% unique, summarize_all(first) %>%
mutate(
Outcomes.DerivedCompositeGOSEDaysPostInjury = config$t_out_msm + .5, # needed to offset Outcomes.DerivedCompositeGOSEDaysPostInjury = config$t_out_msm + .5, # needed to offset
Outcomes.DerivedCompositeGOSE = 99 Outcomes.DerivedCompositeGOSE = 99
)) %>% ) %>%
arrange(gupi, Outcomes.DerivedCompositeGOSEDaysPostInjury) %>% arrange(gupi, Outcomes.DerivedCompositeGOSEDaysPostInjury) %>%
mutate( mutate(
obstype = ifelse(Outcomes.DerivedCompositeGOSE == 1, 3, 1), # make death exactly observed transition obstype = ifelse(Outcomes.DerivedCompositeGOSE == 1, 3, 1), # make death exactly observed transition
...@@ -69,11 +71,11 @@ fit <- msm( ...@@ -69,11 +71,11 @@ fit <- msm(
subject = tmp$gupi, subject = tmp$gupi,
data = tmp, data = tmp,
obstype = tmp$obstype, obstype = tmp$obstype,
covariates = ~ age,
gen.inits = TRUE, gen.inits = TRUE,
qmatrix = Q, qmatrix = Q,
censor = 99, censor = 99,
pci = c(90, 270), pci = c(90, 270),
covariates = ~ Subject.Age,
censor.states = 1:7, censor.states = 1:7,
control = list( control = list(
fnscale = config$fnscale_msm, fnscale = config$fnscale_msm,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment