Next: Chi-squared Random Variable, Previous: Student's t Random Variable, Up: Functions and Variables for continuous distributions [Contents][Index]
Let ncp be the non-centrality parameter, n be the degrees of freedom for the non-central Student’s t random variable.
Then let X be a \({\it Normal}(n, ncp)\) and S^2 be an independent \(\chi^2\) random variable with n degrees of freedom, the random variable $$ U = {X \over \sqrt{S^2\over n}} $$
has a non-central Student’s t distribution with non-centrality parameter ncp.
Returns the value at x of the density function of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>0 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
The pdf is $$ f(x; n, \mu) = \left[\sqrt{n} B\left({1\over 2}, {n\over 2}\right)\right]^{-1}\left(1+{x^2\over n}\right)^{-{(n+1)/2}} e^{-\mu^2/ 2} \bigg[A_n(x; \mu) + B_n(x; \mu)\bigg] $$
where $$ \eqalign{ A_n(x;\mu) &= {}_1F_1\left({n+1\over 2}; {1\over 2}; {\mu^2 x^2\over 2\left(x^2+n\right)}\right) \cr B_n(x;\mu) &= {\sqrt{2}\mu x \over \sqrt{x^2+n}} {\Gamma\left({n\over 2} + 1\right)\over \Gamma\left({n+1\over 2}\right)}\; {}_1F_1\left({n\over 2} + 1; {3\over 2}; {\mu^2 x^2\over 2\left(x^2+n\right)}\right) } $$
and \(\mu\) is the non-centrality parameter ncp.
Sometimes an extra work is necessary to get the final result.
(%i1) load ("distrib")$
(%i2) expand(pdf_noncentral_student_t(3,5,0.1)); rat: replaced 0.01889822365046136 by 15934951/843198350 = 0.01889822365046136 rat: replaced -8.734356480209641 by -294697965/33740089 = -8.734356480209641 rat: replaced 4.136255165816327 by 51033443/12338079 = 4.136255165816332 rat: replaced 1.08061432164203 by 56754827/52520891 = 1.08061432164203 rat: replaced 0.0565127306411839 by 5608717/99246965 = 0.05651273064118384 rat: replaced -300.8069396896258 by -79782423/265228 = -300.8069396896256 rat: replaced 160.6269176184973 by 178374907/1110492 = 160.626917618497 7/2 7/2 0.04296414417400905 5 1.323650307289301e-6 5 (%o2) ------------------------ + ------------------------- 3/2 5/2 sqrt(%pi) 2 14 sqrt(%pi) 7/2 1.94793720435093e-4 5 + ------------------------ %pi
(%i3) float(%); (%o3) 0.02080593159405671
Returns the value at x of the distribution function of a noncentral Student random variable \({\it nc\_t}(n, ncp)\), with n>0 degrees of freedom and noncentrality parameter ncp. This function has no closed form and it is numerically computed.
(%i1) load ("distrib")$
(%i2) cdf_noncentral_student_t(-2,5,-5); (%o2) 0.995203009331975
Returns the q-quantile of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>0 degrees of freedom and noncentrality parameter ncp; in other words, this is the inverse of cdf_noncentral_student_t
. Argument q must be an element of [0,1]. To make use of this function, write first load("distrib")
.
Returns the mean of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>1 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
The mean is $$ E[X] = {\mu \sqrt{n}\; \Gamma\left(\displaystyle{n-1\over 2}\right) \over \sqrt{2}\;\Gamma\left(\displaystyle{n\over 2}\right)} $$
where \(\mu\) is the noncentrality parameter ncp.
(%i1) load ("distrib")$
(%i2) mean_noncentral_student_t(df,k); df - 1 gamma(------) sqrt(df) k 2 (%o2) ------------------------ df sqrt(2) gamma(--) 2
Returns the variance of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>2 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
The variance is $$ V[X] = {n(\mu^2+1)\over n-2} - {n\mu^2\; \Gamma\left(\displaystyle{n-1\over 2}\right)^2 \over 2\Gamma\left(\displaystyle{n\over 2}\right)^2} $$
where \(\mu\) is the noncentrality parameter ncp.
Returns the standard deviation of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>2 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
The standard deviation is $$ D[X] = \sqrt{{n(\mu^2+1)\over n-2} - {n\mu^2\; \Gamma\left(\displaystyle{n-1\over 2}\right)^2 \over 2\Gamma\left(\displaystyle{n\over 2}\right)^2}} $$
Returns the skewness coefficient of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>3 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
If U is a non-central Student’s t random variable with n degrees of freedom and a noncentrality parameter \(\mu\), the skewness is $$ \eqalign{ SK[U] &= {\mu\sqrt{n}\,\Gamma\left({{n-1}\over{2}}\right) \over{\sqrt{2}\Gamma\left({{n }\over{2}}\right)\sigma^{3}}}\left({{n \left(2n+\mu^2-3\right)}\over{\left(n-3\right)\left(n-2\right)}} -2\sigma^2\right) \cr \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2\, \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n }\over{2}}\right)^2}} } $$
Returns the kurtosis coefficient of a noncentral Student random variable
\({\it nc\_t}(n, ncp)\), with n>4 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first load("distrib")
.
If U is a non-central Student’s t random variable with n degrees of freedom and a noncentrality parameter \(\mu\), the kurtosis is
$$ \eqalign{ KU[U] &= {\mu_4\over \sigma^4} - 3\cr \mu_4 &= {{\left(\mu^4+6\mu^2+3\right)n^2}\over{(n-4)(n-2)}} -\left({{n\left(3(3n-5)+\mu^2(n+1)\right) }\over{(n-3)(n-2)}}-3\sigma^2\right) F \cr \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2 \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n }\over{2}}\right)^2}} \cr F &= {n\mu^2\Gamma\left({n-1\over 2}\right)^2 \over 2\sigma^4\Gamma\left({n\over 2}\right)^2} } $$Returns a noncentral Student random variate
\({\it nc\_t}(n, ncp)\), with n>0. Calling random_noncentral_student_t
with a third argument m, a random sample of size m will be simulated.
The implemented algorithm is based on the fact that if X is a normal random variable \({\it Normal}(ncp, 1)\) and S^2 is a \(\chi^2\) random variable with n degrees of freedom, \(\chi^2(n)\), then $$ U={{X}\over{\sqrt{{S^2}\over{n}}}} $$
is a noncentral Student random variable with n degrees of freedom and noncentrality parameter ncp, \({\it nc\_t}(n, ncp)\).
To make use of this function, write first load("distrib")
.