distributions_setup: Setup Distributions.jl

Description Usage Value Examples

View source: R/distributions.R

Description

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

Usage

1

Value

Return the imported wrapper of Distributions.jl Julia package

Examples

 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)

bigsimr documentation built on Sept. 12, 2021, 1:07 a.m.