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.
The workflow assumes a linux command line.
To facilitate reproducibility, a
[docker container](https://cloud.docker.com/u/kkmann/repository/docker/kkmann/gose-6mo-imputation)
container with all software dependencies
(R packages etc.) is provided [here]().
container with all software dependencies (R packages etc.) is provided.
The workflow itself is automated using [snakemake]() 5.2.1.
To fully leverage the container and snakemake workflow, the following software
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 (higher versions will work as well)
* [singularity](https://www.sylabs.io/guides/2.6/user-guide/index.html) 2.6.0 (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+
* [singularity](https://www.sylabs.io/guides/2.6/user-guide/index.html) 2.6.0+
......
singularity: "docker://kkmann/gose-6mo-imputation@sha256:7c431eddca0933b09efce89a353c0abdf54aa07e601b31cb5b0535e4895091cd"
singularity: "docker://kkmann/gose-6mo-imputation@sha256:85724229d8f4243aaebd6228e5cc7833474577ac107f9719b00016765f9ee342"
configfile: "config.yml"
......
......@@ -6,9 +6,10 @@ MAINTAINER Kevin Kunzmann kevin.kunzmann@mrc-bsu.cam.ac.uk
RUN sudo apt-get update
# 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
RUN R -e "install.packages('diagram')"
RUN R -e "install.packages('rstan')"
RUN R -e "install.packages('brms')"
RUN R -e "install.packages('mice')"
......@@ -18,5 +19,4 @@ RUN R -e "install.packages('e1071')"
RUN R -e "install.packages('msm')"
RUN R -e "install.packages('cowplot')"
RUN R -e "install.packages('pander')"
RUN R -e "install.packages('DiagrammeR')"
RUN R -e "devtools::install_github('kkmann/describr')"
......@@ -296,7 +296,7 @@ Baseline covariates are added as linear fixed effects to to the
population mean.
The model was fitted using Bayesian statistics via the BRMS
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.
......@@ -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
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}
DiagrammeR::grViz("
digraph boxes_and_circles {
# a 'graph' statement
graph [layout = dot, rankdir = LR, overlap = false, fontsize = 10]
# several 'node' statements
node [shape = circle,
fixedsize = true,
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
```{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}
# define transition matrix
Q <- matrix(0, nrow = 8, ncol = 8)
for (i in 1:8) {
for (j in 1:8) {
if (i == j - 1 & i != 1) {
Q[i, j] <- 1
}
if (i == j + 1) {
Q[i, j] <- 1
}
}
}
")
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
......
......@@ -9,7 +9,7 @@ title = {{Multi-State Models for Panel Data: The msm Package for R}},
volume = {38},
year = {2011}
}
@article{r2016,
@article{R2016,
archivePrefix = {arXiv},
arxivId = {arXiv:1011.1669v3},
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