ctsem (version 3.0.4)

plot.ctStanModel: Prior plotting

Description

Plots priors for free model parameters in a ctStanModel.

Usage

# S3 method for ctStanModel
plot(x, rows = "all", wait = FALSE,
  nsamples = 1e+06, rawpopsd = "marginalise", inddifdevs = c(-1, 1),
  ...)

Arguments

x

ctStanModel object as generated by ctModel with type='stanct' or 'standt'.

rows

vector of integers denoting which rows of ctstanmodel$pars to plot priors for. Character string 'all' plots all rows with parameters to be estimated.

wait

If true, user is prompted to continue before plotting next graph.

nsamples

Numeric. Higher values increase fidelity (smoothness / accuracy) of density plots, at cost of speed.

rawpopsd

Either 'marginalise' to sample from the specified (in the ctstanmodel) prior distribution for the raw population standard deviation, or a numeric value to use for the raw population standard deviation for all subject level prior plots - the plots in dotted blue or red.

inddifdevs

numeric vector of length 2, setting the means for the individual differences distributions.

...

not used.

Details

Plotted in black is the prior for the population mean. In red and blue are the subject level priors that result given that the population mean is estimated as 1 std deviation above the mean of the prior, or 1 std deviation below. The distributions around these two points are then obtained by marginalising over the prior for the raw population std deviation - so the red and blue distributions do not represent any specific subject level prior, but rather characterise the general amount and shape of possible subject level priors at the specific points of the population mean prior.

Examples

Run this code
# NOT RUN {
model <- ctModel(type='omx', Tpoints=50,
n.latent=2, n.manifest=1, 
manifestNames='sunspots', 
latentNames=c('ss_level', 'ss_velocity'),
LAMBDA=matrix(c( 1, 'ma1' ), nrow=1, ncol=2),
DRIFT=matrix(c(0, 1,   'a21', 'a22'), nrow=2, ncol=2, byrow=TRUE),
MANIFESTMEANS=matrix(c('m1'), nrow=1, ncol=1),
# MANIFESTVAR=matrix(0, nrow=1, ncol=1),
CINT=matrix(c(0, 0), nrow=2, ncol=1),
DIFFUSION=matrix(c(
  0, 0,
  0, "diffusion"), ncol=2, nrow=2, byrow=TRUE))

stanmodel=ctStanModel(model)
plot(stanmodel,rows=8)
# }

Run the code above in your browser using DataCamp Workspace