Learn R Programming

simstudy (version 0.9.2)

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

980

Version

0.9.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Keith Goldfeld

Last Published

February 9th, 2026

Functions in simstudy (0.9.2)

blockExchangeMat

Create a block correlation matrix with exchangeable structure
blockDecayMat

Create a block correlation matrix
defReadAdd

Read external csv data set definitions for adding columns
gammaGetShapeRate

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

Distributions for Data Definitions
defDataAdd

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

Add single row to definitions table
genCorOrdCat

Generate correlated ordinal categorical data
defRepeatAdd

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

Add multiple (similar) rows to definitions table
genData

Calling function to simulate data
genDataDensity

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

Create dummy variables from a factor or integer variable
genCatFormula

Generate Categorical Formula
genFactor

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

Simulate clustered data
genFormula

Generate a linear formula
genCorFlex

Create multivariate (correlated) data - for general distributions
defReadCond

Read external csv data set definitions for adding columns
genCorData

Create correlated data
genCorGen

Create multivariate (correlated) data - for general distributions
genObs

Create an observed data set that includes missing data
genCorMat

Create a correlation matrix
genNthEvent

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

Add single row to survival definitions
delColumns

Delete columns from existing data set
genMiss

Generate missing data
genMarkov

Generate Markov chain
genSurv

Generate survival data
genOrdCat

Generate ordinal categorical data
genSpline

Generate spline curves
simstudy-deprecated

Deprecated functions in simstudy
survParamPlot

Plot survival curves
survGetParams

Get survival curve parameters
genSynthetic

Generate synthetic data
mergeData

Merge two data.tables without modifying inputs
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
genMixFormula

Generate Mixture Formula
updateDefAdd

Update definition table
genMultiFac

Generate multi-factorial data
trtAssign

Assign treatment
scenario_list

Create list of parameter scenarios
trimData

Trim longitudinal data file once an event has occurred
updateDef

Update definition table
negbinomGetSizeProb

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

Mark parameters as grouped
iccRE

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

simstudy: Simulation of Study Data
trtStepWedge

Assign treatment for stepped-wedge design
trtObserve

Observed exposure or treatment
viewBasis

Plot basis spline functions
viewSplines

Plot spline curves
addMultiFac

Add multi-factorial data
addCompRisk

Generating single competing risk survival variable
addCondition

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

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

Add columns to existing data set
addPeriods

Create longitudinal/panel data
addCorGen

Create multivariate (correlated) data - for general distributions
addCorFlex

Create multivariate (correlated) data - for general distributions
addMarkov

Add Markov chain
addCorData

Add correlated data to existing data.table
defMiss

Definitions for missing data
addSynthetic

Add synthetic data to existing data set
defCondition

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

Read external csv data set definitions
catProbs

Generate Categorical Formula
betaGetShapes

Convert beta mean and precision parameters to two shape parameters