Learn R Programming

extraDistr (version 1.8.1)

NonStandardT: Non-standard t-distribution

Description

Probability mass function, distribution function and random generation for non-standard t-distribution. Non-standard t-distribution besides degrees of freedom $\nu$, is parametrized using additional parameters $\mu$ for location and $\sigma$ for scale ($\mu=0$ and $\sigma = 1$ for standard t-distribution).

Usage

dnst(x, df, mu = 0, sigma = 1, log = FALSE)
pnst(q, df, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
qnst(p, df, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
rnst(n, df, mu = 0, sigma = 1)

Arguments

x, q
vector of quantiles.
df
degrees of freedom (> 0, maybe non-integer). df = Inf is allowed.
mu
vector of locations
sigma
vector of positive valued scale parameters.
log, log.p
logical; if TRUE, probabilities p are given as log(p).
lower.tail
logical; if TRUE (default), probabilities are $P[X \le x]$ otherwise, $P[X > x]$.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.

See Also

TDist

Examples

Run this code

x <- rnst(1e5, 1000, 5, 13)
xx <- seq(-60, 60, by = 0.01)
hist(x, 100, freq = FALSE)
lines(xx-0.5, dnst(xx, 1000, 5, 13), col = "red")
hist(pnst(x, 1000, 5, 13))
plot(ecdf(x))
lines(xx, pnst(xx, 1000, 5, 13), col = "red", lwd = 2)

Run the code above in your browser using DataLab