The core "model" class for sampling random effects.
Source:R/random_effects.R
RandomEffectsModel.RdStores current model state, prior parameters, and procedures for sampling from the conditional posterior of each parameter.
Public fields
rfx_model_ptrExternal pointer to a C++ StochTree::RandomEffectsModel class
num_groupsNumber of groups in the random effects model
num_componentsNumber 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_datasetObject of type
RandomEffectsDatasetresidualObject of type
Outcomerfx_trackerObject of type
RandomEffectsTrackerrfx_samplesObject of type
RandomEffectSampleskeep_sampleWhether sample should be retained in
rfx_samples. IfFALSE, the state ofrfx_trackerwill 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_varianceScalar global variance parameter
rngObject 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.