| RandomEffectSamples | R Documentation |
Coordinates various C++ random effects classes and persists those needed for prediction / serialization
rfx_container_ptrExternal pointer to a C++ StochTree::RandomEffectsContainer class
label_mapper_ptrExternal pointer to a C++ StochTree::LabelMapper class
training_group_idsUnique vector of group IDs that were in the training dataset
new()Create a new RandomEffectSamples object.
RandomEffectSamples$new()
A new RandomEffectSamples object.
load_in_session()Construct RandomEffectSamples object from other "in-session" R objects
RandomEffectSamples$load_in_session( num_components, num_groups, random_effects_tracker )
num_componentsNumber of "components" or bases defining the random effects regression
num_groupsNumber of random effects groups
random_effects_trackerObject of type RandomEffectsTracker
None
load_from_json()Construct RandomEffectSamples object from a json object
RandomEffectSamples$load_from_json( json_object, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label )
json_objectObject of class CppJson
json_rfx_container_labelLabel referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
json_rfx_mapper_labelLabel referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
json_rfx_groupids_labelLabel referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
A new RandomEffectSamples object.
append_from_json()Append random effect draws to RandomEffectSamples object from a json object
RandomEffectSamples$append_from_json( json_object, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label )
json_objectObject of class CppJson
json_rfx_container_labelLabel referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
json_rfx_mapper_labelLabel referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
json_rfx_groupids_labelLabel referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
None
load_from_json_string()Construct RandomEffectSamples object from a json object
RandomEffectSamples$load_from_json_string( json_string, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label )
json_stringJSON string which parses into object of class CppJson
json_rfx_container_labelLabel referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
json_rfx_mapper_labelLabel referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
json_rfx_groupids_labelLabel referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
A new RandomEffectSamples object.
append_from_json_string()Append random effect draws to RandomEffectSamples object from a json object
RandomEffectSamples$append_from_json_string( json_string, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label )
json_stringJSON string which parses into object of class CppJson
json_rfx_container_labelLabel referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
json_rfx_mapper_labelLabel referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
json_rfx_groupids_labelLabel referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
None
predict()Predict random effects for each observation implied by rfx_group_ids and rfx_basis.
If a random effects model is "intercept-only" the rfx_basis will be a vector of ones of size length(rfx_group_ids).
RandomEffectSamples$predict(rfx_group_ids, rfx_basis = NULL)
rfx_group_idsIndices of random effects groups in a prediction set
rfx_basis(Optional ) Basis used for random effects prediction
Matrix with as many rows as observations provided and as many columns as samples drawn of the model.
extract_parameter_samples()Extract the random effects parameters sampled. With the "redundant parameterization" of Gelman et al (2008), this includes four parameters: alpha (the "working parameter" shared across every group), xi (the "group parameter" sampled separately for each group), beta (the product of alpha and xi, which corresponds to the overall group-level random effects), and sigma (group-independent prior variance for each component of xi).
RandomEffectSamples$extract_parameter_samples()
List of arrays. The alpha array has dimension (num_components, num_samples) and is simply a vector if num_components = 1.
The xi and beta arrays have dimension (num_components, num_groups, num_samples) and is simply a matrix if num_components = 1.
The sigma array has dimension (num_components, num_samples) and is simply a vector if num_components = 1.
delete_sample()Modify the RandomEffectsSamples object by removing the parameter samples index by sample_num.
RandomEffectSamples$delete_sample(sample_num)
sample_numIndex of the RFX sample to be removed
extract_label_mapping()Convert the mapping of group IDs to random effect components indices from C++ to R native format
RandomEffectSamples$extract_label_mapping()
List mapping group ID to random effect components.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.