Underlying function used in most plotting and object handling functions in
EMC2. Can for example be used to filter/thin a parameter type
(i.e, group-level means mu
) and convert to an mcmc.list.
get_pars(
emc,
selection = "mu",
stage = get_last_stage(emc),
thin = 1,
filter = 0,
map = FALSE,
add_recalculated = FALSE,
length.out = NULL,
by_subject = FALSE,
return_mcmc = TRUE,
merge_chains = FALSE,
subject = NULL,
flatten = FALSE,
remove_dup = FALSE,
remove_constants = TRUE,
use_par = NULL,
type = NULL,
true_pars = NULL,
chain = NULL,
covariates = NULL
)
An mcmc.list object of the selected parameter types with the specified manipulations
an emc object.
A Character string. Indicates which parameter type to select (e.g., alpha
, mu
, sigma2
, correlation
).
A character string. Indicates from which sampling stage(s) to take the samples from (i.e. preburn
, burn
, adapt
, sample
)
An integer. By how much to thin the chains
Integer or numeric vector. If an integer is supplied, iterations up until that integer are removed. If a vector is supplied, the iterations within the range are kept.
Boolean. If TRUE
parameters will be mapped back to the cells of
the experimental design using the design matrices.
Otherwise the sampled parameters are returned.
Only works for selection = mu
or selection = alpha
.
Boolean. If TRUE
will also add recalculated parameters,
such as b in the LBA (b = B + A; see ?LBA
), or z in the DDM z = Z*A (see ?DDM
)
only works when map = TRUE
Integer. Alternatively to thinning, you can also select a desired length of the MCMC chains, which will be thinned appropriately.
Boolean. If TRUE
for selections that include subject parameters (e.g. alpha
),
plot/stats are organized by subject, otherwise by parameter.
Boolean. If TRUE
returns an mcmc.list object, otherwise a matrix/array with the parameter type.
Boolean. If TRUE
returns parameter type merged across chains.
Integer (vector) or character (vector). If an integer will select the 'x'th subject(s), if a character it should match subject names in the data which will be selected.
Boolean. If FALSE
for 3-dimensional samples (e.g., correlations: n-pars x n-pars x iterations).
organizes by the dimension containing parameter names, otherwise collapses names across the first and second dimension.
Does not apply for selection = "alpha"
Boolean. If TRUE
removes duplicate values from the samples. Automatically set to TRUE
if flatten = TRUE
Boolean. If TRUE
removes constant values from the samples (e.g. 0s in the covariance matrix).
Character (vector). If specified, only these parameters are returned. Should match the parameter names
(i.e. these are collapsed when flatten = TRUE
and use_par should also be collapsed names).
Character indicating the group-level model selected. Only necessary if sampler isn't specified.
Set of true_parameters
can be specified to apply flatten or use_par on a set of true parameters
Integer. Which of the chain(s) to return
Only needed with plot
for priors and covariates in the design
# E.g. get the group-level mean parameters mapped back to the design
get_pars(samples_LNR, stage = "sample", map = TRUE, selection = "mu")
# Or return the flattened correlation, with 10 iterations per chain
get_pars(samples_LNR, stage = "sample", selection = "correlation", flatten = TRUE, length.out = 10)
Run the code above in your browser using DataLab