Learn R Programming

LaplacesDemon (version 16.1.6)

dist.Student.t.Precision: Student t Distribution: Precision Parameterization

Description

These functions provide the density, distribution function, quantile function, and random generation for the univariate Student t distribution with location parameter \(\mu\), precision parameter \(\tau\), and degrees of freedom parameter \(\nu\).

Usage

dstp(x, mu=0, tau=1, nu=10, log=FALSE)
pstp(q, mu=0, tau=1, nu=10, lower.tail=TRUE, log.p=FALSE)
qstp(p, mu=0, tau=1, nu=10, lower.tail=TRUE, log.p=FALSE)
rstp(n, mu=0, tau=1, nu=10)

Arguments

x, q

These are each a vector of quantiles.

p

This is a vector of probabilities.

n

This is the number of observations, which must be a positive integer that has length 1.

mu

This is the location parameter \(\mu\).

tau

This is the precision parameter \(\tau\), which must be positive.

nu

This is the degrees of freedom parameter \(\nu\), which must be positive.

lower.tail

Logical. If lower.tail=TRUE, then probabilities are \(Pr[X \le x]\), otherwise, \(Pr[X > x]\).

log, log.p

Logical. If log=TRUE, then the logarithm of the density or probability is returned.

Value

dstp gives the density, pstp gives the distribution function, qstp gives the quantile function, and rstp generates random deviates.

Details

  • Application: Continuous Univariate

  • Density: \(p(\theta) = \frac{\Gamma((\nu+1)/2)}{\Gamma(\nu/2)} \sqrt{\frac{\tau}{\nu\pi}} (1 + \frac{\tau}{\nu} (\theta-\mu)^2)^{-(\nu+1)/2}\)

  • Inventor: William Sealy Gosset (1908)

  • Notation 1: \(\theta \sim \mathrm{t}(\mu, \sqrt{\tau^{-1}}, \nu)\)

  • Notation 2: \(p(\theta) = \mathrm{t}(\theta | \mu, \sqrt{\tau^{-1}}, \nu)\)

  • Parameter 1: location parameter \(\mu\)

  • Parameter 2: precision parameter \(\tau > 0\)

  • Parameter 3: degrees of freedom \(\nu > 0\)

  • Mean: \(E(\theta) = \mu\), for \(\nu > 1\), otherwise undefined

  • Variance: \(var(\theta) = \frac{1}{\tau}\frac{\nu}{\nu - 2}\), for \(\nu > 2\)

  • Mode: \(mode(\theta) = \mu\)

The Student t-distribution is often used as an alternative to the normal distribution as a model for data. It is frequently the case that real data have heavier tails than the normal distribution allows for. The classical approach was to identify outliers and exclude or downweight them in some way. However, it is not always easy to identify outliers (especially in high dimensions), and the Student t-distribution is a natural choice of model-form for such data. It provides a parametric approach to robust statistics.

The degrees of freedom parameter, \(\nu\), controls the kurtosis of the distribution, and is correlated with the precision parameter \(\tau\). The likelihood can have multiple local maxima and, as such, it is often necessary to fix \(\nu\) at a fairly low value and estimate the other parameters taking this as given. Some authors report that values between 3 and 9 are often good choices, and some authors suggest 5 is often a good choice.

In the limit \(\nu \rightarrow \infty\), the Student t-distribution approaches \(\mathcal{N}(\mu, \sigma^2)\). The case of \(\nu = 1\) is the Cauchy distribution.

See Also

dcauchy, dmvt, dmvtp, dnorm, dnormp, dnormv, dst, dt.

Examples

Run this code
# NOT RUN {
library(LaplacesDemon)
x <- dstp(1,0,1,10)
x <- pstp(1,0,1,10)
x <- qstp(0.5,0,1,10)
x <- rstp(100,0,1,10)

#Plot Probability Functions
x <- seq(from=-5, to=5, by=0.1)
plot(x, dstp(x,0,1,0.1), ylim=c(0,1), type="l", main="Probability Function",
     ylab="density", col="red")
lines(x, dstp(x,0,1,1), type="l", col="green")
lines(x, dstp(x,0,1,10), type="l", col="blue")
legend(1, 0.9, expression(paste(mu==0, ", ", tau==1, ", ", nu==0.5),
     paste(mu==0, ", ", tau==1, ", ", nu==1),
     paste(mu==0, ", ", tau==1, ", ", nu==10)),
     lty=c(1,1,1), col=c("red","green","blue"))
# }

Run the code above in your browser using DataLab