The core "model" class for sampling random effects.
RandomEffectsModel.Rd
Stores current model state, prior parameters, and procedures for sampling from the conditional posterior of each parameter.
Public fields
rfx_model_ptr
External pointer to a C++ StochTree::RandomEffectsModel class
num_groups
Number of groups in the random effects model
num_components
Number of components (i.e. dimension of basis) in the random effects model
Methods
Method new()
Create a new RandomEffectsModel object.
Usage
RandomEffectsModel$new(num_components, num_groups)
Method sample_random_effect()
Sample from random effects model.
Usage
RandomEffectsModel$sample_random_effect(
rfx_dataset,
residual,
rfx_tracker,
rfx_samples,
keep_sample,
global_variance,
rng
)
Arguments
rfx_dataset
Object of type
RandomEffectsDataset
residual
Object of type
Outcome
rfx_tracker
Object of type
RandomEffectsTracker
rfx_samples
Object of type
RandomEffectSamples
keep_sample
Whether sample should be retained in
rfx_samples
. IfFALSE
, the state ofrfx_tracker
will be updated, but the parameter values will not be added to the sample container. Samples are commonly discarded due to burn-in or thinning.global_variance
Scalar global variance parameter
rng
Object of type
CppRNG
Method predict()
Predict from (a single sample of a) random effects model.
Method set_working_parameter()
Set value for the "working parameter." This is typically used for initialization, but could also be used to interrupt or override the sampler.
Method set_group_parameters()
Set value for the "group parameters." This is typically used for initialization, but could also be used to interrupt or override the sampler.
Method set_working_parameter_cov()
Set value for the working parameter covariance. This is typically used for initialization, but could also be used to interrupt or override the sampler.
Method set_group_parameter_cov()
Set value for the group parameter covariance. This is typically used for initialization, but could also be used to interrupt or override the sampler.