README.md

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
)


Try the simPreg package in your browser

Any scripts or data that you put into this service are public.

simPreg documentation built on Sept. 27, 2026, 5:06 p.m.