tdistr: Calculate the density of the non-standard Student's...

View source: R/rutils.R

tdistrR Documentation

Calculate the density of the non-standard Student's t-distribution.

Description

Calculate the density of the non-standard Student's t-distribution.

Usage

tdistr(x, dfree = 3, loc = 0, scalev = 1)

Arguments

x

A numeric value for which to calculate the density of the t-distribution.

dfree

An integer value equal to the degrees of freedom (the default is 3).

loc

A numeric value equal to the location (center) of the distribution (the default is 0).

scalev

A numeric value equal to the scale (width) of the distribution (the default is 1).

Details

The function tdistr() calculates the density of the non-standard Student's t-distribution by calling the function gamma(). The density function of the non-standard Student's t-distribution is given by:

f(t) = \frac{\Gamma((\nu+1)/2)}{\sqrt{\pi \nu} \, \sigma \, \Gamma(\nu/2)} \, (1 + (\frac{t - \mu}{\sigma})^2/\nu)^{-(\nu+1)/2}

Where \Gamma() is the gamma function, and \nu are the degrees of freedom.

The non-standard Student's density function has a mean equal to the location parameter \mu, and a standard deviation proportional to the scale parameter \sigma.

Value

A numeric value equal to the density of the non-standard Student's t-distribution.

Examples

## Not run: 
# Student t-distribution at x=1, with df=4, location=-1 and scale=2
tdistr(1, df=4, loc=-1, scalev=2)
# Student t-distribution at x=1, with location=0 and scale=1 - same as dt()
all.equal(tdistr(1, df=3), dt(1, df=3))

## End(Not run)


algoquant/rutils documentation built on June 10, 2025, 3:55 p.m.