Description Usage Value Examples
View source: R/distributions.R
This function initializes the Distributions package that many of the bigsimr functions work with.
1 |
Return the imported wrapper of Distributions.jl Julia package
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## distributions_setup() is time-consuming and requires Julia+Distributions.jl
## Not run:
library(bigsimr)
bs <- bigsimr::bigsimr_setup()
dist <- bigsimr::distributions_setup()
JuliaCall::julia_eval('using Random; Random.seed!(1);')
# Generate random target correlation matrix
target_corr <- bs$cor_randPD(3)
# Set the margins of variables
margins <- c(dist$Binomial(20, 0.2), dist$Beta(2, 3), dist$LogNormal(3, 1))
# Adjust target correlation matrix using Pearson matching
adjusted_corr <- bs$pearson_match(target_corr, margins)
# Generate random vectors
x <- bs$rvec(10000, adjusted_corr, margins)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.