<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Maxima 5.47.0 Manual: Noncentral Student's t Random Variable</title>

<meta name="description" content="Maxima 5.47.0 Manual: Noncentral Student's t Random Variable">
<meta name="keywords" content="Maxima 5.47.0 Manual: Noncentral Student's t Random Variable">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="maxima_toc.html#Top" rel="start" title="Top">
<link href="maxima_423.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
<link href="maxima_toc.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="maxima_220.html#Functions-and-Variables-for-continuous-distributions" rel="up" title="Functions and Variables for continuous distributions">
<link href="maxima_224.html#Chi_002dsquared-Random-Variable" rel="next" title="Chi-squared Random Variable">
<link href="maxima_222.html#Student_0027s-t-Random-Variable" rel="previous" title="Student's t Random Variable">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
body {color: black; background: white;  margin-left: 8%; margin-right: 13%;
      font-family: "FreeSans", sans-serif}
h1 {font-size: 150%; font-family: "FreeSans", sans-serif}
h2 {font-size: 125%; font-family: "FreeSans", sans-serif}
h3 {font-size: 100%; font-family: "FreeSans", sans-serif}
a[href] {color: rgb(0,0,255); text-decoration: none;}
a[href]:hover {background: rgb(220,220,220);}
div.textbox {border: solid; border-width: thin; padding-top: 1em;
    padding-bottom: 1em; padding-left: 2em; padding-right: 2em}
div.titlebox {border: none; padding-top: 1em; padding-bottom: 1em;
    padding-left: 2em; padding-right: 2em; background: rgb(200,255,255);
    font-family: sans-serif}
div.synopsisbox {
    border: none; padding-top: 1em; padding-bottom: 1em; padding-left: 2em;
    padding-right: 2em; background: rgb(255,220,255);}
pre.example {border: 1px solid rgb(180,180,180); padding-top: 1em;
    padding-bottom: 1em; padding-left: 1em; padding-right: 1em;
    background-color: rgb(238,238,255)}
div.spacerbox {border: none; padding-top: 2em; padding-bottom: 2em}
div.image {margin: 0; padding: 1em; text-align: center}
div.categorybox {border: 1px solid gray; padding-top: 1em; padding-bottom: 1em;
    padding-left: 1em; padding-right: 1em; background: rgb(247,242,220)}
img {max-width:80%; max-height: 80%; display: block; margin-left: auto; margin-right: auto}

-->
</style>

<link rel="icon" href="figures/favicon.ico">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6>"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Noncentral-Student_0027s-t-Random-Variable"></a>
<div class="header">
<p>
Next: <a href="maxima_224.html#Chi_002dsquared-Random-Variable" accesskey="n" rel="next">Chi-squared Random Variable</a>, Previous: <a href="maxima_222.html#Student_0027s-t-Random-Variable" accesskey="p" rel="previous">Student's t Random Variable</a>, Up: <a href="maxima_220.html#Functions-and-Variables-for-continuous-distributions" accesskey="u" rel="up">Functions and Variables for continuous distributions</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Noncentral-Student_0027s-t-Random-Variable-1"></a>
<h4 class="subsection">52.2.3 Noncentral Student&rsquo;s t Random Variable</h4>

<p>Let <em>ncp</em> be the non-centrality parameter, <em>n</em> be the
degrees of freedom for the non-central Student&rsquo;s <em>t</em> random
variable.
</p>
<p>Then let <em>X</em> be a 
\({\it Normal}(n, ncp)\) and <em>S^2</em> be an independent 
\(\chi^2\) random variable with <em>n</em> degrees of freedom, the
random variable
$$
U = {X \over \sqrt{S^2\over n}}
$$</p>

<p>has a non-central Student&rsquo;s <em>t</em> distribution with non-centrality
parameter <em>ncp</em>.
</p>
<a name="pdf_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fpdf_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-pdf_005fnoncentral_005fstudent_005ft"></a>Function: <strong>pdf_noncentral_student_t</strong> <em>(<var>x</var>,<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the value at <var>x</var> of the density function of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;0</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>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]
$$</p>
<p>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)
}
$$</p>
<p>and 
\(\mu\) is the non-centrality parameter <em>ncp</em>.
</p>
<p>Sometimes an extra work is necessary to get the final result.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;distrib&quot;)$
</pre><pre class="example">(%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
</pre><pre class="example">(%i3) float(%);
(%o3)                  0.02080593159405671
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="cdf_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fcdf_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-cdf_005fnoncentral_005fstudent_005ft"></a>Function: <strong>cdf_noncentral_student_t</strong> <em>(<var>x</var>,<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the value at <var>x</var> of the distribution function of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;0</em> degrees of freedom and noncentrality parameter <em>ncp</em>. This function has no closed form and it is numerically computed.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;distrib&quot;)$
</pre><pre class="example">(%i2) cdf_noncentral_student_t(-2,5,-5);
(%o2)                   0.995203009331975
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="quantile_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fquantile_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-quantile_005fnoncentral_005fstudent_005ft"></a>Function: <strong>quantile_noncentral_student_t</strong> <em>(<var>q</var>,<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the <var>q</var>-quantile of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;0</em> degrees of freedom and noncentrality parameter <em>ncp</em>; in other words, this is the inverse of <code>cdf_noncentral_student_t</code>. Argument <var>q</var> must be an element of <em>[0,1]</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="mean_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fmean_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-mean_005fnoncentral_005fstudent_005ft"></a>Function: <strong>mean_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the mean of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;1</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>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)}
$$</p>

<p>where 
\(\mu\) is the noncentrality parameter <em>ncp</em>.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;distrib&quot;)$
</pre><pre class="example">(%i2) mean_noncentral_student_t(df,k);
                          df - 1
                    gamma(------) sqrt(df) k
                            2
(%o2)               ------------------------
                                     df
                       sqrt(2) gamma(--)
                                     2
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="var_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fvar_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-var_005fnoncentral_005fstudent_005ft"></a>Function: <strong>var_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the variance of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;2</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>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}
$$</p>

<p>where 
\(\mu\) is the noncentrality parameter <em>ncp</em>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="std_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fstd_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-std_005fnoncentral_005fstudent_005ft"></a>Function: <strong>std_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the standard deviation of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;2</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>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}}
$$</p>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="skewness_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fskewness_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-skewness_005fnoncentral_005fstudent_005ft"></a>Function: <strong>skewness_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the skewness coefficient of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;3</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>If <em>U</em> is a non-central Student&rsquo;s <em>t</em> random variable with
<em>n</em> 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}}
}

$$</p>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="kurtosis_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002fkurtosis_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-kurtosis_005fnoncentral_005fstudent_005ft"></a>Function: <strong>kurtosis_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em></dt>
<dd><p>Returns the kurtosis coefficient of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;4</em> degrees of freedom and noncentrality parameter <em>ncp</em>. To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<p>If <em>U</em> is a non-central Student&rsquo;s <em>t</em> random variable with
<em>n</em> degrees of freedom and a noncentrality parameter 
\(\mu\), the kurtosis is
</p>
$$
\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}
}
$$

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;</div>
</dd></dl>


<a name="random_005fnoncentral_005fstudent_005ft"></a><a name="Item_003a-distrib_002fdeffn_002frandom_005fnoncentral_005fstudent_005ft"></a><dl>
<dt><a name="index-random_005fnoncentral_005fstudent_005ft"></a>Function: <strong>random_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>random_noncentral_student_t</tt> (<var>n</var>,<var>ncp</var>,<var>m</var>)</em></dt>
<dd>
<p>Returns a noncentral Student random variate 
\({\it nc\_t}(n, ncp)\), with <em>n&gt;0</em>. Calling <code>random_noncentral_student_t</code> with a third argument <var>m</var>, a random sample of size <var>m</var> will be simulated.
</p>
<p>The implemented algorithm is based on the fact that if <var>X</var> is a
normal random variable 
\({\it Normal}(ncp, 1)\) and <em>S^2</em> is
a 
\(\chi^2\) random variable with <var>n</var> degrees of freedom, 
\(\chi^2(n)\), then
$$
U={{X}\over{\sqrt{{S^2}\over{n}}}}
$$</p>
<p>is a noncentral Student random variable with <em>n</em> degrees of freedom and noncentrality parameter <em>ncp</em>, 
\({\it nc\_t}(n, ncp)\).
</p>
<p>To make use of this function, write first <code>load(&quot;distrib&quot;)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;<a href="maxima_424.html#Category_003a-Random-numbers">Random numbers</a>
&middot;</div>
</dd></dl>


<a name="Item_003a-distrib_002fnode_002fChi_002dsquared-Random-Variable"></a><hr>
<div class="header">
<p>
Next: <a href="maxima_224.html#Chi_002dsquared-Random-Variable" accesskey="n" rel="next">Chi-squared Random Variable</a>, Previous: <a href="maxima_222.html#Student_0027s-t-Random-Variable" accesskey="p" rel="previous">Student's t Random Variable</a>, Up: <a href="maxima_220.html#Functions-and-Variables-for-continuous-distributions" accesskey="u" rel="up">Functions and Variables for continuous distributions</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
