Write an RSGHB Model Object as Series of CSVs

Share:

Description

Function for writing an RSGHB model object as a series of CSV files to the disk. Files are written in Sawtooth's CBC HB format to allow for easier integration with analysis processes built around that software.

Usage

1
writeModel(object, writeDraws = FALSE, path = getwd())

Arguments

object

an RSGHB model object.

writeDraws

whether to write out the individual draw files. (Defaults to FALSE)

path

the folder location to write the files. (Defaults to getwd())

Details

All output files are named with a object[["modelname"]] prefix. (E.g. modelname.log, modelname_C.csv)

If writeDraws is TRUE, a CSV file for each of object[["gNP"]] individuals is written to the disk. This may take a long time if object[["gNEREP"]] or object[["gNP"]] is large.

Value

None, though a series of files is written to path:

modelname.log

A log file containing summary model information and the estimation iteration detail.

modelname_logPlot.png

A faceted plot of all appropriate model statistics stored in the iteration detail of the model (object[["iter.detail"]]). Depending on the type of parameters estimated, some statistics may be NULL or NA and are omitted.

modelname_A.csv

If object was estimated with random parameters, contains the sample-level means of the underlying normals at each iteration.

modelname_B.csv, modelname_Bsd.csv

If object was estimated with random parameters, contains the mean individual-level draws across iterations for the underlying normals. The Bsd file provides the standard deviations of these individual draws.

modelname_C.csv, modelname_Csd.csv

If object was estimated with random parameters, contains the mean individual-level draws across iterations for the underlying normals while including the appropriate distribution transformations. The Csd file provides the standard deviations of these individual draws. These two files are equivalent to the conditional distributions from models estimated using Maximum Simulated Likelihood methods.

modelname_D.csv

If object was estimated with random parameters, contains a row-based representation of the sample variance-covariance matrix for each iteration.

modelname_F.csv

If object was estimated with fixed parameters, contains the set of fixed (non-random) parameters at each iteration in object[["gNEREP"]].

modelname_pvMatrix.csv

If object was estimated with random parameters, contains the prior variance-covariance matrix that was assumed to estimate the model.

Author(s)

Jeff Keller <jeff.keller@rsginc.com>

See Also

doHB

Examples

1
# writeModel(model)