Skip to content

GSK-Biostatistics/mimic

Repository files navigation

mimic

Lifecycle: experimental CRAN status R-CMD-check

The goal of mimic is to simulate date from multi-state-models. These models can either be created by the {msm} package or elicitate.

Installation

You can install the development version of mimic from GitHub with:

# install.packages("devtools")
devtools::install_github("gsk-tech/mimic")

Example

This is a basic example which shows you how to solve a common problem:

library(mimic)
## basic example code
example_df <- dplyr::tribble(
  ~from, ~to, ~prob, ~med, 
  "SD", "RE", 0.41,  2.1,
  "SD", "PD", 0.238,  3,
  "SD", "EPD", 0.2,  0.5,
  "SD", "DE", 0.152,  22.1,
  "RE", "PD", 0.9, 20,
  "RE", "DE", 0.1, 40,
  "PD", "DE", 1, 15,
  "EPD", "DE",  1, 3
)

# Create a state Space object 
state_space <- state_space_mix(example_df, med_time = "med")
# View state space diagram 
view_state_space(state_space)

# Simulate complete data. This is the dataset reflects the underlying truth for an subject for when they transitioned into each state 
generate_complete_data(state_space, sample_size = 100)
#> # A tibble: 325 × 3
#> # Groups:   subjid [100]
#>    state trans_time subjid
#>    <chr>      <dbl>  <int>
#>  1 SD          0         1
#>  2 RE         11.3       1
#>  3 PD         25.8       1
#>  4 DE         28.0       1
#>  5 SD          0         2
#>  6 RE          1.78      2
#>  7 PD          8.92      2
#>  8 DE         34.2       2
#>  9 SD          0         3
#> 10 RE          1.26      3
#> # ℹ 315 more rows
# Add in missing data

About

No description, website, or topics provided.

Resources

License

Unknown, Apache-2.0 licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages