generateSimulatedResults: Generate Simulated Results

View source: R/generateSimulatedResults.R

generateSimulatedResultsR Documentation

Generate Simulated Results

Description

generateSimulatedResults rotates through a parameter space, creating and analyizing simulated data and collating the results

Usage

generateSimulatedResults(
  trialdesigns,
  respparamsets,
  blparamsets,
  censorparams,
  modelparams,
  simparam,
  analysisparams,
  rawdataout = FALSE
)

Arguments

trialdesigns

A list of trial designs of the form generated by buildtrialdesigns

respparamsets

A list of options for respparam as described in generateData

blparamsets

A list of options for blparam as described in generateData

censorparams

A data.table where each row is a set of options for censorparam as described in censordata

modelparams

A data.table where each row is a set of options for modelparams as described in generateData

simparam

The options that control the logistics of the simulations:

  • Nreps Number of repititions for a given set of parameters

  • progressiveSave=TRUE Do you want to save chunks as you go? Helpful if the run is going to take a long time, and you don't want the run to be interrupted 8 hours in to a 9 hour run and lose everything.

  • basesavename If you are using progressivesave, what do you want the base of the filename to be? Will have _save1, _save2, etc appended

  • nRep2save How many parameter sets to you want to run at a time before saving?

  • saveunit2start If you got through part of your parameter space but not all of it, you can start partway through. If starting from the beginning, set to 1

  • savedir What directory do you want to save to?

analysisparams

The options used by lme_analysis. Has the following components:

  • useDE=TRUE Binary: should the LME model use expectnacy information if available?

  • t_random_slope=FALSE Binary: should the LME model use random slopes, as well as random intercepts, for participants?

rawdataout=FALSE

Binary - output the raw data for all simulations? This is memory intensive for large runs.

Details

This is a wrapper for generateData and lme_analysis that systematically works its way through a set of parameters and creates a specified number of repetitions of simulated data and results of analyizing that data for each set of parameter specifications.

Value

Returns a list with three named parts:

  • results A large data table that tells you the parameters used and the analysis results for every simulated trial, one row per simualated trial.

  • parameterselections A list desribing the parameterspace used. This is important because some of the information in out$results is the index of the parameter set selection, and you will need this additional information to interpret it. For example, trialdesigns, respparamset, blparamset, and modelparamset are all indexed.

  • rawdataout If you have rawdataout set to TRUE, you will also get (1) drawdataout$precensor, a list of simulated trial data of a length corresponding to the number of parameter permulations, with the order parallel to that of the main output results. Repititions of a particular parameter set are mixed, identified by irep. And, rawdataout$postcensor, which has the same format but with the psotcensoring data

Examples

  # See vignettes for examples

rchendrickson/pmsimstats documentation built on Nov. 28, 2024, 11:05 a.m.