View source: R/serialization.R
loadRandomEffectSamplesCombinedJson | R Documentation |
Combine multiple JSON model objects containing random effects (with the same hierarchy / schema) into a single container
loadRandomEffectSamplesCombinedJson(json_object_list, json_rfx_num)
json_object_list |
List of objects of class |
json_rfx_num |
Integer index indicating the position of the random effects term to be unpacked |
RandomEffectSamples
object
n <- 100
p <- 10
X <- matrix(runif(n*p), ncol = p)
rfx_group_ids <- sample(1:2, size = n, replace = TRUE)
rfx_basis <- rep(1.0, n)
y <- (-5 + 10*(X[,1] > 0.5)) + (-2*(rfx_group_ids==1)+2*(rfx_group_ids==2)) + rnorm(n)
bart_model <- bart(X_train=X, y_train=y, rfx_group_ids_train=rfx_group_ids,
rfx_basis_train = rfx_basis, num_gfr=0, num_mcmc=10)
bart_json <- list(saveBARTModelToJson(bart_model))
rfx_samples <- loadRandomEffectSamplesCombinedJson(bart_json, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.