ScaledTDist | R Documentation |
Density, distribution function, quantile function, and random generation for
the scaled and shifted t distribution with df
degrees of freedom and
optional parameter scale
. The parameterization is consistent with Gelman et al. (2013).
dst(x, df, mean = 0, sigma = 1, log = FALSE)
rst(n, df, mean = 0, sigma = 1)
qst(p, df, mean = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
pst(q, df, mean = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
x, q |
vector of quantiles. |
df |
degrees of freedom (non-negative, but can be non-integer). |
mean |
vector of means |
sigma |
vector of scaling parameters (see the Details for further information) |
log, log.p |
logical; if |
n |
number of observations. If |
p |
vector of probabilities. |
lower.tail |
logical; if TRUE (default), probabilities are
|
If mean
is omitted, it assumes the default value of 0
. If sigma
is omitted, it assumes the default value of 1
.
The scaled and shifted t distribution with parameters df = n
, mean =
m
and sigma =
s
has density
f(x)= Gamma((n+1)/2)/Gamma(n/2)/\sqrt{n\pi}/s (1 + 1/n ((x - m)/s)^2)^{-(n+1)/2}
for x \ge 0
, n > 0
and s > 0
. (Here Gamma()
is the function implemented by R's
gamma()
and defined in its help.
The mean and variance are E(X) = m
and Var(X) = n/(n-2) s^2
for n>2
.
dst
gives the density, pst
gives the distribution function,
qst
gives the quantile function, and rst
generates random deviates.
Invalid arguments will result in return value NaN
, with a warning.
The length of the result is determined by n
for rst
,
and is the maximum of the lengths of the numerical arguments for the
other functions.
The numerical arguments other than n
are recycled to the length
of the result. Only the first elements of the logical arguments are used.
Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian data analysis, 3rd edition. CRC press.
TDist
1 - pst(1:5, df = 1, mean = 1, sigma = 1.2)
qst(.975, df = c(1:5), mean = 1:5, sigma = 1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.