Description Usage Arguments Details Value Examples
Random generation for a mixture of normal distributions, both centered around zero and bias corrected, as well as exponentiated.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
n |
sample size, or a vector of random deviates to update if 'replace = TRUE'. |
sigma |
variance of the underlying normal distribution, defaults to 0.1. Ignored if 'replace = TRUE'. |
high_sigma |
variance of the sporadic normal distribution, should be higher than 'sigma', defaults to 1.5. |
rate |
rate at which the wider sporadic normal distribution replaces the underlying distribution. This is determined by a binomial process using 'rbinom(1, n, rate)'. |
bias_correct |
logical. Should we bias correct analytically. |
sample_bias_correct |
logical. Should we bias correct using the sample mean, which results in a mean of exactly 1. Defaults to 'FALSE'. If 'bias_correct = TRUE' then this parameter is ignored (i.e. equals 'FALSE'). |
ac |
auto-correlation value, between -1 and 1. If 'ac != 0' autocorrelation is incorporated in the vector using an AR(1) process, and is applied after exponentiating except when 'log = TRUE'. |
log |
logical. Whether to return the distribution before it is bias corrected and exponentiated. This is not equivalent to log-transforming the distribution when 'log = FALSE'. |
skew |
value of skewness parameter. When set, the skew-normal distribution from the 'sn' package is used (i.e. 'sn::rsn'), therefore when setting 'seed' the drawn values will probably differ to those without skew. Defaults to 'NULL', where no skewness is incorporated and the traditional 'rnorm' function is used. |
seed |
seed. Numeric for 'set.seed()'. Defaults to NA where no seed is set. |
replace |
logical. Whether to replace a vector of deviates using sporadic values or create it from scratch. If 'TRUE', then 'n' needs to be a vector of positive deviates centered around 1. |
Both normal distributions are bias corrected independently so that their means in log-space equal to 1 (-σ^2/2).
a vector of random deviates of length 'n'. If there were sporadic deviates where the 'high_sigma' distribution replaced the underlying one, then the positions of these events are stored in the 'ht' attribute of the vector.
1 2 | rnt <- rnorm_tails(500, sigma = 0.2, high_sigma = 1.5, rate = 1/19)
plot_tails(rnt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.