Simulating the same number of subjects from the bosms3 dataset doesn't give the same number of transitions.
I wasn't expecting exactly the same numbers but these differences seem weird.
Here below you have an MRE: I used both tidy_sim.fmsm() (defined in #163) and just looked at number of first transitions.
Might this be related to #153?
### MRE sim.fmsm
library(tidyverse)
library(flexsurv)
blnorm <- flexsurvreg(Surv(years, status) ~ trans, data = bosms3,
dist = "lnorm")
tmat <- rbind(c(NA,1,2),c(NA,NA,3),c(NA,NA,NA))
set.seed(777)
invisible(rnorm(1e3))
sim_blnorm <- sim.fmsm(bexp, M = nrow(bosms3), t = max(bosms3$years),
trans = tmat)
sim_blnorm_tidy <-
sim_blnorm %>%
tidy_sim.fmsm()
bosms3 %>% count(status, trans)
# An object of class 'msdata'
#
# Data:
# status trans n
# 1 0 1 *101*
# 2 0 2 175
# 3 0 3 35
# 4 1 1 *103*
# 5 1 2 29
# 6 1 3 68
sim_blnorm_tidy %>% count(status, trans_num)
# # A tibble: 6 × 3
# status trans_num n
# <int> <dbl> <int>
# 1 0 1 *56*
# 2 0 2 56
# 3 0 3 81
# 4 1 1 *345*
# 5 1 2 110
# 6 1 3 264
sim_blnorm$st %>% as_tibble() %>% count(V1 == 1, V2 == 2)
# # A tibble: 2 × 3
# `V1 == 1` `V2 == 2` n
# <lgl> <lgl> <int>
# 1 TRUE FALSE 166
# 2 TRUE TRUE *345*
Simulating the same number of subjects from the
bosms3dataset doesn't give the same number of transitions.I wasn't expecting exactly the same numbers but these differences seem weird.
Here below you have an MRE: I used both
tidy_sim.fmsm()(defined in #163) and just looked at number of first transitions.Might this be related to #153?