Learn R Programming

simstudy (version 0.9.0)

Simulation of Study Data

Description

Simulates data sets in order to explore modeling techniques or better understand data generating processes. The user specifies a set of relationships between covariates, and generates data based on these specifications. The final data sets can represent data from randomized control trials, repeated measure (longitudinal) designs, and cluster randomized trials. Missingness can be generated using various mechanisms (MCAR, MAR, NMAR).

Copy Link

Version

Install

install.packages('simstudy')

Monthly Downloads

7,050

Version

0.9.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Keith Goldfeld

Last Published

October 6th, 2025

Functions in simstudy (0.9.0)

defMiss

Definitions for missing data
catProbs

Generate Categorical Formula
addSynthetic

Add synthetic data to existing data set
defDataAdd

Add single row to definitions table that will be used to add data to an existing data.table
defRepeat

Add multiple (similar) rows to definitions table
distributions

Distributions for Data Definitions
genCatFormula

Generate Categorical Formula
genCluster

Simulate clustered data
genData

Calling function to simulate data
gammaGetShapeRate

Convert gamma mean and dispersion parameters to shape and rate parameters
genCorOrdCat

Generate correlated ordinal categorical data
defSurv

Add single row to survival definitions
blockExchangeMat

Create a block correlation matrix with exchangeable structure
genMixFormula

Generate Mixture Formula
defReadAdd

Read external csv data set definitions for adding columns
genCorGen

Create multivariate (correlated) data - for general distributions
genCorMat

Create a correlation matrix
delColumns

Delete columns from existing data set
defReadCond

Read external csv data set definitions for adding columns
genNthEvent

Generate event data using longitudinal data, and restrict output to time until the nth event.
genDataDensity

Generate data from a density defined by a vector of integers
genSpline

Generate spline curves
genDummy

Create dummy variables from a factor or integer variable
genMultiFac

Generate multi-factorial data
genFormula

Generate a linear formula
genFactor

Create factor variable from an existing (non-double) variable
defRepeatAdd

Add multiple (similar) rows to definitions table that will be used to add data to an existing data.table
genCorData

Create correlated data
genSurv

Generate survival data
genOrdCat

Generate ordinal categorical data
genCorFlex

Create multivariate (correlated) data - for general distributions
genMarkov

Generate Markov chain
genMiss

Generate missing data
iccRE

Generate variance for random effects that produce desired intra-class coefficients (ICCs) for clustered data.
grouped

Mark parameters as grouped
genSynthetic

Generate synthetic data
viewSplines

Plot spline curves
viewBasis

Plot basis spline functions
survParamPlot

Plot survival curves
survGetParams

Get survival curve parameters
simstudy-deprecated

Deprecated functions in simstudy
updateDef

Update definition table
updateDefAdd

Update definition table
simstudy-package

simstudy: Simulation of Study Data
genObs

Create an observed data set that includes missing data
trtAssign

Assign treatment
trimData

Trim longitudinal data file once an event has occurred
logisticCoefs

Determine intercept, treatment/exposure and covariate coefficients that can be used for binary data generation with a logit link and a set of covariates
mergeData

Merge two data.tables without modifying inputs
negbinomGetSizeProb

Convert negative binomial mean and dispersion parameters to size and prob parameters
trtStepWedge

Assign treatment for stepped-wedge design
scenario_list

Create list of parameter scenarios
trtObserve

Observed exposure or treatment
addMarkov

Add Markov chain
addCorGen

Create multivariate (correlated) data - for general distributions
addMultiFac

Add multi-factorial data
addDataDensity

Add data from a density defined by a vector of integers
addCorFlex

Create multivariate (correlated) data - for general distributions
addColumns

Add columns to existing data set
addCorData

Add correlated data to existing data.table
addPeriods

Create longitudinal/panel data
addCompRisk

Generating single competing risk survival variable
addCondition

Add a single column to existing data set based on a condition
betaGetShapes

Convert beta mean and precision parameters to two shape parameters
defRead

Read external csv data set definitions
defData

Add single row to definitions table
blockDecayMat

Create a block correlation matrix
defCondition

Add single row to definitions table of conditions that will be used to add data to an existing definitions table