Commit 8460bae6 authored by Kevin Kunzmann's avatar Kevin Kunzmann

...

parent 38745375
...@@ -250,7 +250,7 @@ the ‘6 months’ category contains observations up to 9 months post-injury. ...@@ -250,7 +250,7 @@ the ‘6 months’ category contains observations up to 9 months post-injury.
Thus the figures include a small proportion of GOSE 1 representing patients Thus the figures include a small proportion of GOSE 1 representing patients
who died between 6 and 9 months. who died between 6 and 9 months.
```{r gose-plots, echo=FALSE, fig.cap="GOSe sampling time distribution and distribution at per-protocol time points.", fig.height=5, fig.width=7} ```{r gose-plots, echo=FALSE, fig.cap="GOSe sampling time distribution and distribution at per-protocol time points (actual date rounded to nearest).", fig.height=6, fig.width=6}
p_gose_times <- df_gose %>% p_gose_times <- df_gose %>%
ggplot(aes(Outcomes.DerivedCompositeGOSEDaysPostInjury / 30)) + ggplot(aes(Outcomes.DerivedCompositeGOSEDaysPostInjury / 30)) +
geom_histogram(binwidth = 1) + geom_histogram(binwidth = 1) +
...@@ -285,14 +285,14 @@ tmp <- df_gose %>% ...@@ -285,14 +285,14 @@ tmp <- df_gose %>%
p1 <- tmp %>% p1 <- tmp %>%
ggplot(aes(GOSe)) + ggplot(aes(GOSe)) +
geom_bar(aes(fill = GOSe)) + geom_bar(aes(fill = GOSe), width = .66, color = "black") +
scale_fill_viridis_d(guide = guide_legend(nrow = 1)) + scale_fill_grey(start = .1, end = .9) +
facet_wrap(~t, nrow = 1) + facet_wrap(~t, nrow = 1) +
ylab("absolute count") + ylab("absolute count") +
theme_bw() + theme_bw() +
theme( theme(
panel.grid.major.x = element_blank(), panel.grid.major.x = element_blank(),
legend.position = "bottom" legend.position = "none"
) )
p2 <- tmp %>% p2 <- tmp %>%
...@@ -301,8 +301,8 @@ p2 <- tmp %>% ...@@ -301,8 +301,8 @@ p2 <- tmp %>%
group_by(t) %>% group_by(t) %>%
mutate(freq = n / sum(n)) %>% mutate(freq = n / sum(n)) %>%
ggplot(aes(x = GOSe, y = freq)) + ggplot(aes(x = GOSe, y = freq)) +
geom_bar(aes(fill = GOSe), stat = "identity") + geom_bar(aes(fill = GOSe), width = .66, color = "black", stat = "identity") +
scale_fill_viridis_d() + scale_fill_grey(start = .1, end = .9) +
facet_wrap(~t, nrow = 1) + facet_wrap(~t, nrow = 1) +
ylab("relative frequency") + ylab("relative frequency") +
theme_bw() + theme_bw() +
...@@ -311,23 +311,12 @@ p2 <- tmp %>% ...@@ -311,23 +311,12 @@ p2 <- tmp %>%
legend.position = "none" legend.position = "none"
) )
g_legend <- function(a.gplot){
tmp <- ggplot_gtable(ggplot_build(a.gplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)
}
gridExtra::grid.arrange( gridExtra::grid.arrange(
p_gose_times, p_gose_times,
gridExtra::arrangeGrob( p1,
p1 + theme(legend.position = "none"), p2,
p2 + theme(legend.position = "none"),
nrow = 1
),
g_legend(p1),
nrow = 3, nrow = 3,
heights = c(10, 10, 1) heights = c(1.5, 1, 1)
) )
``` ```
......
...@@ -73,7 +73,7 @@ fit <- msm( ...@@ -73,7 +73,7 @@ fit <- msm(
qmatrix = Q, qmatrix = Q,
censor = 99, censor = 99,
pci = c(90, 270), pci = c(90, 270),
censor.states = 1:7, censor.states = 2:7, # cannot be dead at 6 months
control = list( control = list(
fnscale = config$fnscale_msm, fnscale = config$fnscale_msm,
maxit = config$maxiter_msm, maxit = config$maxiter_msm,
......
...@@ -79,7 +79,7 @@ fit <- msm( ...@@ -79,7 +79,7 @@ fit <- msm(
qmatrix = Q, qmatrix = Q,
censor = 99, censor = 99,
pci = c(90, 270), pci = c(90, 270),
censor.states = 1:7, censor.states = 2:7, # cannot be death at 6 month
control = list( control = list(
fnscale = config$fnscale_msm, fnscale = config$fnscale_msm,
maxit = config$maxiter_msm, maxit = config$maxiter_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