Commit fe01ae39 authored by Kevin's avatar Kevin

simplified diagram

parent 25a1deae
...@@ -21,16 +21,13 @@ For information on how to get dat access, see https://www.center-tbi.eu/data. ...@@ -21,16 +21,13 @@ For information on how to get dat access, see https://www.center-tbi.eu/data.
The workflow assumes a linux command line. The workflow assumes a linux command line.
To facilitate reproducibility, a To facilitate reproducibility, a
[docker container](https://cloud.docker.com/u/kkmann/repository/docker/kkmann/gose-6mo-imputation) [docker container](https://cloud.docker.com/u/kkmann/repository/docker/kkmann/gose-6mo-imputation)
container with all software dependencies container with all software dependencies (R packages etc.) is provided.
(R packages etc.) is provided [here]().
The workflow itself is automated using [snakemake]() 5.2.1. The workflow itself is automated using [snakemake]() 5.2.1.
To fully leverage the container and snakemake workflow, the following software To fully leverage the container and snakemake workflow, the following software
dependencies must be available: dependencies must be available:
* [python](https://www.python.org/download/releases/3.5.1/) 3.5.1 (higher versions might work as well) * [snakemake](https://snakemake.readthedocs.io/en/stable/getting_started/installation.html) version 5.2.1+; requires [python](https://www.python.org/download/releases/3.5.1/) 3.5.1+
* [snakemake](https://snakemake.readthedocs.io/en/stable/getting_started/installation.html) version 5.2.1 (higher versions will work as well) * [singularity](https://www.sylabs.io/guides/2.6/user-guide/index.html) 2.6.0+
* [singularity](https://www.sylabs.io/guides/2.6/user-guide/index.html) 2.6.0 (higher versions might work as well)
......
singularity: "docker://kkmann/gose-6mo-imputation@sha256:7c431eddca0933b09efce89a353c0abdf54aa07e601b31cb5b0535e4895091cd" singularity: "docker://kkmann/gose-6mo-imputation@sha256:85724229d8f4243aaebd6228e5cc7833474577ac107f9719b00016765f9ee342"
configfile: "config.yml" configfile: "config.yml"
......
...@@ -6,9 +6,10 @@ MAINTAINER Kevin Kunzmann kevin.kunzmann@mrc-bsu.cam.ac.uk ...@@ -6,9 +6,10 @@ MAINTAINER Kevin Kunzmann kevin.kunzmann@mrc-bsu.cam.ac.uk
RUN sudo apt-get update RUN sudo apt-get update
# install prerequisits # install prerequisits
RUN sudo apt-get -y install libcurl4-openssl-dev curl RUN sudo apt-get -y install libcurl4-openssl-dev curl bzip2
# install required R packages # install required R packages
RUN R -e "install.packages('diagram')"
RUN R -e "install.packages('rstan')" RUN R -e "install.packages('rstan')"
RUN R -e "install.packages('brms')" RUN R -e "install.packages('brms')"
RUN R -e "install.packages('mice')" RUN R -e "install.packages('mice')"
...@@ -18,5 +19,4 @@ RUN R -e "install.packages('e1071')" ...@@ -18,5 +19,4 @@ RUN R -e "install.packages('e1071')"
RUN R -e "install.packages('msm')" RUN R -e "install.packages('msm')"
RUN R -e "install.packages('cowplot')" RUN R -e "install.packages('cowplot')"
RUN R -e "install.packages('pander')" RUN R -e "install.packages('pander')"
RUN R -e "install.packages('DiagrammeR')"
RUN R -e "devtools::install_github('kkmann/describr')" RUN R -e "devtools::install_github('kkmann/describr')"
...@@ -296,7 +296,7 @@ Baseline covariates are added as linear fixed effects to to the ...@@ -296,7 +296,7 @@ Baseline covariates are added as linear fixed effects to to the
population mean. population mean.
The model was fitted using Bayesian statistics via the BRMS The model was fitted using Bayesian statistics via the BRMS
package @brms2017, @brms2018 for the R environment for statistical package @brms2017, @brms2018 for the R environment for statistical
computing @r2016 and the Stan modelling language @stan2017. computing @R2016 and the Stan modelling language @stan2017.
Non-informative priors were used for the model parameters. Non-informative priors were used for the model parameters.
...@@ -360,29 +360,35 @@ This model class assumes that the transitions between adjacent GOSe ...@@ -360,29 +360,35 @@ This model class assumes that the transitions between adjacent GOSe
states can be modeled as a Markov process and the transition states can be modeled as a Markov process and the transition
intensities between adjacent states are fitted to the observed data. intensities between adjacent states are fitted to the observed data.
```{r diagram, echo=FALSE, fig.cap="Structural diagram of allowed transitions between GOSe states for the proposed multi-state model.", fig.width=3.5, fig.height=2} ```{r diagram, echo=FALSE, fig.cap="Structural diagram of allowed transitions between GOSe states for the proposed multi-state model.", fig.width=8, fig.height=4}
DiagrammeR::grViz(" # define transition matrix
digraph boxes_and_circles { Q <- matrix(0, nrow = 8, ncol = 8)
for (i in 1:8) {
# a 'graph' statement for (j in 1:8) {
graph [layout = dot, rankdir = LR, overlap = false, fontsize = 10] if (i == j - 1 & i != 1) {
Q[i, j] <- 1
# several 'node' statements }
node [shape = circle, if (i == j + 1) {
fixedsize = true, Q[i, j] <- 1
width = 0.9] // sets as circles }
1; 2; 3; 4; 5; 6; 7; 8 }
# several 'edge' statements
2->1 2->3
3->1 3->2 3->4
4->1 4->3 4->5
5->1 5->4 5->6
6->1 6->5 6->7
7->1 7->6 7->8
8->1 8->7
} }
") Q[2:8, 1] <- 1 # allow instantaneous deaths
Q <- t(Q)
curvature <- Q / 5
curvature[1, ] <- 0
diagram::plotmat(
Q,
relsize = 1,
shadow.size = 0,
pos = c(1, 7),
box.size = .033,
arr.pos = .55,
arr.length = .33,
arr.type = "triangle",
cex.txt = 0,
curve = curvature
)
``` ```
To account for the fact that state-transitions might be more frequent To account for the fact that state-transitions might be more frequent
......
...@@ -9,7 +9,7 @@ title = {{Multi-State Models for Panel Data: The msm Package for R}}, ...@@ -9,7 +9,7 @@ title = {{Multi-State Models for Panel Data: The msm Package for R}},
volume = {38}, volume = {38},
year = {2011} year = {2011}
} }
@article{r2016, @article{R2016,
archivePrefix = {arXiv}, archivePrefix = {arXiv},
arxivId = {arXiv:1011.1669v3}, arxivId = {arXiv:1011.1669v3},
author = {Team, R Development Core and {R Development Core Team}, R}, author = {Team, R Development Core and {R Development Core Team}, R},
......
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