if (FALSE) {
# 1) Fit mgm to example dataset (true edges: 1-4, 2-3, 1-2)
mgm_obj <- mgm(data = mgm_data$data,
type = c('g', 'c', 'c', 'g'),
level = c(1, 2, 4, 1),
k = 2,
lambdaSel = 'CV',
threshold = 'none')
# 2) Take 50 bootstrap samples using resample()
res_obj <- resample(object = mgm_obj,
data = mgm_data$data,
nB = 50)
# 3) Plot histogram of bootstrapped sampling distribution of edge 1-4
hist(res_obj$bootParameters[1, 4, ],
main = "",
xlab = "Parameter Estimate")
# 4) Plot summary of all sampling distributions
plotRes(object = res_obj,
quantiles = c(0.05, .95))
# For more examples see https://github.com/jmbh/mgmDocumentation
}
Run the code above in your browser using DataLab