<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Noncentral Student's t Random Variable (Maxima 5.47.0 Manual)</title>

<meta name="description" content="Noncentral Student's t Random Variable (Maxima 5.47.0 Manual)">
<meta name="keywords" content="Noncentral Student's t Random Variable (Maxima 5.47.0 Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="maxima_toc.html" rel="start" title="Top">
<link href="maxima_423.html" 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" rel="up" title="Functions and Variables for continuous distributions">
<link href="maxima_224.html" rel="next" title="Chi-squared Random Variable">
<link href="maxima_222.html" rel="prev" title="Student's t Random Variable">
<style type="text/css">
<!--
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {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}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
span:hover a.copiable-anchor {visibility: visible}
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 type='text/javascript'>
MathJax = {
  options: {
    skipHtmlTags: {'[-]': ['pre']},
    ignoreHtmlClass: 'tex2jax_ignore',
    processHtmlClass: 'tex2jax_process'
  },
};
</script><script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>
</head>

<body lang="en" class="tex2jax_ignore">
<div class="subsection" id="Noncentral-Student_0027s-t-Random-Variable">
<div class="header">
<p>
Next: <a href="maxima_224.html" accesskey="n" rel="next">Chi-squared Random Variable</a>, Previous: <a href="maxima_222.html" accesskey="p" rel="prev">Student&rsquo;s t Random Variable</a>, Up: <a href="maxima_220.html" 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" title="Index" rel="index">Index</a>]</p>
</div>
<span id="Noncentral-Student_0027s-t-Random-Variable-1"></span><h4 class="subsection">52.2.3 Noncentral Student&rsquo;s t Random Variable</h4>

<p>Let <em class='tex2jax_process'>\(ncp\)</em> be the non-centrality parameter, <em class='tex2jax_process'>\(n\)</em> be the
degrees of freedom for the non-central Student&rsquo;s <em class='tex2jax_process'>\(t\)</em> random
variable.
</p>
<p>Then let <em class='tex2jax_process'>\(X\)</em> be a 
\({\it Normal}(n, ncp)\)
 and <em class='tex2jax_process'>\(S^2\)</em> be an independent 
\(\chi^2\)
 random variable with <em class='tex2jax_process'>\(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 class='tex2jax_process'>\(t\)</em> distribution with non-centrality
parameter <em class='tex2jax_process'>\(ncp\)</em>.
</p>
<span id="pdf_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fpdf_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-pdf_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>pdf_noncentral_student_t</strong> <em>(<var>x</var>,<var>n</var>,<var>ncp</var>)</em><a href='#index-pdf_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></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 class='tex2jax_process'>\(n&gt;0\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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 class='tex2jax_process'>\(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>


<span id="cdf_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fcdf_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-cdf_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>cdf_noncentral_student_t</strong> <em>(<var>x</var>,<var>n</var>,<var>ncp</var>)</em><a href='#index-cdf_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></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 class='tex2jax_process'>\(n&gt;0\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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>


<span id="quantile_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fquantile_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-quantile_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>quantile_noncentral_student_t</strong> <em>(<var>q</var>,<var>n</var>,<var>ncp</var>)</em><a href='#index-quantile_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>Returns the <var>q</var>-quantile of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\)
, with <em class='tex2jax_process'>\(n&gt;0\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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 class='tex2jax_process'>\([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>


<span id="mean_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fmean_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-mean_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>mean_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em><a href='#index-mean_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>Returns the mean of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\)
, with <em class='tex2jax_process'>\(n&gt;1\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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 class='tex2jax_process'>\(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>


<span id="var_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fvar_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-var_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>var_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em><a href='#index-var_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>Returns the variance of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\)
, with <em class='tex2jax_process'>\(n&gt;2\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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 class='tex2jax_process'>\(ncp\)</em>.
</p>
<div class=categorybox>
Categories:
<a href="maxima_424.html#Category_003a-Package-distrib">Package distrib</a>
&middot;
</div>

</dd></dl>


<span id="std_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002fstd_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-std_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><strong>std_noncentral_student_t</strong> <em>(<var>n</var>,<var>ncp</var>)</em><a href='#index-std_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>Returns the standard deviation of a noncentral Student random variable 
\({\it nc\_t}(n, ncp)\)
, with <em class='tex2jax_process'>\(n&gt;2\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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>


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


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


<span id="random_005fnoncentral_005fstudent_005ft"></span><span id="Item_003a-distrib_002fdeffn_002frandom_005fnoncentral_005fstudent_005ft"></span><dl class="def">
<dt id="index-random_005fnoncentral_005fstudent_005ft"><span class="category">Function: </span><span><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><a href='#index-random_005fnoncentral_005fstudent_005ft' class='copiable-anchor'> &para;</a></span></dt>
<dd>
<p>Returns a noncentral Student random variate 
\({\it nc\_t}(n, ncp)\)
, with <em class='tex2jax_process'>\(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 class='tex2jax_process'>\(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 class='tex2jax_process'>\(n\)</em> degrees of freedom and noncentrality parameter <em class='tex2jax_process'>\(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>


<span id="Item_003a-distrib_002fnode_002fChi_002dsquared-Random-Variable"></span></div>
<hr>
<div class="header">
<p>
Next: <a href="maxima_224.html" accesskey="n" rel="next">Chi-squared Random Variable</a>, Previous: <a href="maxima_222.html" accesskey="p" rel="prev">Student&rsquo;s t Random Variable</a>, Up: <a href="maxima_220.html" 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" title="Index" rel="index">Index</a>]</p>
</div>


<a href='js_licenses.html' rel='jslicense'><small>JavaScript license information</small></a>
</body>
</html>
