Learn R Programming

ctsem (version 3.0.9)

ctStanGenerate: Generate data from a ctstanmodel object

Description

Generate data from a ctstanmodel object

Usage

ctStanGenerate(
  ctm,
  datastruct,
  optimize = TRUE,
  is = FALSE,
  fullposterior = TRUE,
  nsamples = 200,
  parsonly = FALSE,
  ...
)

Arguments

ctm

ctStanModel object.

datastruct

long format data structure as used by ctsem.

optimize

Whether to optimize or use Stan's HMC sampler

is

If optimizing, follow up with importance sampling?

fullposterior

Generate from the full posterior or just the mean?

nsamples

How many samples to generate?

parsonly

If TRUE, only return samples of raw parameters, don't generate data.

...

arguments to pass to stanoptimis

Value

Array of nsamples x time points x manifest variables.

Examples

Run this code
# NOT RUN {
m1 <- ctModel(type = 'stanct',
manifestNames = c('Exercise1'), 
latentNames=c('Exercise'),
DRIFT= 0,
DIFFUSION=0,
CINT='cint1',
T0MEANS='t0m1',
T0VAR=0, #only need to set this when t0means not individually varying
LAMBDA = 1,
MANIFESTMEANS=0,
MANIFESTVAR='merror')


#generate and plot samples from prior predictive
priorpred <- ctStanGenerate(ctm = m1,datastruct = exfitdat,cores=6,nsamples = 50)
# }

Run the code above in your browser using DataLab