Simulate Pregnancy Data with Time-Varying Exposure

Simulates pregnancy data in a time-to-event framework, allowing a time-varying exposure. Default parameters for gestational length and exposure timing are provided but may also be user-specified. Users can further specify hazard ratios for spontaneous and non-spontaneous live birth and late miscarriage/stillbirth following exposure.


simPreg

simPreg simulates pregnancy data in a time-to-event framework with a time-varying exposure. The package allows users to specify gestational hazard rates and hazard ratios for pregnancy outcomes and exposure.

Installation

The development version of simPreg can be installed from GitHub:

# install.packages("remotes")
remotes::install_github("YOUR-USERNAME/simPreg")

Example

library(simPreg)

# Simulate pregnancy outcome proportions using the default hazard vectors
data.prop <- simPregProp()

# Sample 1000 pregnancies from the simulated proportions
data.samp <- simPregSamp(data.prop, 1000)

# Specify a hazard ratio of 2 for spontaneous and non-spontaneous
# live birth through gestational day 258
hr <- rep(1, 301)
hr[1:258] <- 2

data.prop <- simPregProp(
  hr.spont.livebirth = hr,
  hr.nonspont.livebirth = hr
)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("simPreg")

0.1.0 by Siri N. Skodvin, 21 days ago


Browse source code at https://github.com/cran/simPreg


Authors: Siri N. Skodvin [aut, cre] , Miriam Gjerdevik [ctb] , Hakon K. Gjessing [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests knitr, rmarkdown, survival, testthat


See at CRAN