Learn R Programming

simstudy (version 0.9.1)

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

1,919

Version

0.9.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Keith Goldfeld

Last Published

December 16th, 2025

Functions in simstudy (0.9.1)

catProbs

Generate Categorical Formula
betaGetShapes

Convert beta mean and precision parameters to two shape parameters
defRepeat

Add multiple (similar) rows to definitions table
defRead

Read external csv data set definitions
genDataDensity

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

Distributions for Data Definitions
genMixFormula

Generate Mixture Formula
genDummy

Create dummy variables from a factor or integer variable
genMarkov

Generate Markov chain
genMiss

Generate missing data
genCorData

Create correlated data
genMultiFac

Generate multi-factorial data
genCorFlex

Create multivariate (correlated) data - for general distributions
gammaGetShapeRate

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

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

Add single row to survival definitions
genCatFormula

Generate Categorical Formula
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
delColumns

Delete columns from existing data set
defRepeatAdd

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

Simulate clustered data
genObs

Create an observed data set that includes missing data
genCorOrdCat

Generate correlated ordinal categorical data
survParamPlot

Plot survival curves
genCorGen

Create multivariate (correlated) data - for general distributions
mergeData

Merge two data.tables without modifying inputs
genCorMat

Create a correlation matrix
negbinomGetSizeProb

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

Get survival curve parameters
defReadAdd

Read external csv data set definitions for adding columns
updateDef

Update definition table
genFactor

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

Read external csv data set definitions for adding columns
trtStepWedge

Assign treatment for stepped-wedge design
trtObserve

Observed exposure or treatment
scenario_list

Create list of parameter scenarios
updateDefAdd

Update definition table
trimData

Trim longitudinal data file once an event has occurred
genSpline

Generate spline curves
genFormula

Generate a linear formula
genOrdCat

Generate ordinal categorical data
genSynthetic

Generate synthetic data
grouped

Mark parameters as grouped
genData

Calling function to simulate data
genSurv

Generate survival data
iccRE

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

Plot spline curves
viewBasis

Plot basis spline functions
simstudy-deprecated

Deprecated functions in simstudy
simstudy-package

simstudy: Simulation of Study Data
trtAssign

Assign treatment
addColumns

Add columns to existing data set
addCompRisk

Generating single competing risk survival variable
addMultiFac

Add multi-factorial data
addMarkov

Add Markov chain
addCorData

Add correlated data to existing data.table
addCondition

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

Create multivariate (correlated) data - for general distributions
addCorGen

Create multivariate (correlated) data - for general distributions
addPeriods

Create longitudinal/panel data
addDataDensity

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

Create a block correlation matrix
addSynthetic

Add synthetic data to existing data set
defMiss

Definitions for missing data
defCondition

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

Add single row to definitions table
defDataAdd

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

Create a block correlation matrix with exchangeable structure