distributions_setup {bigsimr}R Documentation

Setup Distributions.jl

Description

This function initializes the Distributions package that many of the bigsimr functions work with.

Usage

distributions_setup()

Value

Return the imported wrapper of Distributions.jl Julia package

Examples

## 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)

[Package bigsimr version 0.11.2 Index]