ctStanPostPredict: Compares model implied density and values to observed, for a...

Description Usage Arguments Details Value Examples

View source: R/ctStanPostPredict.R

Description

Compares model implied density and values to observed, for a ctStanFit object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ctStanPostPredict(
  fit,
  diffsize = 1,
  jitter = 0.02,
  wait = TRUE,
  probs = c(0.025, 0.5, 0.975),
  datarows = "all",
  nsamples = 500,
  resolution = 100,
  plot = TRUE
)

Arguments

fit

ctStanFit object.

diffsize

Integer > 0. Number of discrete time lags to use for data viz.

jitter

Positive numeric between 0 and 1, if TRUE, jitters empirical data by specified proportion of std dev.

wait

Logical, if TRUE and plot=TRUE, waits for input before plotting next plot.

probs

Vector of length 3 containing quantiles to plot – should be rising numeric values between 0 and 1.

datarows

integer vector specifying rows of data to plot. Otherwise 'all' uses all data.

nsamples

Number of datasets to generate for comparisons, if fit object does not contain generated data already.

resolution

Positive integer, the number of rows and columns to split plots into for shading.

plot

logical. If FALSE, a list of ggplot objects is returned.

Details

This function relies on the data generated during each iteration of fitting to approximate the model implied distributions – thus, when limited iterations are available, the approximation will be worse.

Value

If plot=FALSE, an array containing quantiles of generated data. If plot=TRUE, nothing, only plots.

if plot=TRUE, nothing is returned and plots are created. Otherwise, a list containing ggplot objects is returned and may be customized as desired.

Examples

1
2
3
4
if(w32chk()){

ctStanPostPredict(ctstantestfit,wait=FALSE, diffsize=2,resolution=100)
}

ctsem documentation built on July 23, 2021, 5:07 p.m.