student_t: Shifted and scaled t distributions

Description Usage Arguments Value Examples

Description

The functions are designed for compatibility with Stan's student t distribution which has three parameters: degrees of freedom, mean, and standard deviation.

Usage

1
rstudent_t(n, df, mean = 0, sigma = 1, sd = NULL)

Arguments

n

Number of random draws to perform.

df

Degrees of freedom

mean

Location parameter (equals mean when df > 1).

sigma

Scale parameter. Note: this is smaller than the standard deviation (when the standard deviation exists).

sd

Standard deviation of distribution, but note that this only exists when df > 2. If provided, sd supersedes sigma. A warning message is provided when df <= 2 and sd is used.

Value

A vector of random draws from the appropriate t distribution(s).

Examples

1
2
3
4
5
rstudent_t(5, mean = 10, sigma = 2, df = 3)
rstudent_t(5, mean = 10, sd = 2, df = 3)
sd(rstudent_t(5000, mean = 10, sd = 2, df = 4))
# sigma = 2, sd = 2 * sqrt(4/2) approx 2.8
sd(rstudent_t(50000, mean = 10, sigma = 2, df = 4))

rpruim/CalvinBayes documentation built on April 12, 2021, 1:49 p.m.