<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Statistics on Randy Lai</title>
    <link>https://randylai.info/tags/statistics/</link>
    <description>Recent content in Statistics on Randy Lai</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 21 Oct 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://randylai.info/tags/statistics/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>MSE of sample standard deviation (Lean by AI)</title>
      <link>https://randylai.info/post/2026/mse_of_sample_sd_lean/</link>
      <pubDate>Wed, 21 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2026/mse_of_sample_sd_lean/</guid>
      <description>&lt;p&gt;Back in 2023, I wrote a &lt;a href=&#34;https://randylai.info/post/2023/mse_of_sample_sd_cont/&#34;&gt;post&lt;/a&gt; using SymPy to compute the second order expansion of the mean squared error (MSE) of the sample standard deviation up to $O(n^{-2})$. Earlier this year, I revisited the problem in &lt;a href=&#34;https://randylai.info/post/2026/mse_of_sample_sd_gen_ai/&#34;&gt;MSE of sample standard deviation (Gen AI)&lt;/a&gt; and showed that a modern LLM can derive the entire second order expansion directly from a prompt.&lt;/p&gt;
&lt;p&gt;When an AI produces a long asymptotic derivation with dozens of polynomial moment terms, how can we trust that every coefficient is right and that no terms of order $n^{-2}$ were dropped? To check the derivation rigorously, I formalized and verified the entire proof in &lt;a href=&#34;https://lean-lang.org/&#34;&gt;Lean 4&lt;/a&gt; with &lt;a href=&#34;https://github.com/leanprover-community/mathlib4&#34;&gt;Mathlib&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MSE of sample standard deviation (Gen AI)</title>
      <link>https://randylai.info/post/2026/mse_of_sample_sd_gen_ai/</link>
      <pubDate>Tue, 20 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2026/mse_of_sample_sd_gen_ai/</guid>
      <description>&lt;p&gt;In the era of gen AI, I am trying to use LLM to compute the second order expansion of &lt;a href=&#34;https://randylai.info/post/2023/mse_of_sample_sd_cont/&#34;&gt;$MSE(S)$&lt;/a&gt; that I did in 2023.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The standard sample s.d. is given by  S=sqrt(\sum_{i=1}^n(x_i - \bar x)^2/ (n-1)). Without assumption the underlying distribution, compute the MSE(S) of it in terms of the first few moments of x_i up. Expand the terms up to 1/n^2.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And it just nails it: &lt;a href=&#34;https://gemini.google.com/share/fa35ab43436f&#34;&gt;https://gemini.google.com/share/fa35ab43436f&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>MSE of sample standard deviation (cont&#39;)</title>
      <link>https://randylai.info/post/2023/mse_of_sample_sd_cont/</link>
      <pubDate>Thu, 20 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2023/mse_of_sample_sd_cont/</guid>
      <description>&lt;p&gt;Continue our &lt;a href=&#34;https://randylai.info/post/2023/mse_of_sample_sd/&#34;&gt;previous&lt;/a&gt; post of computing the MSE of sample standard deviation. We want to have higher order expansion of $E(S_n)$. The algebric computation is a bit tedious, we will use &lt;a href=&#34;https://www.sympy.org/&#34;&gt;sympy&lt;/a&gt; to help us.&lt;/p&gt;
&lt;p&gt;&lt;font style=&#34;font-size: small&#34;&gt;&lt;a href=&#34;https://randylai.info/post/2023/sample_sd_bias.html&#34; target=&#34;_blank&#34;&gt;Open notebook in full screen.&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
 &lt;iframe
       src=&#34;https://randylai.info/post/2023/sample_sd_bias.html&#34;
       width=&#34;100%&#34;
       height=&#34;1000px&#34;
       style=&#34;border:none;&#34;&gt;
 &lt;/iframe&gt;
&lt;p&gt;The result is quite interesting. For normal distribution, the MSE of $S_n$ and $\hat \sigma$ are the same up to the order $1/n^2$.
If the distribution has a thicker tail than normal, i.e. kurtosis &amp;gt; 3, then $\hat \sigma_n$ will have a smaller MSE than $S_n$. On the other hand, if the distribution has a lighter tail than normal, than $S_n$ will have a smaller MSE.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MSE of sample standard deviation</title>
      <link>https://randylai.info/post/2023/mse_of_sample_sd/</link>
      <pubDate>Wed, 19 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2023/mse_of_sample_sd/</guid>
      <description>&lt;p&gt;In a &lt;a href=&#34;https://randylai.info/post/2020/mse_of_sample_variance/&#34;&gt;previous&lt;/a&gt; post, we have discussed the MSE of sample variance. One could argue that we should compute the MSE of the sample standard deviation as sample s.d. has the same unit as the measurements.&lt;/p&gt;
&lt;p&gt;Let $S_n$ be the sample s.d. and $\sigma$ be the true s.d., the goal is to compute&lt;/p&gt;
$$
MSE(S_n) = E(S_n-\sigma)^2 = E(S_n^2) - 2 \sigma E(S_n) + \sigma^2 = 2 \sigma^2 -  2 \sigma E(S_n).
$$&lt;p&gt;To compute $E(S_n)$, first, we consider Taylor&amp;rsquo;s expanding $g(x) = \sqrt{x}$ about $x=\sigma^2$,
we have
&lt;/p&gt;</description>
    </item>
    <item>
      <title>MSE of sample variance</title>
      <link>https://randylai.info/post/2020/mse_of_sample_variance/</link>
      <pubDate>Sat, 01 Aug 2020 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2020/mse_of_sample_variance/</guid>
      <description>&lt;p&gt;In introductory statistics courses, we often focus on unbiased estimators such as the sample variance,
&lt;/p&gt;
$$
S^2 = \frac{\sum(X_i - \bar X)^2}{n - 1}
$$&lt;p&gt;
rather than a more initiative estimator
&lt;/p&gt;
$$
\hat \sigma^2 = \frac{\sum(X_i - \bar X)^2}{n}.
$$&lt;p&gt;The common argument is that $S^2$ is unbiased whereas $\hat \sigma^2$ is biased for estimating $\sigma^2$. While it is true, this statement is a bit over-stressed. A more statistical way to evaluate performance of estimators is to compare the mean squared error (MSE) of the estimators.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Variance of sample mean squared</title>
      <link>https://randylai.info/post/2020/variance_of_x_bar_squared/</link>
      <pubDate>Sat, 01 Aug 2020 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2020/variance_of_x_bar_squared/</guid>
      <description>&lt;p&gt;It is well known that $\bar X^2$ is a biased estimator for $\mu^2$, but how about its variance?&lt;/p&gt;
&lt;p&gt;Before we start working on $Var(\bar X^2)$, let&amp;rsquo;s recall that $\bar X$ is an unbiased estimator for $\mu$, i.e. $E(\bar X) = \mu$. Moreover, $Var(\bar X) = \sigma^2/n$ and $E(\bar X^2) = Var(\bar X) + E(\bar X)^2 = \frac{\sigma^2}{n} + \mu^2$.&lt;/p&gt;
&lt;p&gt;Let $Z_i = X_i - \mu$,&lt;/p&gt;
$$
\begin{align*}
E\left[(\sum X_i)^4\right] &amp;amp;= E\left[(n \mu + \sum Z_i)^4\right]\\
&amp;amp;= E\left[[n^4 \mu^4 + 4 n^3 \mu^3 \sum Z_i+ 6 n^2 \mu^2 (\sum Z_i)^2 + 4 n \mu (\sum Z_i)^3  + (\sum Z_i)^4 \right].
\end{align*}
$$&lt;p&gt;By the fact that,&lt;/p&gt;</description>
    </item>
    <item>
      <title>Girl ratio</title>
      <link>https://randylai.info/post/2017/girl-ratio/</link>
      <pubDate>Sun, 10 Sep 2017 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2017/girl-ratio/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://stats.stackexchange.com/questions/93830/expected-number-of-ratio-of-girls-vs-boys-birth&#34;&gt;https://stats.stackexchange.com/questions/93830/expected-number-of-ratio-of-girls-vs-boys-birth&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Zorganian Republic has some very strange customs. Couples only wish to have female children as only females can inherit the family&amp;rsquo;s wealth, so if they have a male child they keep having more children until they have a girl. If they have a girl, they stop having children. What is the ratio of girls to boys in Zorgania?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Let $X$ be the number of children in a family, it is geometric random variable with $p=0.5$, i.e.,
&lt;/p&gt;</description>
    </item>
    <item>
      <title>Two cool things about dice!</title>
      <link>https://randylai.info/post/2016/dice/</link>
      <pubDate>Thu, 14 Apr 2016 00:00:00 +0000</pubDate>
      <guid>https://randylai.info/post/2016/dice/</guid>
      <description>&lt;p&gt;Just discover two cool things about dice,
Suppose we have two (fair) 6-sided dice, let $Y$ be the reminder of the product of the two numbers divided by 7, i.e., $Y = X1 \times X2 (\text{ mod } 7)$, guess what the distribution of $Y$ is? Uniform 1,&amp;hellip;, 6&lt;/p&gt;
&lt;p&gt;If it doesn&amp;rsquo;t surprise you, now consider two n-sided dice and repeat the above with $Y = X_1 \times X_2 (\text{ mod } n+1)$. Guess what values of $n$ will yield a uniform distribution? It turns out that the values of $n$ are prime numbers minus 1. (As 6 = 7-1 and 7 is a prime number, a regular 6-sided dice has this property).&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
