Truncated stick-breaking representation of DP(alpha, G0).
Source:R/ghstk.R
morie_ghosal_stick_breaking_trunc.RdTruncated stick-breaking representation of DP(alpha, G0).
Usage
morie_ghosal_stick_breaking_trunc(
x,
alpha = 1,
K = 50,
seed = 0,
base_mean = NULL,
base_sd = NULL,
deterministic_seed = NULL
)Arguments
- x
Numeric data vector.
- alpha
DP concentration parameter (default 1).
- K
Integer truncation level (default 50).
- seed
Integer RNG seed (default 0).
- base_mean
Optional base-measure mean.
- base_sd
Optional base-measure sd.
- deterministic_seed
Optional integer; if supplied, RNG state is derived via
morie_det_rng()keyed on ("ghstk", deterministic_seed) so Py<->R streams agree on the canonical fixture. WhenNULL(default) behaviour is unchanged.
Examples
morie_ghosal_stick_breaking_trunc(x = rnorm(50))
#> $estimate
#> [1] 0.4239458
#>
#> $weights
#> [1] 3.950667e-01 3.912725e-01 1.563129e-03 1.668767e-01 2.360000e-02
#> [6] 8.675169e-03 3.472155e-03 5.386005e-03 4.034164e-03 4.794033e-05
#> [11] 1.985143e-06 1.780903e-06 1.446300e-06 1.657358e-07 1.091618e-07
#> [16] 1.155845e-08 1.571870e-08 4.688304e-10 3.390766e-10 2.391624e-10
#> [21] 1.306862e-10 5.368951e-11 6.012820e-11 1.145508e-11 2.398805e-12
#> [26] 9.578494e-13 2.707303e-12 1.862739e-12 1.264294e-12 2.581448e-13
#> [31] 1.654424e-14 4.688918e-16 8.802255e-16 1.831360e-15 8.566658e-16
#> [36] 2.864804e-16 2.327316e-17 7.470758e-17 5.022528e-18 1.113746e-17
#> [41] 3.089505e-18 2.328191e-17 2.734600e-18 2.247048e-18 1.444525e-19
#> [46] 1.718372e-19 1.271301e-19 5.881733e-21 3.071715e-20 7.066752e-21
#>
#> $atoms
#> [1] 0.74034443 -0.68782535 -0.54049733 0.06661226 -1.01183556 0.55237535
#> [7] -1.14961298 1.51331977 -0.43485468 1.56174586 -0.35405883 -0.86697033
#> [13] 0.04718916 0.04910648 -1.51561160 0.98947734 -1.00195179 0.33145525
#> [19] 0.47730973 0.15042794 -0.08491753 0.20506802 -0.95530653 -0.71204907
#> [25] -0.99660615 1.47176066 1.39637441 0.26459162 -1.10576990 0.02051912
#> [31] 1.40906832 -0.41194886 0.75505760 -0.86854244 0.65559954 -0.85189936
#> [37] -1.10467572 -0.85286402 -0.77304649 -0.81052094 0.70315855 0.08670773
#> [43] -0.27272014 -0.97162605 -0.90695937 -0.67959113 -1.00206262 -0.38672872
#> [49] 0.45618053 -1.05774642
#>
#> $effective_K
#> [1] 9
#>
#> $trunc_err_bound
#> [1] 8.881784e-16
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "Truncated stick-breaking DP draw (Sethuraman 1994)"
#>