\section{Estimator Concentration}\label{appendix:estimator_bias_variance}

\ojaerrordecomposition*
\begin{proof}
    We have, 
    \bas{
        \voja &= (v_{1}^{\top}\voja)v_{1} + \vp\vp^{\top}\voja \\
        &= (v_{1}^{\top}\voja)v_{1} + \frac{\vp\vp^{\top}B_{n}u_{0}}{\norm{B_nu_0}_{2}} \\
        &= (v_{1}^{\top}\voja)v_{1} + \frac{\vp\vp^{\top}B_{n}u_{0}}{c_{n}} + \Ethree{n} \\
        &= (v_{1}^{\top}\voja)v_{1} + \frac{\vp\vp^{\top}B_{n}v_{1}\sign(v_{1}^{\top}u_{0})}{(1+\eta_{n}\lambda_{1})^{n}} + \Ethree{n} + \Efour{n} \\
        &= (v_{1}^{\top}\voja)v_{1} + \frac{\vp\vp^{\top}(B_{n} - \E\bbb{B_n})v_{1}\sign(v_{1}^{\top}u_{0})}{(1+\eta_{n}\lambda_{1})^{n}} + \Ethree{n} + \Efour{n} \\
        &= (v_{1}^{\top}\voja)v_{1} + \frac{\vp\vp^{\top}(\sum_{k\geq1}T_{n,k})v_{1}\sign(v_{1}^{\top}u_{0})}{(1+\eta_{n}\lambda_{1})^{n}} + \Ethree{n} + \Efour{n}, \text{ using Theorem A.1 \cite{lunde2021bootstrapping}} \\
        &= (\vmain^{\top}\voja)\vmain + \Ezero{n} + \Eone{n} + \Etwo{n} + \Ethree{n} + \Efour{n}.
    }
\end{proof}

\begin{lemma}\label{lemma:hajek_decomposition} Let $\Eone{n}$ be as defined in Lemma~\ref{lemma:oja_error_decomposition}. Then, 
\bas{
    \Eone{n} := \eta_{n}Y_{n}, \text{ for } Y_{n} := \sum_{j=1}^{n}X^{n}_{j} \text{ and } X^{n}_{j} := \frac{\sign\bb{v_1^{\top}u_0}}{1+\eta_n\lambda_1}\vp\lambp^{n-j}\vp^{\top}\bb{A_{j}-\Sigma}v_{1}
}
where $\lambp \in \R^{(d-1) \times (d-1)}$ is a diagonal matrix with entries $\lambp(i,i) = \frac{1+\eta_n\lambda_{i+1}}{1+\eta_n\lambda_{1}}$.
\end{lemma}

Let $\left\{A_{i}\right\}_{i \in [n]}$ be symmetric independent matrices satisfying $\E\bbb{A_i} = \Sigma$, $\norm{\E\bbb{\bb{A_i-\Sigma}^{2}}}_{2} \leq \mathcal{V}$ and $\norm{A_i-\Sigma}_{2} \leq \mathcal{M}$. Define, 
\bas{
    \forall j \in [n], \;\; X_{j}^{n} := \vp\lambp^{n-j}\vp^{\top}\bb{A_{j}-\Sigma}v_{1}, \text{ and } Y_{n} := \sum_{j \in [n]}X_{j}^{n}
}

\subsection{Estimator Bias}\label{appendix:estimator_bias}

% \begin{lemma}[Estimator Bias Computation]\label{lemma:second_moment_matrix}
%     For $i \in [n]$,
%     \bas{
%         \E\bbb{Y_{i}Y_{i}^{\top}} &= \vp R\vp^{\top}, \;\; \forall k, l \in [d], \;\; R_{k,l} = \frac{\widetilde{M}_{kl}}{d_kd_l}\bb{\frac{1 - \bb{d_kd_l}^{i}}{1 - d_kd_l}}
%     }
%     where 
%     $\widetilde{M} := \E\bbb{\vp\bb{A_{j}-\Sigma}v_{1}v_{1}^\top\bb{A_{j}-\Sigma}\vp^{\top}}$.
% \end{lemma}
% \begin{proof}
%     We have, 
%     \bas{
%         \E\bbb{Y_iY_i^\top} &= \sum_{j, k \in [i]}\E\bbb{X_j^iX_k^{i \top}} \\
%         &= \sum_{j \in [n]}\E\bbb{X_{j}^{i}X_{j}^{i \top}}, \;\; \text{ since } A_{j}, A_{k} \text{ are independent for } j \neq k \\
%         &= \sum_{j \in [i]}\vp\lambp^{i-j-1}\vp^{\top}\E\bbb{\bb{A_{j}-\Sigma}v_{1}v_{1}^\top\bb{A_{j}-\Sigma}}\vp\lambp^{i-j-1}\vp^{\top} \\
%         & = \vp\bb{\sum_{j \in [i]}\lambp^{i-j-1}\underbrace{\vp^{\top}\E\bbb{\bb{A_{j}-\Sigma}v_{1}v_{1}^\top\bb{A_{j}-\Sigma}}\vp}_{:= \widetilde{M}}\lambp^{i-j-1}}\vp^{\top}
%     }
%     Recall $R := \sum_{j \in [i]}\lambp^{i-j-1}\widetilde{M}\lambp^{i-j-1}$ and consider $\bb{k,l}^{\text{th}}$ entry of $R$. 
%     \bas{
%         R_{kl} &= e_{k}^{\top}\sum_{j \in [i]}\lambp^{i-j-1}\widetilde{M}\lambp^{i-j-1}e_{l} \\
%         &= \widetilde{M}_{kl}\sum_{j=1}^{i}\bb{d_{k}d_{l}}^{i-j-1}, \text{ where } d_{k}, d_{l} \text{ are the diagonal entries of } \lambp \\
%         &= \frac{\widetilde{M}_{kl}}{d_kd_l}\bb{\frac{\bb{d_kd_l}^{i} - 1}{\bb{d_kd_l} - 1}}
%     }
% \end{proof}


\begin{proof}[Proof of Lemma~\ref{lemma:second_moment_matrix}]
    Using the definitions of $Y_n$ and $X_{j}^n$ from Lemma~\ref{lemma:hajek_decomposition}, we have
    \bas{
        \frac{1}{\eta_n^2} \E\bbb{\Psi_{n,1}\Psi_{n,1}^{\top}} = \E\bbb{Y_n Y_n^\top} &= \sum_{j, k \in [i]}\E\bbb{X_j^n X_k^{n \top}} \\
        &= \sum_{j \in [n]}\E\bbb{X_{j}^{n}X_{j}^{n \top}}, \;\; \text{ since } A_{j}, A_{k} \text{ are independent for } j \neq k \\
        &= \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}\sum_{j \in [n]}\vp\lambp^{n-j}\vp^{\top}\E\bbb{\bb{A_{j}-\Sigma}v_{1}v_{1}^\top\bb{A_{j}-\Sigma}}\vp\lambp^{n-j}\vp^{\top} \\
        & = \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}\vp\bb{\sum_{j \in [n]}\lambp^{n-j}\underbrace{\vp^{\top}\E\bbb{\bb{A_{j}-\Sigma}v_{1}v_{1}^\top\bb{A_{j}-\Sigma}}\vp}_{:= \widetilde{M}}\lambp^{n-j}}\vp^{\top}.
    }
    Recall $R^{(n)} := \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}\sum_{j \in [n]}\lambp^{n-j}\widetilde{M}\lambp^{n-j}$ and consider $\bb{k,l}^{\text{th}}$ entry of $R^{(n)}$. 
    \bas{
        R_{kl}^{(n)} &= \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}e_{k}^{\top}\sum_{j \in [n]}\lambp^{n-j}\widetilde{M}\lambp^{n-j}e_{l} = \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}\widetilde{M}_{kl}\sum_{j=1}^{n}\bb{d_{k}d_{l}}^{n-j} = \frac{1}{\bb{1+\eta_n\lambda_1}^{2}}\widetilde{M}_{kl} \bb{\frac{1-\bb{d_kd_l}^{n}}{1-d_kd_l}}.
    }
    Let $R_0(k,l)=\widetilde{M}_{k\ell}/(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})$. 
    Note that 
    \bas{
        1-d_kd_l &= \frac{\eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}}{1+\eta\lambda_{1}} - \frac{\eta_n^{2}\bb{\lambda_{1}-\lambda_{k+1}}\bb{\lambda_{1}-\lambda_{l+1}}}{\bb{1+\eta\lambda_{1}}^{2}} \\
        &= \frac{\eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}}{1+\eta\lambda_{1}}\bbb{1 - \frac{\eta_{n}\bb{\lambda_{1}-\lambda_{k+1}}\bb{\lambda_{1}-\lambda_{l+1}}}{\bb{1+\eta\lambda_{1}}\bb{ \lambda_{1}-\lambda_{k+1} +  \lambda_{1}-\lambda_{l+1}}} } \\
        &\geq \frac{\eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}}{1+\eta\lambda_{1}}\bbb{1 - \frac{\eta_{n}\bb{\lambda_{1}-\lambda_{k+1}}\bb{\lambda_{1}-\lambda_{l+1}}}{\bb{ \lambda_{1}-\lambda_{k+1} +  \lambda_{1}-\lambda_{l+1}}} } \\
        &\geq \frac{\eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}}{1+\eta\lambda_{1}}\bbb{1 - \eta_{n}\min\left\{ \lambda_{1}-\lambda_{k+1},  \lambda_{1}-\lambda_{l+1}\right\} } \\
        &\geq \frac{\eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}}{1+\eta\lambda_{1}}\bbb{1 - \eta_{n}\lambda_{1} } \\
        &\geq \eta_n\bb{2\lambda_{1}-\lambda_{k+1}-\lambda_{l+1}}\bb{1-O\bb{\eta_n\lambda_{1}}}
    }
    Then,
    \bas{
    R^{(n)}_{kl}-R_0(k,l)/\eta_n&=\frac{\widetilde{M}_{k\ell}}{\eta_n(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})}\frac{(1+O(\eta_n\lambda_1))}{\bb{1+\eta_n\lambda_1}^{2}}-\frac{\widetilde{M}_{k\ell}}{\eta_n(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})}\\
    &=\frac{\widetilde{M}_{k\ell}}{\eta_n(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})}(1+O(\eta_n\lambda_1))-\frac{\widetilde{M}_{k\ell}}{\eta_n(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})}\\
    &=\frac{\widetilde{M}_{k\ell}}{\eta_n(2\lambda_1-\lambda_{k+1}-\lambda_{\ell+1})}O(\eta_n\lambda_1)
    }
    So we have:
    \bas{
    \frac{\eta_n R^{(n)}_{kl}-R_0(k,l)}{R_0(k,l)}&=O(\eta_n\lambda_1)
    }
    Finally, we have:
    \bas{
    \|\eta_n R^{(n)}-R_0\|_F\leq \frac{\eta_{n} \lambda_1}{\lambda_1-\lambda_2}\|\widetilde{M}\|_F/2
    }
    Note that
    \bas{
    \|\widetilde{M}\|_F^{2} \leq \E\bbb{\norm{(A_i-\Sigma)v_1v_1^{\top}(A_i-\Sigma)}} \leq \E\bbb{\|A_i-\Sigma\|^2} \le \mathcal{M}_{2}^{2}.
    }
\end{proof}

\subsection{Estimator Concentration}\label{appendix:estimator_concentration}


In this section, we estimate the bias of the variance estimate output by Algorithm~\ref{alg:variance_estimation}. In the entirety of this section, we assume that the vector $\vmain$ is ``good'', i.e $\sin^{2}\bb{\vmain, v_1} \lesssim \frac{\log\bb{1/\delta}}{\delta^{3}}\frac{\eta_{N}\Mtwo^{2}}{\bb{\eigengap}}$, which happens with probability at least $1-\delta$. Recall that $\vmain \gets \Oja(\mathcal{D}_{N}, \eta_{N}, u_0)$ is the high accuracy estimate of $v_1$. We present all results using a general $n$ number of $\iid$ samples per split, which will later be replaced by $n/(m_1m_2)$ as required by Algorithm~\ref{alg:variance_estimation}. We denote $s_{n} := \frac{\log\bb{1/\delta}}{\delta^{3}}\frac{\eta_{n}\Mtwo^{2}}{\bb{\eigengap}}$ to be the upper bound on the $\sin^2$ error of the Oja vector due to~\cite{jain2016streaming}. While our results henceforth are written using $s_n$ and $s_n$ is not guaranteed to be smaller than $1$, it is straightforward to replace it by $\min\left\{s_n, 1\right\}$ since the $\sin^2$ error between any two vectors is always at most $1$.

\input{Appendix/Ezero_bound}
\input{Appendix/Eone_bound}
\input{Appendix/Etwo_bound}
\input{Appendix/Ethree_bound}
\input{Appendix/Efour_bound}

\subsubsection{Total Variance Bound}\label{sub_appendix:uncertainty}
We now put together the results from Lemmas~\ref{lemma:en0_tail_bound},~\ref{lemma:en1_concentration_bound},~\ref{lemma:en2_tail_bound},~\ref{lemma:en3_tail_bound}, and~\ref{lemma:en4_tail_bound} to provide a high probability bound on the error of the variance estimator Algorithm~\ref{alg:variance_estimation}. 

\begin{figure}
    \centering   \includegraphics[width=0.5\linewidth]{images/subsample_uai.png}
    \caption{Schematic picture of Algorithm~\ref{alg:variance_estimation}}
    \label{fig:subsampling}
\end{figure}

Figure~\ref{fig:subsampling} summarizes how the variance estimation algorithm works. The algorithm first computes an Oja vector $\vmain$ using $N$ samples. Then, $n$ samples are divided into $m_1$ batches, with each batch containing $n/m_1$ samples. These $n$ samples need not be disjoint from the $N$ samples used to compute the high-accuracy estimate $\vmain$. Then, the ${\ell}^{\text{th}}$ batch of $n/m_1$ samples is split into $m = m_2$ batches of size $B \defeq n/m_1m_2$ each. Oja vectors $\left\{\hat{v}_{j}\right\}_{j \in [m_2]}$ are computed on each of these $m_2$ batches, and
\ba{
    \hat{\sigma}^{2}_{k, \ell} := \sum_{j \in [m_2]} \dfrac{\bb{e_k^{\top} \bb{\hat{v}_j - (\vmain^\top \hat{v}_j)\vmain}}^2}{m_2}. \label{eq:def_sigma_hat_ell}
}
for all $k \in [d]$. The overall estimate for the variance of the $k^{\text{th}}$ coordinate is $\mathsf{Median}\bb{\left\{\hat{\sigma}_{k, \ell}\right\}_{\ell \in [m_1]}}$. Since this variance scales with the inverse of the learning parameter $\eta_B$, we define the scale-free $\hat{\gamma}_k \defeq \mathsf{Median}\bb{\left\{\hat{\sigma}_{k, \ell}\right\}_{\ell \in [m_1]}}/(\eta_B \bb{\eigengap})$.
For each $k \in [d]$, define the quantities
\bas{
    b_k := \norm{e_k^{\top}\vp}, \;\;\;\; c_k := \sqrt{\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{\eta_B}\frac{\eigengap}{\Mtwo^{2}}}.
}
Under this setting, we show that each $\hat{\sigma}_{k, \ell}^2$ approximates the true variance with at least $3/4$ probability. We assume that the learning rate $\eta_B$ satisfies
\ba{
\eta_B \le \frac{1}{2\lambda_1} + \frac{\eigengap}{2 \Mtwo^2}. \label{eta_B_upper_bound}
}
It can be verified that this assumption is satisfied by the bounds on $B$ provided in \eqref{eq:n_lower_bound}.

\begin{lemma}\label{lemma:constant_prob_error_bound_all}
For any $\ell \in [m_1]$ and under assumption~\ref{eta_B_upper_bound}, with probability at least $3/4$,
\ba{
    \Abs{\hat{\sigma}_{k,\ell}^2 - \eta_B \bb{\eigengap} e_k^\top \V e_k} &\le  8\bb{\frac{1}{\sqrt{m}} + \frac{2}{m}}\eta_B \bb{\eigengap} e_k^\top \V e_k + O\bb{\frac{b_k^2 \log^2 B}{B^{3/2} m^{1/2}} \bb{\frac{\Mfour}{\eigengap}}^2 + \frac{\log N}{N} \bb{\frac{\Mtwo}{\eigengap}}^2} \nonumber\\
    &+ O\bb{\frac{b_k^2 m^2 \log^2 d \log^4 B}{B^2}  \bb{\frac{\Mtwo}{\eigengap}}^4 + \frac{\lambda_1 \Mtwo^2 \log^2 B}{B^2 \bb{\eigengap}^3}}. \label{eq:total_error_bound_all_coord}
}
\end{lemma}
\begin{proof}
Drop the index $\ell$ for convenience of notation. Let $\delta_0 \defeq 1/20$. By triangle inequality,
\ba{
\Abs{\hat{\sigma}_{k}^2 - \eta_B \bb{\eigengap} e_k^\top \V e_k} &\le \Abs{\hat{\sigma}_{k,\ell}^2 - \E\bbb{\bb{e_{k}^{\top}\Eone{B}}^{2}}} +  \Abs{\E\bbb{\bb{e_{k}^{\top}\Eone{B}}^{2}}- \eta_B \bb{\eigengap} e_k^\top \V e_k} \label{eq:triangle_ineq}
% &\le \Abs{\hat{\sigma}_{k,\ell}^2 - \E\bbb{\bb{e_{k}^{\top}\Eone{B}}^{2}}} + \frac{\eta_B^2 \Mtwo^2 \lambda_1}{\eigengap}. 
}
and by Lemma~\ref{lemma:second_moment_matrix},
\ba{
\Abs{\E\bbb{\bb{e_{k}^{\top}\Eone{B}}^{2}}- \eta_B \bb{\eigengap} e_k^\top \V e_k} \le \frac{\eta_B^2 \Mtwo^2 \lambda_1}{\eigengap} \lesssim \frac{\lambda_1 \Mtwo^2 \log^2 B}{B^2 \bb{\eigengap}^3}. \label{eq:true_hajek_close}
}
By equation~\eqref{eq:ojadecomp} and Lemma~\ref{lemma:square_expansion_cs}, for any $\eps \in (0,1)$,
    \ba{
    \Abs{\hat{\sigma}_{k}^{2} - \E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} &\le (1+\eps) \Abs{\frac{\sum_{j \in [m]} \bb{e_k^{\top} \Eone{B}^{(j)}}^2}{m} - \E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} + \eps \E\bbb{\bb{e_k^{\top} \Eone{B}}^2} \nonumber \\
    &+ \underbrace{\frac{8}{\eps} \sum_{j \in [m]} \frac{\bb{e_k^{\top} \Ezero{B}^{(j)}}^2 + \bb{e_k^{\top} \Etwo{B}^{(j)}}^2 + \bb{e_k^{\top} \Ethree{B}^{(j)}}^2 + \bb{e_k^{\top} \Efour{B}^{(j)}}^2}{m}}_{:= \errorsmall}. \label{eq:total_concentration_bound}
    }
Set $\eps = 2/\sqrt{m}$. By Lemmas~\ref{lemma:en0_tail_bound},~\ref{lemma:en2_tail_bound},~\ref{lemma:en3_tail_bound}, and~\ref{lemma:en4_tail_bound}, along with Lemma~\ref{lemma:learning_rate_choice} to bound $nd\exp\bb{-\eta_n n \bb{\eigengap}} = o\bb{1}$, we have with probability at least $1-4\delta_0$ 
\ba{
    \frac{\errorsmall}{8/\epsilon} &\lesssim 
    \frac{\eta_N \Mtwo^2}{\eigengap} + b_k^2 \eta_B^4 \Mtwo^4 B^2 \log^2 d + s_{B}b_k^{2} m \eta_{B}^{2}B \Mtwo^{2}\log^{2} d + b_k^{2} m^{2}\frac{\eta_{B}^{3} B \Mtwo^{4} \log d}{2\bb{\eigengap} + \eta_B\bb{\lambda_1^2-\lambda_2^2-\Mtwo^2}} \nonumber\\
    &\lesssim \frac{\log N}{N} \bb{\frac{\Mtwo}{\eigengap}}^2 + \frac{b_k^2 m \log^2 d \log^4 B}{B^2} \bb{\frac{\Mtwo}{\eigengap}}^4 + \frac{b_k^2 m^2 \log d \log^3 B}{B^2}  \bb{\frac{\Mtwo}{\eigengap}}^4. \label{eq:const_prob_small}
}
where we used Assumption~\ref{eta_B_upper_bound} to bound the last term. By Lemma~\ref{lemma:en1_concentration_bound}, with probability $1-\delta_0$, 
    \ba{
    \Abs{\frac{\sum_{j \in [m]} \bb{e_k^{\top} \Eone{B}^{(j)}}^2}{m} - \E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} &\le \frac{\sqrt{2} \E\bbb{(e_k^\top \Eone{B})^2} + \eta_B^2 b_k^2 \mathcal{M}_4^2 \sqrt{B}}{\sqrt{m\delta_0}} \nonumber \\ 
    &\le 4\epsilon \E\bbb{(e_k^\top \Eone{B})^2} + \frac{b_k^2 \log^2 B}{B^{3/2} m^{1/2}} \bb{\frac{\Mfour}{\eigengap}}^2 
    \label{eq:const_prob_hajek}
    }
We now combine equations~\eqref{eq:true_hajek_close}, ~\eqref{eq:total_concentration_bound},~\eqref{eq:const_prob_small}, and~\eqref{eq:const_prob_hajek} in~\eqref{eq:triangle_ineq} to conclude that with probability at least $1-5\delta_0 = 3/4$,
\bas{
\Abs{\hat{\sigma}_{k,\ell}^2 - \eta_B \bb{\eigengap} e_k^\top \V e_k} \leq (1+\epsilon) \bb{4\epsilon \eta_B \bb{\eigengap} e_k^\top \V e_k + \frac{b_k^2 \log^2 B}{B^{3/2} m^{1/2}} \bb{\frac{\Mfour}{\eigengap}}^2} + (1+\epsilon)(1+4\epsilon) \frac{\eta_B^2 \Mtwo^2 \lambda_1}{\eigengap} + \errorsmall,
}
which simplifies to the lemma statement.

\end{proof}
Next, assume that the following relations hold:
\begin{gather}
N \gtrsim \frac{m B}{c_k^2 \log B} \log \bb{\frac{m B}{ c_k^2\log B}}. \label{eq:N_lower_bound}\\
B \gtrsim  m^{3}\bb{\frac{b_k}{c_k}}^{2}\bb{\frac{\Mtwo}{\lambda_1 - \lambda_2}}^{2}\log^{3}\bb{B}\log^{2}\bb{d}. \label{eq:n_lower_bound}\\
B \gtrsim \max\bb{m \bb{\frac{b_k}{c_k}}^4 \bb{\frac{\Mfour}{\Mtwo}}^4 \log^2 B, \frac{m \lambda_1 \log B}{c_k^2 \bb{\eigengap}}}. \label{eq:B_lower_bound}
\end{gather}

These assumptions on $N$ and $B$ \textit{subsume} the assumption on the learning rate $\eta_B$ in equation~\ref{eta_B_upper_bound}.

Using equation~\ref{eq:true_hajek_close} and the relation
\ba{\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{m} &= \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap}. \label{eq:Eone_expectation_c_k}
} and comparing it with each term in the smaller order error of Lemma~\ref{lemma:constant_prob_error_bound_all} yields the following Lemma.
\begin{lemma}\label{lemma:constant_prob_helper}
Under assumptions~\ref{eq:N_lower_bound},~\ref{eq:n_lower_bound}, and~\ref{eq:B_lower_bound}, we have the following upper bound on the R.H.S of Eq~\ref{eq:total_error_bound_all_coord} in Lemma~\ref{lemma:constant_prob_error_bound_all}.
\ba{
 \frac{\log N}{N} \bb{\frac{\Mtwo}{\eigengap}}^2 + \frac{b_k^2 \log^2 B}{B^{3/2} m^{1/2}} \bb{\frac{\Mfour}{\eigengap}}^2 + \frac{b_k^2 m^2 \log^2 d \log^4 B}{B^2} \bb{\frac{\Mtwo}{\eigengap}}^4 &+ \frac{\lambda_1 \Mtwo^2 \log^2 B}{B^2 \bb{\eigengap}^3} \notag \\
 & \quad\quad \leq \frac{\eta_B \bb{\eigengap} e_k^\top \V e_k}{m}. \label{eq:total_error_bound_some_coord}
}
% the lower order terms in the error of Lemma~\ref{lemma:constant_prob_all_coord} is at most $\frac{\eta_B \lambda_1 e_k^\top \V e_k}{\sqrt{m}}$.
% \bas{
%     \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Ezero{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Etwo{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Ethree{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Efour{B}^{(i)}}^{2}}{m} \lesssim \frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{4m}.
% }
\end{lemma}
% \begin{proof}
%     The lemma follows by substituting 
%     By Lemma~\ref{lemma:en0_tail_bound}, with probability at least $1-\delta_0$,
%     \bas{
%     \sum_{i\in [m]}\frac{\bb{e_k^{\top} \Ezero{n}^{(i)}}^2}{m} \lesssim \frac{\eta_{N}\Mtwo^{2}}{(\eigengap)}.
%     }
%     which is less than or equal to $\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{16m}$ as long as 
%     \ba{
%     \frac{\eta_{N}\Mtwo^{2}}{(\eigengap)} \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap} \iff \frac{\log N}{N} \lesssim \frac{m_1 \log B}{n} c_k^2 \iff N \gtrsim \frac{\bb{{n}/{m_1 c_k^2}} \log \bb{{n}/{m_1 c_k^2}}}{\log B}. \label{eq:Ezero_N_bound}
%     }

%     By Lemma~\ref{lemma:en2_tail_bound}, with probability at least $1-\delta_0$,
%     \bas{
%     \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Etwo{B}^{(i)}}^{2}}{m} \le \frac{144b_k^2 m \eta_B^4 \mathcal{M}_2^4 B^2 \log^2 d}{\delta_0}.
%     }
%     Setting the right-hand side of the above equation to be smaller than $\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{16m}$ and using \eqref{eq:Eone_expectation_c_k}, it suffices that
%     \ba{
%     m \lesssim \bb{\frac{n}{m_1} \bb{\frac{c_k}{b_k}}^{2}\bb{\frac{\eigengap}{\Mtwo}}^{2}\frac{1}{\log^{3}\bb{n}\log^{2}\bb{d}}}^{\frac{1}{3}}. \label{eq:Etwo_m_bound}
%     }
%     By Lemma~\ref{lemma:en4_tail_bound}, with probability at least $1-\delta_{0}$,
%     \bas{
%     \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Efour{n}^{(i)}}^{2}}{m} \leq b_{k}^{2}m^{2}\bb{\frac{d\exp\bb{-2\eta_{B}B\bb{\lambda_{1}-\lambda_{2}} + \eta_{B}^{2}B\bb{\lambda_{1}^{2}+\Mtwo^{2}}} + \frac{e\eta_{B}^{3}B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}}}
%     {{\delta_0^{3}(1-\delta_0)}}}
%     }
%     Setting the right-hand side smaller than $\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{16m}$ and using \eqref{eq:Eone_expectation_c_k}, we require
% \bas{b_{k}^{2}m^{2}\bb{d\exp\bb{-2\eta_{B}B\bb{\lambda_{1}-\lambda_{2}} + \eta_{B}^{2}B\bb{\lambda_{1}^{2}+\Mtwo^{2}}} + \frac{e\eta_{B}^{3}B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}} } \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap}
%     }
%     Using the definition of $\eta_{B}$ and $B$, it suffices to ensure
%     \ba{
%         & \quad\quad\quad b_{k}^{2}m^{2} \frac{e\eta_{B}^{3}B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}} \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap} \notag \\
%         &\iff  m \lesssim \bb{\frac{n}{m_1} \bb{\frac{c_k}{b_k}}^{2}\bb{\frac{\eigengap}{\Mtwo}}^{2}\frac{1}{\log^{2}\bb{n}\log\bb{d}\log\bb{\frac{1}{\delta}}}}^{\frac{1}{4}} \label{eq:Efour_m_bound}
%     }
% By Lemma~\ref{lemma:en3_tail_bound}, with probability at least $1-\delta_0$, for $s_B := \frac{\eta_B\Mtwo^{2}}{\bb{\eigengap}}$, 
%     \bas{
%     \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Ethree{B}^{(i)}}^{2}}{m} &\lesssim s_{B}b_k^{2} m\frac{\eta_{B}^{2}B \Mtwo^{2}\log^{2}\bb{d}}{\delta_0} \\
%     &+ s_{B}b_k^{2}m^{4}\bb{\frac{  d\exp\bb{-2\eta_{B} B \bb{\lambda_{1}-\lambda_{2}} + \eta_{B}^{2} B \bb{\lambda_{1}^{2}+\Mtwo^{2}}} + \frac{e\eta_{B}^{3} B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}}  }{4\delta_0^4 \log^{-1}(1/\delta_0)}}.
%     }
%     Setting the right-hand side of the above equation to be to be at most $\frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{16m}$ and using \eqref{eq:Eone_expectation_c_k}, we require 
%     \begin{gather*}
%         s_{B}b_k^{2} m\eta_{B}^{2}B \Mtwo^{2}\log^{2}\bb{d} \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap}, \\
%         s_{B}b_k^{2}m^{4}\bb{\frac{  d\exp\bb{-2\eta_{B} B \bb{\lambda_{1}-\lambda_{2}} + \eta_{B}^{2} B \bb{\lambda_{1}^{2}+\Mtwo^{2}}} + \frac{e\eta_{B}^{3} B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}}  }{4\delta_0^4 \log^{-1}(1/\delta_0)}} \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap}.
%     \end{gather*}
%     Using the definition of $\eta_{B}$, $s_{B}$ and $B$, for the first term, it suffices to ensure
%     \ba{
%         & \quad\quad \frac{\eta_B\Mtwo^{2}}{\eigengap}b_k^{2} m\eta_{B}^{2}B \Mtwo^{2}\log^{2}\bb{d}  \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap} \notag \\
%         &\iff m \lesssim \bb{\frac{n}{m_1} \bb{\frac{c_k}{b_k}}^{2}\bb{\frac{\eigengap}{\Mtwo}}^{2}\frac{1}{\log^{2}\bb{n}\log^{2}\bb{d}\log\bb{\frac{1}{\delta_0}}}}^{\frac{1}{3}}  \label{eq:Ethree_term_1_m_bound}
%     }
%     Using the definition of $\eta_{B}$, $s_{B}$ and $B$, for the second term, it suffices to ensure
%     \ba{
%         & \quad\quad \frac{\eta_B\Mtwo^{2}}{\eigengap}b_k^{2} m^{4}\frac{e\eta_{B}^{3} B \Mtwo^{4}\bb{1+2\log\bb{d}}}{2\bb{\lambda_{1}-\lambda_{2}} + \eta_{B} \bb{\lambda_{1}^{2}-\lambda_{2}^{2}-\Mtwo^{2}}} \lesssim \frac{\eta_{B}c_{k}^{2}}{m}\frac{\Mtwo^{2}}{\eigengap} \notag \\
%         &\iff m \lesssim \bb{\frac{n}{m_1} \bb{\frac{c_k}{b_k}}^{2}\bb{\frac{\eigengap}{\Mtwo}}^{2}\frac{1}{\log^{3/2}\bb{n}\log^{1/2}\bb{d}\log\bb{\frac{1}{\delta_0}}}}^{\frac{2}{7}} \label{eq:Ethree_term_2_m_bound}
%     }
%     Equations~\eqref{eq:Ezero_N_bound}, \eqref{eq:Etwo_m_bound}, \eqref{eq:Efour_m_bound}, \eqref{eq:Ethree_term_1_m_bound}, and~\eqref{eq:Ethree_term_2_m_bound} imply that with probability $1-4\delta_0,$
%     \bas{
%     \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Ezero{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Etwo{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Ethree{B}^{(i)}}^{2}}{m}+ \frac{\sum_{i \in [m]}\bb{e_{k}^{\top}\Efour{B}^{(i)}}^{2}}{m} \lesssim \frac{\E\bbb{\bb{e_k^{\top}\Eone{B}}^{2}}}{4m}.
% }
% \end{proof}
It follows that a stronger multiplicative guarantee holds for any coordinate $k$ that satisfies the above assumptions:
\begin{lemma}\label{lemma:constant_prob_error_bound_some}
For any coordinate $k$ that satisfies Lemma~\ref{lemma:constant_prob_error_bound_all} and assumptions~\ref{eq:N_lower_bound},~\ref{eq:n_lower_bound}, and ~\ref{eq:B_lower_bound}, 
\bas{
    \Abs{\hat{\sigma}_{k}^2 - \eta_B \bb{\eigengap} e_k^\top \V e_k} \le O\bb{\frac{\eta_B \bb{\eigengap} e_k^\top \V e_k}{\sqrt{m}}}.
}
\end{lemma}
% \begin{proof}
%     By equation~\eqref{eq:ojadecomp} and Lemma~\ref{lemma:square_expansion_cs}, for any $\eps \in (0,1)$,
%     \ba{
%     \Abs{\hat{\sigma}^{2} - E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} &\le (1+\eps) \Abs{\frac{\sum_{j \in [m]} \bb{e_k^{\top} \Eone{B}^{(j)}}^2}{m} - E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} + \eps E\bbb{\bb{e_k^{\top} \Eone{B}}^2} \nonumber \\
%     &+ \frac{8}{\eps} \sum_{j \in [m]} \frac{\bb{e_k^{\top} \Ezero{B}^{(j)}}^2 + \bb{e_k^{\top} \Etwo{B}^{(j)}}^2 + \bb{e_k^{\top} \Ethree{B}^{(j)}}^2 + \bb{e_k^{\top} \Efour{B}^{(j)}}^2}{m}. \label{eq:total_concentration_bound}
%     }
%     Set $\eps = \frac{2}{\sqrt{m}}$. By Lemma~\ref{lemma:constant_prob_helper}, with probability at least $1-4\delta_0$,
%     \ba{
%     \frac{8}{\eps} \sum_{j \in [m]} \frac{\bb{e_k^{\top} \Ezero{B}^{(j)}}^2 + \bb{e_k^{\top} \Etwo{B}^{(j)}}^2 + \bb{e_k^{\top} \Ethree{B}^{(j)}}^2 + \bb{e_k^{\top} \Efour{B}^{(j)}}^2}{m} \le \frac{E\bbb{\bb{e_k^{\top} \Eone{B}}^2}}{\sqrt{m}}. \label{eq:const_prob_small}
%     }
%     By Lemma~\ref{lemma:en1_concentration_bound}, with probability $1-\delta_0$, 
%     \ba{
%     \Abs{\frac{\sum_{j \in [m]} \bb{e_k^{\top} \Eone{B}^{(j)}}^2}{m} - E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} \le \frac{\sqrt{2} \E\bbb{(e_k^\top \Eone{B})^2} + \eta_B^2 b_k^2 \mathcal{M}_4^2 \sqrt{B}}{\sqrt{m\delta_0}} \le \frac{7 \E\bbb{(e_k^\top \Eone{B})^2}}{\sqrt{m}}, \label{eq:const_prob_hajek}
%     }
%     as long as $\eta_B^2 b_k^2 \Mfour^2 B^{1/2} \lesssim \E\bbb{(e_k^\top \Eone{B})^2}$. Using equation~\eqref{eq:Eone_expectation_c_k}, this simplifies to the assumed
%     \bas{
%         B \gtrsim \bb{\frac{b_k}{c_k}}^4 \bb{\frac{\Mfour}{\Mtwo}}^4 \log^2 B.
%     }
%     Combining equations~\eqref{eq:const_prob_hajek} and~\eqref{eq:const_prob_small} with~\eqref{eq:total_concentration_bound}, with probability at least $1-5\delta_0 = 3/4$,
%     \bas{
%     \Abs{\hat{\sigma}^{2} - E\bbb{\bb{e_k^{\top} \Eone{B}}^2}} &\le \bb{\bb{1+\frac{2}{\sqrt{m}}} \frac{8}{\sqrt{m}} + \frac{1}{\sqrt{m}} + \frac{7}{\sqrt{m}}}E\bbb{\bb{e_k^{\top} \Eone{B}}^2} \\
%     &= 16\bb{\frac{1}{\sqrt{m}} + \frac{1}{m}} E\bbb{\bb{e_k^{\top} \Eone{B}}^2}.
%     }
%     % Let us fix a particular value of the index, $j$. For conciseness of notation, define $\forall i \in [0, 4]$,  $a_{i} := e_{k}^{\top}\bb{\Psi_{B, i}^{(2j)} - \Psi_{B, i}^{(2j-1)}}$ and $b_i := e_{k}^{\top}\bb{\Psi_{B, i}^{(2j)} + \Psi_{B, i}^{(2j-1)}}$. Then, using Lemma~\ref{lemma:oja_error_decomposition}, we have
%     % \bas{
%     %     & \Abs{e_{k}^{\top}(\hat{v}_{2j} - \hat{v}_{2j-1})} = \Abs{a_0 + a_1 + a_2 + a_3 + a_4}, \;\; \Abs{e_{k}^{\top}(\hat{v}_{2j} + \hat{v}_{2j-1})} = \Abs{b_0 + b_1 + b_2 + b_3 + b_4}
%     % }
%     % Note that,
%     % \ba{
%     %     \min\left\{|a_1|, |b_1|\right\} -  \sum_{i=0, i \neq 1}^{4}\min\left\{|a_i|, |b_i|\right\} &\leq \min\left\{\Abs{e_{k}^{\top}(\hat{v}_{2j} - \hat{v}_{2j-1})}, \Abs{e_{k}^{\top}(\hat{v}_{2j} + \hat{v}_{2j-1})}\right\} \notag \\
%     %     &\quad\quad\quad\quad\quad\quad \leq \min\left\{|a_1|, |b_1|\right\} +  \sum_{i=0, i \neq 1}^{4}\min\left\{|a_i|, |b_i|\right\}
%     % }
%     % Therefore, using Lemma~\ref{lemma:square_expansion_cs}, for any $\epsilon > 0$, 
%     % \ba{
%     %     (1+\epsilon)\min\left\{|a_1|, |b_1|\right\}^{2} - \frac{20}{\epsilon}\sum_{i=0, i \neq 1}^{4}\min\left\{|a_i|, |b_i|\right\}^{2} & \leq \min\left\{\Abs{e_{k}^{\top}(\hat{v}_{2j} - \hat{v}_{2j-1})}, \Abs{e_{k}^{\top}(\hat{v}_{2j} + \hat{v}_{2j-1})}\right\}^{2} \\ & \leq (1+\epsilon)\min\left\{|a_1|, |b_1|\right\}^{2} +  \frac{20}{\epsilon}\sum_{i=0, i \neq 1}^{4}\min\left\{|a_i|, |b_i|\right\}^{2}
%     % }
% \end{proof}
Given a per-coordinate guarantee that succeeds with probability $3/4$, we can boost the probability of success and give a uniform guarantee over all coordinates $k \in [d]$ using the median procedure described in Lemma~\ref{lemma:MoM}. 

\begin{lemma}\label{lemma:high_prob_error_bound}
Let $\left \{ \hat{\gamma}_k \right \}_{k \in [d]}$ be the output of Algorithm~\ref{alg:variance_estimation}. Under assumption~\eqref{eta_B_upper_bound}, with probability $1-\delta$, for all $k \in [d]$,
\bas{
    \Abs{\hat{\gamma}_k - \V_{kk}} &\le  8\bb{\frac{1}{\sqrt{m}} + \frac{2}{m}} \V_{kk} + O\bb{\frac{b_k^2 \log B}{\sqrt{mB}} \bb{\frac{\Mfour}{\eigengap}}^2 + \frac{B \log N}{N \log B} \bb{\frac{\Mtwo}{\eigengap}}^2} \nonumber\\
    &+ O\bb{\frac{b_k^2 m^2 \log^2 d \log^3 B}{B}  \bb{\frac{\Mtwo}{\eigengap}}^4 + \frac{\lambda_1 \Mtwo^2 \log B}{B \bb{\eigengap}^3}}.
}
Moreover, let $K$ be the set of indices in [d] that satisfy assumptions~\eqref{eq:N_lower_bound},~\eqref{eq:n_lower_bound}, and~\eqref{eq:B_lower_bound}. Then, for all $k \in K$,
\bas{
 \Abs{\hat{\gamma}_k - e_k^\top \V e_k} = O\bb{\frac{  \V_{kk} }{\sqrt{m}}}.
}
% the bound of equation~\eqref{eq:total_error_bound_all_coord} holds for all coordinates $k \in [d]$, and the bound of equation~\eqref{eq:total_error_bound_some_coord} holds for all $k \in K$.
\end{lemma}
\begin{proof}
By Lemma~\ref{lemma:constant_prob_error_bound_all}, the bound for any $k \in [d]$, the bound of equation~\eqref{eq:total_error_bound_all_coord} holds with probability $3/4$. By Lemma~\ref{lemma:MoM} and the choice $m_1 = 8 \log (d/\delta)$, the estimate $\hat{\gamma}_k$ satisfies the equation with probability at least $1-\delta/d$. The Lemma follows by a union bound over the indices in $[d]$. 
\end{proof}

\begin{remark}\label{remark:prop2_higher_order}
The first term of the error of Lemma~\ref{lemma:high_prob_error_bound} is $O\bb{ \V_{kk}/\sqrt{m}}$, where $m = \log n$. We verify that the other terms are smaller asymptotically in $n$. Since $m = \log n$ and $m_2 = 8 \log (20d)$ where $d = \text{poly}(n)$,
\bas{
B = \frac{n}{m m_1} = \Theta\bb{\frac{n}{\log n \log d}}.
}
Therefore, each summand with a $\sqrt{B}$ or $B$ in the denominator of the error of Lemma~\ref{lemma:high_prob_error_bound} is $\tilde{O}(1/\sqrt{n})$. It suffices to show that $\frac{1}{\sqrt{m}}$ asymptotically dominates $\frac{B \log N}{N \log B}$. Note that $1 \le \log d \le 5 \log n$, $B = \tilde{\Theta}(n)$ and $\log B = \Theta(\log n)$. Therefore,

\bas{
\frac{B \log N}{N \log B} &= \frac{\log B + \log m_1 + \log m}{m_1 m \log B} \le \frac{\log B + m_1 + m}{m_1 m \log B} \\
&= \frac{1}{\log B \log n} + \frac{1}{8 \log n \log (20d)} + \frac{1}{8 \log (20 d) \log B} = O\bb{\frac{1}{\log n}} = o\bb{\frac{1}{\sqrt{m}}}.
}
\end{remark}
% By choosing $m_1 = 8 \log \frac{d}{\delta}$