rst_tails: Random generation of Student-t deviations

Description Usage Arguments Value Examples

View source: R/rst_tails.R

Description

Random generation for the Student-t distribution, centered around zero, exponentiated, with 'df' degrees of freedom.

Usage

1
2
3
4
5
6
7
8
9
rst_tails(
  n,
  df = 10,
  bias_correct = TRUE,
  ac = 0,
  log = FALSE,
  skew = NULL,
  seed = NA
)

Arguments

n

sample size.

df

degrees of freedom (> 0). Default is df = 10. df = -Inf is allowed if bias.correct = FALSE, where it becomes equivalent to the standard normal distribution.

bias_correct

logical. Should we bias correct using the sample mean. The sample mean is calculated from exponentiated distribution, but is subtracted from the distribution in normal space, which is then re-exponentiated. Therefore, the bias-correction produces a distribution with a mean of exactly 1.

ac

auto-correlation value, between -1 and 1. If 'ac != 0' then autocorrelation is incorporated in the vector using an AR(1) process.

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. If unspecified then no skewness is incorporated. Defaults to 'NULL'.

seed

seed. Numeric for 'set.seed()'. Defaults to NA where no seed is set.

Value

a vector of random deviates of length 'n'.

Examples

1
2
3
rst <- rst_tails(50, 3)
plot_tails(rst)
mean(rst) == 1

sebpardo/rtails documentation built on Dec. 22, 2021, 11:17 p.m.