2
$\begingroup$

I performed random sampling on a Student's $t$-distribution. I used SciPy to calibrate my parameters and then truncated my allowable values to the maximum and minimum observation in the data for various reasons. One of which is that it allows me to have a defined variance as long as $\mathrm{df} > 1$. Assume my truncation is symmetrical. What is the formula for the variance of my truncated Student's $t$-distribution?

$\endgroup$
  • $\begingroup$ Do you want the actual variance or do you want the variance conditional on the observed max and min? $\endgroup$ – whuber Jan 16 at 17:48
  • 1
    $\begingroup$ Just the variance of my truncated student t distribution. So basically, I'm assuming my truncated distribution is the unconditional distribution of my RV. $\endgroup$ – Mild_Thornberry Jan 16 at 18:59
  • 1
    $\begingroup$ You will need to compute definite integrals of $t^k\left(1 + t^2/\nu\right)^{-(\nu+1)/2}\,\mathrm{d}t$ for $\nu \gt 0$ and $k\in\{0,1,2\}.$ They can be reduced to (incomplete) Beta functions via the substitution $t = \sqrt{\nu}(u-1/2)/\sqrt{u(1-u)}$ where $0 \lt u \lt 1.$ $\endgroup$ – whuber Jan 16 at 19:37
  • $\begingroup$ I appreciate the hints, but my math isn't strong to derive this kind of complicated formula. I was hoping that there exists an exact solution readily available to someone. I can find other solutions to other truncated distributions online, just not a student t. For sure, I asked the question for my own purposes, but there really should be some kind of public forum that provides the solution to such a common distribution. $\endgroup$ – Mild_Thornberry Jan 16 at 23:03
  • 1
    $\begingroup$ For those who want to understand the answers, rather than just use formulas, I wish to point out that the $k^\text{th}$ moment can be expressed in terms of the $(k-2)^\text{th}$ moment of the distributions with $\nu$ and $\nu-2$ df by studying the integral of $$\eqalign{t^k(1 + t^2)^{-(\nu+1)/2} &= t^{k-2}((1+t^ 2)-1)(1 + t^2)^{-(\nu+1)/2}\\&= t^{k-2}(1 + t^2)^{-(\nu+1)/2}\quad -\quad t^{k-2}(1 + t^2)^{-(\nu-1)/2}.}$$ Successive application reduces the problem to either $k=0$ (obvious) or $k=1,$ where the integral is elementary. $\endgroup$ – whuber Jan 18 at 16:13
1
$\begingroup$

I was able to find an actual formulaic solution to my question in the paper here:

https://www.research.manchester.ac.uk/portal/files/84031132/FULL_TEXT.PDF

$$E[X] = G_\nu(1)(A_\nu^{-\frac{\nu-1}{2}}-B_\nu^{-\frac{\nu-1}{2}})$$

$$E[X^2] = \frac{\nu}{\nu-2}+G_\nu(1)(aA_\nu^{-\frac{\nu-1}{2}}-bB_\nu^{-\frac{\nu-1}{2}})$$

Where:

$a$ is the lower bound

$b$ is the upper bound

$A_\nu = \nu + a^2$

$B_\nu = \nu + b^2$

$$G_\nu(1) = \frac{\Gamma({\frac{\nu-1}{2}})\nu^{\frac{\nu}{2}}}{2[F_\nu(b)-F_\nu(a)]\Gamma(\frac{\nu}{2})\Gamma(\frac{1}{2})}$$

$\endgroup$
  • 1
    $\begingroup$ I'm having trouble validating the formula for $\mathrm{E}(X^{2})$. Using the formulas and an example where $a=-1, b=1, \nu=5$, I'm getting a variance of $0.6317$ when it should be $0.28673$ (according to Mathematica). The formula for $\mathrm{E}(X)$ seems to be correct. Do you have any idea why I'm getting the wrong values? $\endgroup$ – COOLSerdash Jan 18 at 7:48
1
$\begingroup$

The result can be found in the 2012 paper Some results on the truncated multivariate $t$ distribution by Ho et al.

First, let $T(\cdot\,|\,\nu)$ be the cdf of the (untruncated) standard $t$ distribution with $\nu$ degrees of freedom. In the following exposition, $a$ and $b$ are the lower and upper truncation limits, respectively. Before we can give the moments, define the following

$$ \alpha_{0} = T(b\,|\,\nu) - T(a\,|\,\nu) \\ \kappa = \dfrac{\Gamma\left(\frac{\nu + 1}{2}\right)}{\alpha_{0}\Gamma\left(\frac{\nu}{2}\right)(\nu\pi)^{1/2}} \\ \tau_{j} = (\nu - 2j)/\nu $$ where $\Gamma$ denotes the gamma function.

The first two moments of the univariate truncated $t$ distribution are then given by

$$ \mathrm{E}(X) =\frac{\kappa\nu}{\nu - 1}\left[(1 + a^{2}/\nu)^{-(\nu - 1)/2} - (1 + b^{2}/\nu)^{-(\nu - 1)/2}\right] \enspace \text{for}\enspace\nu >1 $$ and $$ \mathrm{E}(X^{2}) =\left(\frac{\nu-1}{\tau_{1}}\right)\left(\frac{T(b\tau_{1}^{1/2}\,|\,\nu - 2) - T(a\tau_{1}^{1/2}\,|\,\nu - 2)}{T(b\,|\,\nu) - T(a\,|\,\nu)}\right) - \nu \enspace \text{for}\enspace\nu >2 $$ The variance is then given by $\mathrm{Var}(X) = \mathrm{E}(X^{2}) - \mathrm{E}(X)^{2}$.

Here is R code implementing these formulas. The plot shows the variance of a truncated $t$ distribution with $\nu = 5$ degrees of freedom with respect to the truncation points where $a = -b$ and $b>0$ (i.e. for symmetric trunction points around the mean of $0$) ranging from $1$ to $15$. As expected, the variance of the truncated $t$ distribution approaches the variance of the untruncated $t$ distribution ($5/3$, shown as a red dashed horizontal line) as $b$ gets larger.

VarianceTruncatedT

kappa <- function(df, a, b) {
  gamma((df + 1)/2)/((pt(b, df = df) - pt(a, df = df))*gamma(df/2)*(df*pi)^(1/2))
}

tau <- function(df, j) {
  (df - 2*j)/df
}

ex <- function(df, a, b) {
  ((kappa(df = df, a = a, b = b)*df)/(df - 1))*((1 + a^2/df)^(-(df - 1)/2) - (1 + b^2/df)^(-(df - 1)/2))
}

ex2 <- function(df, a, b) {
  ((df - 1)/tau(df = df, j = 1))*((pt(b*sqrt(tau(df = df, j = 1)), df = (df - 2)) - pt(a*sqrt(tau(df = df, j = 1)), df = (df - 2)))/(pt(b, df = df) - pt(a, df = df))) - df
}
$\endgroup$
  • 1
    $\begingroup$ +1. Notice that these formulas require $\nu \gt 2.$ They will continue to hold when appropriately modified to extend the Student t pdf to zero and negative degrees of freedom: for nonzero df, it will be proportional to $(1+t^2/|\nu|)^{-(\nu+1)/2}$ (notice the judicious application of an absolute value: that's the key). Special formulas are needed for integral $\nu$ where any of the $\tau_j$ will be zero or negative. $\endgroup$ – whuber Jan 18 at 16:17
  • $\begingroup$ @whuber Very interesting, thanks. I've never heard of negative degrees of freedom in $t$ distributions. In what applications do negative df appear? Or how should one think about negative df? $\endgroup$ – COOLSerdash Jan 18 at 16:23
  • 1
    $\begingroup$ The distributions with negative df cannot be defined over the entire real line because their integrals diverge. However, when the distribution is truncated above and below, as in this thread, the generalization of the pdf I wrote down naturally extends the family of pdfs and is useful precisely for the analysis I outlined. $\endgroup$ – whuber Jan 18 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.