post_process: Post-process a Posterior Sample

Description Usage Arguments Details Value See Also Examples

View source: R/post_process.R

Description

Post-process the results of ggumMCMC or ggumMC3 using an artificial identifiability constraint (AIC).

Usage

1
post_process(sample, constraint, expected_sign)

Arguments

sample

A numeric matrix of posterior draws as returned by ggumMCMC or ggumMC3.

constraint

An integer vector of length one giving the column number of the parameter to constrain, or a character vector of length one giving the column name for the constraint.

expected_sign

A character vector of length one giving the sign for the constraint; it should be either "-" if the constrained parameter is to be negative or "+" if the constrained parameter is to be positive.

Details

Since under the GGUM the probability of a response is the same for any given choice of theta and delta parameters and the negative of that choice; i.e.

Pr(z | θ, α, δ, τ) = Pr(z | -θ, α, -δ, τ),

if symmetric priors are used, the posterior has a reflective mode. This function transforms a posterior sample by enforcing a constraint that a particular parameter is of a given sign, essentially transforming it into a sample from only one of the reflective modes if a suitable constraint is chosen; using a sufficiently extreme parameter is suggested.

Please see the vignette (via vignette("bggum")) for a full in-depth practical guide to Bayesian estimation of GGUM parameters.

Value

A numeric matrix, the post-processed sample.

See Also

ggumMCMC, ggumMC3

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## NOTE: This is a toy example just to demonstrate the function, which uses
## a small dataset and an unreasonably low number of sampling interations.
## For a longer practical guide on Bayesian estimation of GGUM parameters,
## please see the vignette ( via vignette("bggum") ).
## We'll simulate data to use for this example:
set.seed(123)
sim_data <- ggum_simulation(100, 10, 2)
## Now we can generate posterior draws
## (for the purposes of example, we use 100 iterations,
## though in practice you would use much more)
draws <- ggumMC3(data = sim_data$response_matrix, n_temps = 2,
                 sd_tune_iterations = 100, temp_tune_iterations = 100,
                 temp_n_draws = 50,
                 burn_iterations = 100, sample_iterations = 100)
## Then you can post-process the output
processed_draws <- post_process(sample = draws,
                                constraint = which.min(sim_data$theta),
                                expected_sign = "-")

duckmayr/bggum documentation built on Jan. 20, 2020, 5:23 a.m.