8
$\begingroup$

The variance of a Student's t random variable when the degrees of freedom $\nu$ is greater than $2$ is $\nu/(\nu-2)$. In R, when I try to estimate the variance using the usual estimator $$1/(n-1)\sum_{i=1}^n (x_i-\overline{x})^2$$, the estimates seem biased, when $\nu$ is close-ish to 2, like $\nu=2.2$. Here is my code and the output:

nu <- 2.2
sim <- sapply(round(seq(1e6, 5e6, len=10)), 
        function(n)replicate(10, var(rt(n, 
          nu)) - nu/(nu-2)))
matplot(t(sim), pch=1, col=1)
abline(h=0)

Enter image description here

The estimated variance looks too small compared to the true variance. Is this

  1. my sample sizes (up to 5 million) are still too small for the consistency to show for degrees of freedom this close to 2,

  2. the sample variance estimator actually isn't consistent for these values of $\nu$,

  3. something else?

$\endgroup$
5
  • 8
    $\begingroup$ They're not biased: they are just hugely uncertain. Indeed, the variance of the variance estimator is infinite when $\nu\le 4$! You need a better estimator. Consider a robust one based on order statistics. $\endgroup$
    – whuber
    Commented Apr 10, 2022 at 19:50
  • 2
    $\begingroup$ @whuber I see it now...Because the variance of the variance should be based on the $E(X^4)$? $\endgroup$
    – sayda
    Commented Apr 10, 2022 at 20:04
  • $\begingroup$ What confuses me is that variance estimates don't look too variable. They look like they are converged to something...just not the right value. $\endgroup$
    – sayda
    Commented Apr 10, 2022 at 20:15
  • 3
    $\begingroup$ How many repetitions did you do at each sample sizes, ten? How does it look when you do a thousand? $\endgroup$
    – Dave
    Commented Apr 10, 2022 at 20:18
  • $\begingroup$ This must be the same phenomenon as exemplified with a Pareto distribution at stats.stackexchange.com/questions/94402/… $\endgroup$ Commented Apr 14, 2022 at 14:51

3 Answers 3

11
$\begingroup$

As @whuber observes, the "usual" standard deviation estimate is highly variable when the underlying data is distributed $t$ with degrees of freedom just above 2.

Consider the following experiment. We generate 100,000 samples from a $t(2.2)$ distribution, and calculate the sample standard deviation over successive sample sizes in steps of 10, e.g., x[1:10], x[1:20], ... x[1:100000]. We plot the results, which show the instability quite clearly:

df <- 2.2
x <- rt(100000, df)

sd_est <- rep(0, 10000)
for (i in seq_along(sd_est)) {
  sd_est[i] <- sd(x[1:(10*i)])
}

plot(sd_est ~ seq(1, length(x), 
       length.out=length(sd_est)),
     xlab = "Sample size", 
     ylab = "Std. deviation estimate")
abline(h=sqrt(df/(df-2)))  
# The true standard deviation

And the plot, with a horizontal line at the true value:

enter image description here

Even when we think we have a stable result, e.g., with sample sizes of 50,000, we can experience a big jump in our estimate with just one observation:

max(x)
[1] 712.4925
which.max(x)
[1] 55119 

And of course at no point in the trace are we particularly near the true value.

The solution is, as @whuber observes, to use a robust estimator. Note that estimating the parameters of the distribution using maximum likelihood, then calculating an estimate of the std. deviation from the estimated parameters, may also not be a good idea: see this answer to Fitting t-distribution in R: scaling parameter

$\endgroup$
3
  • $\begingroup$ What would be a good robust estimator of the standard deviation in this case? $\endgroup$ Commented Apr 11, 2022 at 9:46
  • 1
    $\begingroup$ A suitable multiple of the IQR would be good if you know the df. If you don't know the DF, then you will need a robust estimator of it and proceed from there. There are many more sophisticated approaches available, too, but using an IQR (or any inter-percentile range) would be exceptionally simple and likely work pretty well. $\endgroup$
    – whuber
    Commented Apr 11, 2022 at 11:47
  • $\begingroup$ If you know that the distribution follows some parametric form, for instance that it must be a t-distribution, then you can use this to estimate parameters and the variance. However, if the distribution is just heavy-tailed and if you do not necessarily know which type of distribution the data is sampled from, then those robust estimators will not help a lot. $\endgroup$ Commented Apr 11, 2022 at 16:44
2
$\begingroup$

Your example would be a good application of a new estimator for heavy-tailed distributions. I call the method Independent Approximates (IAs), since it utilizes a subsample of n-tuples that are approximately equal.

The method can be applied to estimate the location $\mu$, scale $\sigma$, and degree of freedom $\nu$. Since you are estimating the variance, I'll assume the scale is your primary interest.

To estimate the scale, assuming the location is known, one can use the triplet IAs. The triplet IAs are selected by partitioning the original samples into triplets and subselecting those triplets that are approximately equal, and retaining the median sample. The referenced paper provides further details. The triplet-IAs which are guaranteed to have a finite second moment for all $\nu$, and if $\nu > 2$ the variance of the second moment will be finite. For your example with $\nu=2.2$, the median triplet IA samples will have $\nu_{triplet} = 8.6$.

The estimate of the second moment of the triplets, $\mu_{triplet}^2$ can be used to estimate the scale of the original distribution using the following function $\mu = \sqrt{3 \mu_{triplet}^2}$.

See my paper Independent Approximates enable closed-form estimation of heavy-tailed distributions for further details and examples.

$\endgroup$
1
  • 8
    $\begingroup$ Thank you for contributing your expertise to this answer. Please note that you must disclose that you are the author of the materials that you are citing. One way to do so would be to write "See my paper for further details and examples." $\endgroup$
    – Sycorax
    Commented Apr 11, 2022 at 0:06
1
$\begingroup$

The distribution has a few large values. You don't see them when you plot only a hundred as in your example.

The example below shows more clearly that you get a mode that is unequal to zero but you do not necessarily have a mean unequal to zero.

set.seed(1)
nu <- 2.2
sim <- sapply(round(seq(1e4, 1e4, 
        len=10000)), function(n) 
         replicate(10, var(rt(n, nu)) - 
          nu/(nu-2)))

matplot(t(sim),pch=21,col=1, bg = 1, 
  cex = 0.5)
abline(h=0)

hist(sim, breaks = seq(min(sim-1), 
     max(sim+1), 0.25), xlim = c(-7,30))

mean(sim)
### the mean of this sample will equal 
### 2.297499, which is *above* zero

plot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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