Robust Importance Sampling with Adaptive Winsorization

Extracted source text ยท arXiv 1810.11130

\documentclass[11pt]{scrartcl}
\usepackage{amsmath,amssymb, amsthm}
\usepackage{graphicx, color, psfrag}
%\usepackage[dvipsnames]{xcolor}
% \usepackage[sf,bf]{titlesec}
\usepackage{bbm}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

% \usepackage[brazilian]{babel}
% \usepackage[T1]{fontenc}
% \usepackage[latin1]{inputenc}
\usepackage[applemac]{inputenc}
\usepackage[colorlinks, linkcolor=black, citecolor=black, urlcolor=blue]{hyperref}

\usepackage{breakcites}

\usepackage{caption}
\captionsetup[figure]{font=small}

\usepackage{blindtext}
\setcapindent{0em}

% \usepackage{enumerate}
\usepackage{enumitem}
%\usepackage{cancel}
\usepackage{comment}
\usepackage{subcaption}
\usepackage[group-minimum-digits={3}]{siunitx}
%\num[group-separator={,}]{1234567890}

\renewcommand{\baselinestretch}{1.1}
  \setlength {\textheight}{8.70in} 
  \setlength {\textwidth}{6.5in}
  \setlength {\topmargin}{-0.20in}
  \setlength {\oddsidemargin}{-0.00in}    
  \setlength {\parindent}{1pc}
  
\theoremstyle{plain}
	\newtheorem{theorem}{Theorem}
	\newtheorem{itheorem}[theorem]{\color{Red} Theorem}
	\newtheorem{prop}[theorem]{Proposition}
	\newtheorem{iprop}[theorem]{\color{Red} Proposition}
	\newtheorem{lemma}[theorem]{Lemma}
	\newtheorem{ilemma}[theorem]{\color{Red} Lemma}
	\newtheorem{corollary}[theorem]{Corollary}
	\newtheorem{icorollary}[theorem]{\color{Red} Corollary}
	\newtheorem{problem}{Problem}
	\newtheorem{fact}{Fact}
	\newtheorem{question}{Question}
\theoremstyle{definition}
	\newtheorem{examplex}{Example}
	\newtheorem{remarkx}[theorem]{Remark}
	\newtheorem{remarkMP}[theorem]{\color{Gray} Remark}
	%\newtheorem{remark}[theorem]{Remark}
	\newtheorem{definition}[theorem]{Definition}
	\newtheorem{idefinition}[theorem]{\color{Cerulean} Definition}
	
\newcommand{\fc}{$\divideontimes$ }
\newcommand{\defn}{$\ast$ }
\renewcommand{\prop}{{ $\blacktriangleright$} }
\newcommand{\obs}{\textbf{-} }
\newcommand{\cor}{ $\triangleright$ }
\newcommand{\ex}{{\footnotesize $\rightarrow$} }
\newcommand{\cex}{$\leadsto$ }

%\usepackage[charter]{mathdesign}

\newenvironment{example}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\square$}\examplex}
  {\popQED\endexamplex}
  
\newenvironment{remark}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\remarkx}
  {\popQED\endexamplex}  
  
\newcommand\indep{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

\newcommand{\hs}{\hspace{5mm}}
\newcommand{\vs}{\vspace{5mm}}
\newcommand*{\vbar}{\rule[-1ex]{0.5pt}{2.5ex}}
\renewcommand*{\hbar}{\rule[.5ex]{2.5ex}{0.5pt}}

\renewcommand{\Re}{\text{Re}}
\renewcommand{\Im}{\text{Im}}
% \renewcommand{\labelitemi}{-}

\newcommand{\E}{\mathbb{E}}
\newcommand{\V}{\mathbb{V}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\F}{\mathcal{F}}
\newcommand{\B}{\mathcal{B}}
\newcommand{\I}{\mathbb{I}}

\DeclareMathOperator{\bias}{bias}
\DeclareMathOperator{\range}{range}
\DeclareMathOperator{\nullsp}{nullsp}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\argmax}{argmax}
\DeclareMathOperator{\argmin}{argmin}
\DeclareMathOperator{\med}{med}
\DeclareMathOperator{\iid}{\stackrel{\text{iid}}{\sim}}
\DeclareMathOperator{\ind}{\stackrel{\text{ind}}{\sim}}

\newcommand*{\email}[1]{\bgroup\color{blue}\href{mailto:#1}{#1}\egroup}
\newcommand*{\ppara}[1]{\noindent\textbf{\textsf{#1}}\,\,}
\newcommand{\note}[1]{\textcolor{red}{\textbf{[#1]}}}

\graphicspath{{./figures/}}

\newcommand{\notate}[1]{\textcolor{red}{\textbf{[#1]}}}

\begin{document}

\title{\textbf{Finite-sample Guarantees for \\ Winsorized Importance Sampling}}
\author{Paulo Orenstein\footnote{Stanford University, Stanford, California 94305, USA. \email{pauloo@stanford.edu}}}
\date{}
\maketitle

\begin{abstract}
	\ppara{Abstract:} Importance sampling is a widely used technique to estimate the properties of a distribution. The resulting estimator is always unbiased, but may sometimes incur huge variance. This paper investigates trading-off some bias for variance by winsorizing the importance sampling estimator. 
	
The threshold level at which to winsorize is determined by a concrete version of the Balancing Principle, also known as Lepski's Method, which may be of independent interest. The procedure adaptively chooses a threshold level among a pre-defined set by roughly balancing the bias and variance of the estimator when winsorized at different levels. As a consequence, it provides a principled way to perform winsorization, with finite-sample optimality guarantees.

The empirical performance of the winsorized estimator is considered in various examples, both real and synthetic. The estimator outperforms the usual importance sampling estimator in high-variance settings, and remains competitive when the variance of the importance sampling weights is low.

\end{abstract}

\section{Introduction} \label{sec:introduction}

Let $\mathbb{P}$ and $\mathbb{Q}$ denote two probability measures on a set $\mathcal{X}$ with some $\sigma$-algebra, and suppose they admit probability density functions $p$ and $q$. Let $f: \mathcal{X} \to \R$ be a measurable function, integrable with respect to $\mathbb{P}$. The goal is to estimate
\begin{equation*}
 \theta = \E_p[f(X)] = \int_{\mathcal{X}} f(x) p(x) dx.
\end{equation*}

Let $X_1, X_2, \ldots$ be a sequence of $\mathcal{X}$-valued random variables with law $q$. The \emph{importance sampling estimator} for $\theta$ is defined as
\begin{equation} \label{eq:importance_sampling_estimator}
 \hat{\theta}_n = \frac{1}{n} \sum_{i=1}^{n} f(X_i) \frac{p(X_i)}{q(X_i)},
\end{equation}
with $p(x)$ being the \emph{target distribution}, and $q(x)$ the \emph{proposal} or \emph{sampling distribution}. As long as $q(x)>0$ whenever $f(x)p(x)>0$, this estimator is unbiased:
\begin{equation*}
	\hat{\theta}_n \stackrel{n \to \infty}{\longrightarrow} \E\left[f(x) \frac{p(X)}{q(X)}\right] =\int_{\{x \in \mathcal{X} \hspace{0.1cm} : \hspace{0.1cm}  q(x) > 0\}} f(x) \frac{p(x)}{q(x)} q(x) dx = \int_{\mathcal{X}} f(x)p(x) dx = \theta.
\end{equation*}

While importance sampling has many applications, from rare-event simulations to Bayesian computation, it can fail spectacularly with a poor choice of sampling distribution $q$. Indeed, because $\hat{\theta}_n$ is a ratio of random variables, it can exhibit enormous or even infinite variance, leading to possibly terrible estimates.

Consider the following simple example: let $\mathcal{X}=\R$ with $f(x)=x$, $p(x)=\frac{1}{\sqrt{2\pi}}e^{-x^2/2}$ and $q(x) = \frac{1}{\sqrt{2\pi \sigma^2}}e^{-x^2/(2 \sigma^2)}$, where $\sigma>0$. The variance of the importance sampling estimator is given by
\begin{equation*}
\V[\hat{\theta}_n] = \E[\hat{\theta}_n^2] - \E^2[\hat{\theta}_n]= \frac{1}{n} \int f^2(x) \frac{p^2(x)}{q^2(x)} q(x) dx = \frac{1}{n} \sigma \int x^2 \frac{e^{-x^2 (1- \frac{1}{2 \sigma^2})}}{\sqrt{2\pi}}dx,
\end{equation*}
which is infinite if $\sigma^2 \leq 1/2$. Thus, while the estimator is unbiased, one would be hard-pressed to trust it. In fact, with  $\sigma=0.1$ and as many as $n=1000$ observations over $1000$ different simulations, the maximum estimate obtained was $\hat{\theta} = 45.08$ for the true $\theta=0$ (the mean estimate over all $1000$ simulations for $\hat{\theta}$ was $0.06$, with standard deviation $1.47$).

In more complex examples, this issue can become even more pernicious. For instance, in many cases finding a good proposal distribution might be too hard, or sampling from it might be too computationally intensive. Section \ref{sec:SAW} considers an important class of examples where different but reasonable choices for the sampling distribution $q$ lead the method astray.

A relevant question in this context is the extent to which the variance of the terms
\begin{equation*}
Y_i = f(X_i) \frac{p(X_i)}{q(X_i)}
\end{equation*}
can be controlled. A straightforward possibility is to winsorize them. That is, define the random variables censored at levels $-M$ and $M$ by
\begin{equation*}
Y_i^M = \max(-M, \min(Y_i, M)).
\end{equation*}
With this notation, the usual importance sampling can be rewritten $\hat{\theta}_n = \frac{1}{n} \sum_{i=1}^{n} Y_i$, while the \emph{winsorized importance sampling estimator} at level $M$ is
\begin{equation*}
\hat{\theta}^M_n = \frac{1}{n} \sum_{i=1}^{n} Y_i^M.
\end{equation*}

Note $M$ indexes a bias-variance trade-off. As the threshold level $M$ is decreased for the winsorized estimator $\hat{\theta}^M_n$, the variance lessens as the bias grows. Indeed, the sample mean $\hat{\theta}_n$ has zero bias with potentially enormous variance, while winsorizing with $M=0$ produces the constant estimator $\hat{\theta}_n=0$. This trade-off will be considered more carefully in Section \ref{sec:truncated_IS}, but clearly a good choice of threshold $M$ is crucial for winsorized importance sampling to work at all.

To pick an optimal threshold level, the Balancing Principle (also known as Lepski's Method) is adopted. This method adaptively selects a threshold level, among a predefined set, that automatically winsorizes more when the variance of the estimator is high compared to bias, and less (or not at all) when the variance is comparatively lower. It also yields finite-sample optimality guarantees for the winsorized estimator.

The main result has the following form:
\begin{theorem} \label{thm:1}
Let $\left\{Y_i\right\}_{i=1}^n$ be random variables distributed iid with mean $\theta$. Consider winsorizing $Y_i$ at different threshold levels in a pre-chosen set $\Lambda=\{M_1, \ldots, M_k\}$ to obtain winsorized samples $\{Y_i^{M_j}\}_{i=1}^n$, $j=1, \ldots, k$. Pick the threshold level according to the rule
\begin{equation} \label{lepski_rule}
M_* = \min\left\{M \in \Lambda \ : \ \forall M', M'' \geq M, \quad  |\overline{Y^{M'}}-\overline{Y^{M''}}| \leq c \cdot \frac{t}{\sqrt{n}-t} \cdot \left(\frac{\hat{\sigma}^{M'}+\hat{\sigma}^{M''}}{2}\right)\right\},
\end{equation}
where $c, t$ are chosen constants, $t < \sqrt{n}$, $\overline{Y^M} = \frac{1}{n}\sum_{i=1}^{n}Y_i^M$ and $\hat{\sigma}^{M}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \overline{Y^M})^2}$. 
Let $K>0$ be such that $\E[|Y_i^{M_j} - \E[Y_i^{M_j}]|^3] \leq K (\V[Y_i^{M_j}])^{3/2}$ for all $j$. Then, with probability
\begin{equation*}
1 - 2|\Lambda|\left(1 + \frac{50K}{\sqrt{n}}-\Phi\left(t \sqrt{\frac{n}{(\sqrt{n}-t)^2+t^2}}\right)\right),
\end{equation*}
it holds
\begin{equation*}
|\overline{Y^{M_*}}-\theta| \leq C \min_{M \in \Lambda}\left\{|\E[Y_i^M]-\theta| +  \frac{t}{\sqrt{n}-t}\hat{\sigma}^M\right\},
\end{equation*}
where $C=C(c)$ can be made less than $4.25$.
\end{theorem}

Intuitively, the theorem says that, given a set $\Lambda$ of pre-chosen threshold values for winsorization, picking one according to the decision rule (\ref{lepski_rule}) guarantees, with high probability, that the error of the procedure is bounded by a constant multiple of the optimal sum of bias and sample standard deviation, among all threshold levels considered. This ensures the error incurred by winsorizing is not too large in terms of either unobserved bias or observed variance. 
The user is free to choose parameters $c$ and $t$, and while $K$ is often unknown, it is not expected to be large in a setting where the variance of $Y_i$ is assumed to be unwieldy to begin with.
The theorem is discussed in more detail in Section \ref{sec:probabilistic_bounds}. Section \ref{sec:simulations} considers its performance over many examples.

\vs

\textbf{Review of the literature.} Proposals for winsorizing importance sampling weights have been considered before. \cite{ionides2008truncated} analyzes an optimal way to pick the threshold value under asymptotic considerations, and also suggests an adaptive thresholding procedure relying on an unbiased risk estimate. Similarly, \cite{sen2017identifying} proposes adaptively capping the importance sampling weights according to an estimate of the variance. \cite{northrop2017cross} suggests using cross-validation to pick a threshold value for winsorizing a heavy-tailed sample, an approach related to the used in Section \ref{sec:simulations} as a baseline.

More generally, \cite{liu2016black} considers modifying the importance weights by minimizing a kernelized Stein discrepancy, while \cite{delyon2016integral} investigates the improvement on rates of convergence when changing the weights using a leave-one-out kernel estimator. Several semi-parametric approaches also exist, estimating the tail distribution using exponential tilting (\cite{fithian2014semiparametric}), Pareto distributions (\cite{johansson2003estimating}, \cite{vehtari2015pareto}) and Bayesian parametric modeling (\cite{taddy2016scalable}).

The main theoretical tool in picking a threshold value is based on the Balancing Principle, also known as Lepski's Method. For an overview, see \cite{mathe2006lepskii} and \cite{hamarik2009balancing}. This method has also been applied to different statistical procedures, for instance, the Lasso (\cite{chichignoud2016practical}), and to other ill-posed problems in numerical analysis (\cite{lazarov2007balancing}, \cite{li2017empirical}).

To empirically verify the performance of the method, several examples, proposed elsewhere in the literature, are studied. Notably, the complete self-avoiding walk problem was first suggested in \cite{knuth1976mathematics}. A theoretical analysis in the case of monotone paths is given in \cite{bassetti2006examples}, and analyses of other particular cases are in \cite{bousquet2005self}. \cite{bousquet2014importance} gives further theoretical and empirical results, in particular laying out efficient ways of sampling paths that never get trapped. We also test the procedure on the set of importance sampling examples proposed in \cite{vehtari2015pareto}, with slight modifications.

\vspace{5mm}

\textbf{Paper organization.} The paper is structured as follows. Section \ref{sec:SAW} presents a motivating but common example where obtaining a good sampling distribution is hard, and winsorizing becomes a promising alternative. Section \ref{sec:truncated_IS} investigates how winsorizing benefits the importance sampling estimation problem. Section \ref{sec:balancing_theorem} states and proves the Balancing Theorem, which is the main theoretical result powering the finite-sample results. Because the assumptions of the theorem only hold probabilistically, Section \ref{sec:probabilistic_bounds} uses a $t$-statistic Central Limit Theorem to bound the required probabilities, thus providing a full proof of Theorem \ref{thm:1} above. Finally, Section \ref{sec:simulations} applies the outlined procedure to real and simulated datasets, and compares it with both the traditional importance sampling estimator, and a winsorized estimator thresholded at a level chosen via cross-validation. Further research directions appear in Section \ref{sec:conclusion}.

\section{Motivating Example: Self-avoiding Walks} \label{sec:SAW}  

In 1976, Don Knuth \cite{knuth1976mathematics} considered the following question: how many complete self-avoiding walks are there on a $10 \times 10$ grid? A complete self-avoiding walk on an $m \times m$ grid is a path that does not intersect itself, starting at point $(0, 0)$ and ending at point $(m, m)$ (see Figure \ref{fig:1} for the case $m=10$). While it is theoretically possible to answer this question by counting every path, this quickly becomes intractable for large $m$. Instead of counting, Knuth proposed using sequential importance sampling to estimate this quantity.

Let $Z$ denote the number of complete self-avoiding walks (CSAW) on an $m \times m$ grid, and let $p(x) = \frac{1}{Z}\cdot \mathbb{I}_{[x \text{ is CSAW}]}$ be the probability density function of sampling a complete self-avoiding walk uniformly at random, with $\mathbb{I}_{[x \text{ is CSAW}]}$ an indicator function for whether the path $x$ is a complete self-avoiding walk. Since sampling from $p$ is hard, Knuth considered another distribution $q$ that is easy to sample from, and such that $p(x)=0$ whenever $q(x)=0$. Since
\begin{equation*}
Z = \int Z \ p(x) dx = \int_{\{x : q(x)>0\}} Z \ \frac{p(x)}{q(x)} q(x) dx = \int_{\{x :  q(x)>0\}} \frac{\mathbb{I}_{[x \text{ is CSAW}]}}{q(x)}q(x)dx,
\end{equation*}
$Z$ can be estimated by generating sample paths $x_i \stackrel{\text{iid}}{\sim} q$ and using the importance sampling estimator
\begin{equation} \label{eq:importance_sampling_identity}
\hat{Z} = \frac{1}{n} \sum_{i=1}^{n} \frac{1}{q(x_i)} \mathbb{I}_{[x_i \text{ is CSAW}]}.
\end{equation}

\begin{figure}[htbp]
 \centering
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_no_traps/no_traps_plot_11_6.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_4.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_36_modified.png}
	\end{minipage}
 \caption{Two complete self-avoiding walks on a $10\times 10$ grid (blue), and a walk that is forced to intersect with itself before reaching $(10, 10)$ (red).}
 \label{fig:1}
\end{figure}

For a distribution $q$ that is easy to sample from and whose density is known, Knuth suggested a sequential procedure. Start at point $(0, 0)$; since it has two neighbor points available, jump to each with probability $1/2$ (see Figure \ref{fig:2}). The new point also has two available neighbors, so again pick one uniformly among them. Keep advancing to new points by picking among available neighbors until the path gets to the point $(10, 10)$. Here, ``available neighbors'' are points that have not been visited before, and which don't lead to a path that is forced to intersect with itself to get to $(10, 10)$, as the red walk in Figure \ref{fig:1} (the only available neighbor to the yellow point in the path is the one above it). Let $d_j$ denote the number of available neighbors on step $j$, each neighbor is picked with uniform probability $1/d_j$, and define the probability of the entire path $x$ as $q(x) = \prod_{j=1}^{l_x} 1/d_j$, with $l_x$ the length of path $x$. Figure \ref{fig:2} provides an example. It is not hard to see this constitutes a probability measure on the self-avoiding walks. Thus, to estimate $Z$, generate many independent paths $x_1, \ldots, x_n$ with this sequential procedure, calculate the number of available neighbors $d_{j,i}$ at each step $j$ and path $x_i$, and set
\begin{equation} \label{eq:Z_hat_CSAW}
\hat{Z} = \frac{1}{n}\sum_{i=1}^n \frac{1}{q(x_i)} \mathbb{I}_{[x_i \text{ is CSAW}]}  = \frac{1}{n} \sum_{i=1}^{n} \left(\prod_{j=1}^{l_i} d_{j, i}\right) \mathbb{I}_{[x_i \text{ is CSAW}]}.
\end{equation}
This estimate is just the average of the product of the available neighbors at each step.

\begin{figure}[htbp]
 \centering
	\begin{minipage}{0.325\textwidth} 		\includegraphics[width=1\textwidth]{building_plot_11_8a.png}
	\end{minipage}
	\begin{minipage}{0.325\textwidth} 		\includegraphics[width=1\textwidth]{building_plot_11_8b.png}
	\end{minipage}
	\begin{minipage}{0.325\textwidth} 		\includegraphics[width=1\textwidth]{building_plot_11_8c.png}
	\end{minipage}
 \caption{Counting the number of available neighbors $d_j$ at each point $j$: $d_1=2$, $d_{14}=1$, and the product is $d=\prod_{j=1}^{30}d_j= 1^{4}\times 2^{10} \times 3^{16}$; assign probability $1/d = 1^{-4}\times 2^{-10} \times 3^{-16}$ to the path.}
 \label{fig:2}
\end{figure}

Using such a procedure and a few thousand simulations, Knuth estimated the number of paths on a $10\times 10$ grid to be $(1.6 \pm 0.3) \cdot 10^{24}$. It was remarkably close: the actual answer was later found to be $1.56 \cdot 10^{24}$ (see \cite{Knuth:1995:SPC:526202}, page 57). With similar ideas, he also calculated the average path length to be $92 \pm 5$, and the number of paths through $(5, 5)$ to be $81 \pm 0.5\%$.

An appropriate choice of distribution $q$ is integral to this successful story. Consider a very similar distribution $\tilde{q}$ which allows the walk to get trapped: when picking available neighbors it only avoids those that have already been visited, and stops once hitting $(m, m)$ or no more such neighbors are available (the red path in Figure \ref{fig:1}, for instance, could be sampled from $\tilde{q}$). This is a computationally convenient choice, in that any neighbor that has not been visited is an available neighbor for $\tilde{q}$, without worrying about moves that lead to trapped walks.  Since $\tilde{q}(x)=0$ implies $p(x)=0$, the importance sampling estimator $(\ref{eq:Z_hat_CSAW})$ is still valid and unbiased for $\tilde{q}$. The only difference from $q$ is that when a walk does get trapped, it contributes with zero weight to the estimator.

Despite being easier to sample from and retaining unbiasedness, this slight modification to the proposal distribution is enough to drastically upset the performance. Now, with as many as $\num[group-separator={,}]{1000000}$ simulated paths, the mean estimate is $2.14\times10^{24}$ with standard deviation $5.39 \times 10^{26}$. Estimating zero paths is well within one standard deviation of the mean!

The reason for such extreme disparity is the distribution of the importance sampling weights $\frac{1}{q(x_i)} \mathbb{I}_{[x_i \text{ is CSAW}]}$. Figure \ref{fig:boxplot_trap_notrap} shows how much more uneven the distribution of weights become when traps are allowed. Because walks routinely get trapped, many weights are just zero, and as the procedure is still unbiased, this is compensated by the appearance of enormous, albeit rare, weights. While these outliers exist in both cases, the variance of the estimator with traps is much bigger.


\begin{figure}[htbp]
 \begin{center}
 \includegraphics[width=1\textwidth]{boxplot_trap_notrap}
 \caption{Distribution of the importance sampling weights when walks that might get trapped are allowed or not; a jitter was added to the points. The red line denotes the true underlying mean; there are bigger weights in both cases, not shown here.}
 \label{fig:boxplot_trap_notrap}
 \end{center}
\end{figure}

Hence, the trapped estimator becomes close to useless due to the enormous increase in variance. Generally, this underscores the importance of good proposals $q$. In many cases, however, it is not possible to find a better proposal distribution, or sampling from it could be too computationally inefficient. For instance, for complete self-avoiding walks, detecting which moves lead to a trapped walk may not be obvious at first (see \cite{bousquet2014importance} for how to do it in the current two-dimensional case; in higher dimensions this is an open research problem). In such instances, the high variance of the traditional importance sampling estimator is too high a price to pay.

This suggests considering biased estimators, unlike (\ref{eq:importance_sampling_identity}), at the expense of drastically reduced variance. This paper investigates the simplest of such estimators: a winsorized, or censored, version of the usual importance sampling weights $Y_i = \frac{1}{q(X_i)} \mathbb{I}_{[X_i \text{ is CSAW}]} $ in (\ref{eq:importance_sampling_identity}) at levels $-M$ and $M$. 

The Balancing Principle suggests picking $M$ among a pre-chosen set $\Lambda$ by using the decision rule (\ref{lepski_rule}), with some probabilistic guarantees. For instance, suppose $\Lambda = \{10^{21}, 5\cdot 10^{23}, 10^{25}, 5\cdot 10^{26}, 10^{28}\}$. The maximum thresholding value allowed, $10^{28}$, is big enough so no random variable $Y_i$ is censored, while the minimum, $10^{21}$, censors enough to seriously bias the result (recall in this setting $\E[Y_1]\approx 1.56 \cdot 10^{24}$). The Balancing Principle considers both bias and variance when settling on one of these levels.

The improvements this method offers are significant. With a bad proposal distribution such as $\tilde{q}$, the usual importance sampling estimator has a mean-squared error (MSE) of about $2.075 \cdot 10^{49}$, while the ones winsorized with the Balancing Principle recorded only $2.437\cdot 10^{48}$, an improvement of an order of magnitude. With a good proposal distribution such as $q$, both methods are comparable, with the importance sampling MSE of $3.138 \cdot 10^{46}$ and the winsorized importance sampling MSE of $2.425 \cdot 10^{46}$. Section \ref{sec:simulations} investigates this example further, among many others.

\section{Winsorized Importance Sampling} \label{sec:truncated_IS}

Recall from Section \ref{sec:introduction} we denote $Y_i = f(X_i)p(X_i)/q(X_i)$, so the traditional importance sampling estimator and the $M$-winsorized version are respectively given by 
\begin{equation*}
\hat{\theta}_n = \frac{1}{n}\sum_{i=1}^{n} Y_i, \qquad \hat{\theta}_n^M = \frac{1}{n} \sum_{i=1}^{n} Y_i^M.
\end{equation*}
Whenever the meaning is clear from the context, the $n$ in $\hat{\theta}_n^M$ and $\hat{\theta}_n$ might be omitted.

The effectiveness of an estimator $\tilde{\theta}_n$ under squared error loss can be understood via the usual bias-variance decomposition
\begin{equation} \label{eq:bias-variance}
\E[(\tilde{\theta}_n - \theta)^2] = (\E[\tilde{\theta}_n] - \theta)^2 + \V[\tilde{\theta}_n].
\end{equation}
Winsorizing is a straightforward way to trade-off an increase in bias for a reduction in variance. As the threshold level $M$ is decreased for the winsorized estimator $\hat{\theta}^M_n$, the variance (and other central moments of higher order) lessens at the expense of a higher bias. This is proved as a lemma below.

\vspace{5mm}

\begin{lemma} \label{lemma:2}
Let $Y_1, \ldots, Y_n$ be a collection of independent and identically distributed random variables with mean $\E[Y_1] = \theta$. Denote the $M$-winsorized version of each $Y_i$ by $Y_i^M = \max(-M, \min(Y_i, M))$, for $i=1, \ldots, n$. If $\hat{\theta}_n = \frac{1}{n}\sum_{i=1}^{n} Y_i$ and $\hat{\theta}^M_n = \frac{1}{n} \sum_{i=1}^{n} Y_i^M$, then, in terms of bias,
\begin{equation*}
|\E[\hat{\theta}^M_n] - \theta| \geq |\E[\hat{\theta}_n] - \theta| = 0,
\end{equation*}
while in terms of variance
\begin{equation*}
\V[\hat{\theta}^M_n] \leq \V[\hat{\theta}_n].
\end{equation*}
That is, the winsorized estimator $\hat{\theta}^M_n$ exhibits  higher bias and lower variance than $\hat{\theta}_n$. In fact the winsorized estimator has all centered moments at least as big as the non-winsorized one.
\end{lemma}

\begin{proof}
For the bias, it is straightforward to see that $\E[\hat{\theta}_n]=\E[Y_1]=\theta$, while
\begin{equation*}
\E[\hat{\theta}^M_n] = \E[Y_1^M] = \theta + \E[Y_1^M-Y_1] = \theta + \E\left[(M-Y_1)\mathbb{I}_{[Y_1>M]} + (-M-Y_1)\mathbb{I}_{[Y_1<-M]} \right],
\end{equation*}
and so if $Y_1$ does not have a symmetric distribution centered around $0$ and $M$ is sufficiently small, it holds $|\E[\hat{\theta}^M_n] - \theta|>0$. This in turn means the estimator $\hat{\theta}^M_n$ has a higher bias.

For the variance, note $\V[\hat{\theta}_n] = \frac{1}{n}\V[Y_1]$ and $\V[\hat{\theta}^M_n] = \frac{1}{n}\V[Y_1^M]$, so it remains to be shown that $\V[Y_1^M] \leq \V[Y_1]$. Let $y^M = \max(-M, \min(y, M))$ be $M$-winsorization applied to $y$. By the convexity of $h(x)=x^p$, $p \geq 1$, for all $y \in \R$,
\begin{equation} \label{lem1eq1}
(y - \E[Y_1])^p - (y^M - \E[Y_1^M])^p \geq p (y^M - \E[Y_1^M])^{p-1} \left(y - \E[Y_1] - y^M + \E[Y_1^M]\right).
\end{equation}

Note $g(y)=y-y^M +(\E[Y^M]-\E[Y])$ is a non-decreasing function of $y$, ranging from $-\infty$ to $\infty$. Let $y_0$ be the smallest $y$ such that $g(y_0)=0$.

If $y \geq y_0$, $(y^M - \E[Y_1^M])^{p-1} \geq (y_0^M - \E[Y_1^M])^{p-1}$. Also, $g(y) \geq 0$, so $(y - \E[Y_1]-y^M+\E[Y_1^M]) \geq 0$. Thus,
\begin{equation} \label{eq:y_to_p_convexity}
(y - \E[Y_1])^p - (y^M - \E[Y_1^M])^p \geq p (y_0^M - \E[Y_1^M])^{p-1} (y - \E[Y_1]-y^M + \E[Y_1^M]).
\end{equation}
If $y< y_0$, $(y^M - \E[Y_1^M])^{p-1} < (y_0^M - \E[Y_1^M])^{p-1}$, but also $0 > g(y) = y - \E[Y_1] -y^M +\E[Y_1^M]$, so again (\ref{eq:y_to_p_convexity}) holds.

Thus, as (\ref{eq:y_to_p_convexity}) holds for all $y \in \R$, take expectations over $y$ on both sides to obtain 
\begin{equation*}
\E\left[(Y - \E[Y_1])^p\right] - \E\left[(Y^M - \E[Y_1^M])^p \right] \geq 0.
\end{equation*}

With $p=2$, this is just
\begin{equation*}
\V[Y_1] = \E[(Y_1 - \E[Y_1])^2] \geq \E[(Y_1^M - \E[Y_1^M])^2] = \V[Y_1^M],
\end{equation*}
and higher values of $p$ give the inequality for other centered moments. This argument can be generalized further to non-symmetric forms of winsorization and conditional expectations, see \cite{chow1969}.
\end{proof}

As a straightforward corollary, winsorizing a symmetric random variable $Y_i$ around the actual mean $\E[Y_i]$ is always be beneficial, as the variance is reduced without an increase in bias. Since the mean is assumed unknown, however, this cannot be turned to a practical recommendation.

How to select an appropriate level $M$? If the actual bias and variance incurred by the importance sampling estimator, $|\E[\hat{\theta}_n^M] - \theta|$ and $\V[\hat{\theta}_n^M]$, were known, one could pick the thresholding level to exactly balance out the increasing effects winsorizing has on the bias and the decreasing effects it has on the variance. Similarly, one could consider using the sample versions of these quantities: to choose between two thresholding levels $M'>M''$, if the increase in bias $|(\frac{1}{n}\sum_{i=1}^{n}Y_i^{M'}- \theta)-(\frac{1}{n}\sum_{i=1}^{n}Y_i^{M''}-\theta)|$ is small enough relative to the standard error, then it might be worth winsorizing the sample at the lower level $M''$.

While this is a seemingly reasonable approach, it is by no means guaranteed to work. In particular, such a method would require estimating the standard deviation in a setting where estimating the mean is hard enough already. To make this idea useful, an actual procedure to determine the optimal threshold level is needed, as well as theoretical guarantees that the error of such a procedure do not grow too large. This will be developed next.

\section{Balancing Theorem} \label{sec:balancing_theorem}

This section states and proves the Balancing Theorem, the main theoretical tool delivering finite-sample optimality guarantees when winsorizing importance sampling. The idea, related to oracle inequalities, is to pick one threshold level $M_*$ among a finite, pre-chosen set of them, while ensuring an error of at most a constant away from the error roughly incurred by the optimal choice $M_*$. This general scheme is known by many names, including the Balancing Principle and Lepski's Method.

Consider estimators $\hat{E}^M$ of $\theta$, indexed by a parameter $M$ in a finite set $\Lambda \subset \R$, and assume the bound $|\hat{E}^M - \theta|\leq b(M)+\hat{s}(M)$ for all $M \in \Lambda$, where $b(M)$ is an unobserved but non-increasing function in $M$, and $\hat{s}(M)$ is observed but non-decreasing. The goal is a selection rule to pick $M_*$ such that $|\hat{E}^{M_*} - \theta| \leq C \min_{M \in \Lambda}\left\{b(M)+\hat{s}(M)\right\}$, with a small constant $C$. In the case of interest, $\hat{E}^M$ will denote the importance sampling estimator when winsorizing the sample at $M$, while $b(M)$ and $\hat{s}(M)$ will be taken as proportionals to its bias and sample standard deviation. 


\vspace{5mm}

\begin{theorem}[Balancing Theorem]
Suppose $\theta \in \R$ is an unknown parameter, $\{\hat{E}^M\}_{M \in \Lambda}$ is a sequence of estimators of $\theta$ indexed by $M \in \Lambda \subset \R$, with $\Lambda$ a non-empty finite set. Additionally, suppose that $|\hat{E}^M - \theta| \leq b(M)+\hat{s}(M)$ for each $M \in \Lambda$, where $b(M)$ is an unknown but non-increasing function in $M$, while $\hat{s}(M)>0$ is observed and non-decreasing in $M$. Choose $c>2$, and take
\begin{equation} \label{eq:balancing_theorem}
 M_* = \min\left\{M \in \Lambda : \forall M', M'' \text{ with } M', M'' \geq M, \ |\hat{E}^{M'}-\hat{E}^{M''}| \leq c
 \left(\frac{\hat{s}(M')+\hat{s}(M'')}{2}\right)\right\}.
\end{equation}
Then,
\begin{equation} \label{eq:balancing_theorem_conclusion}
 |\hat{E}^{M_*}-\theta| \leq C \min_{M \in \Lambda} \left\{b(M)+\hat{s}(M)\right\},
\end{equation}
where $C=C(c)$ can be made less than 4.25.
\end{theorem}

\begin{proof}
First, note $\max\left\{M: M \in \Lambda\right\}$ is always a candidate for $M_*$, so it is well defined. The goal is to show there exists $C \geq 0$ such that, for all $M \in \Lambda$, $|\hat{E}^{M_*}-\theta| \leq C(\hat{s}(M)+ b(M))$. For this consider two cases.
 
\vspace{5mm}
 
(i) First, consider any fixed $M$ such that $M>M_*$. Then, by definition of $M_*$, and since $\hat{s}(M)$ is non-decreasing in $M$,
\begin{equation*}
 |\hat{E}^{M_*}-\hat{E}^{M}| \leq c \cdot \left(\frac{\hat{s}(M)+\hat{s}(M_*)}{2}\right) \leq c\hat{s}(M).
\end{equation*}
Also, by assumption $|\hat{E}^{M}-\theta|\leq b(M)+ \hat{s}(M)$, so, from the triangle inequality,
\begin{equation*}
|\hat{E}^{M_*}-\theta| \leq |\hat{E}^{M_*}-\hat{E}^{M}| + |\hat{E}^{M}-\theta| \leq c\hat{s}(M) + b(M) + \hat{s}(M) \leq b(M)+\left(1+c\right)\hat{s}(M).
\end{equation*}
This proves the case $M>M_*$.

\vspace{5mm}

(ii) Now suppose $M<M_*$. In that case, since $\Lambda$ is finite, consider the sequence of elements in $\Lambda$ in between, namely $M=M_i<M_{i+1}<\cdots<M_{j-1}<M_j=M_*$. Then, there exist $M', M'' \geq M_{j-1}$ such that $|\hat{E}^{M'}-\hat{E}^{M''}| > c (\hat{s}(M')+\hat{s}(M''))/2$, where either $M'=M_{j-1}$ or $M''=M_{j-1}$ (otherwise, this contradicts the minimality of $M_*$). Without loss of generality, assume $M''=M_{j-1}$. Note this implies $M' \geq M_*$, otherwise $M'=M_{j-1}$ gives a contradiction: $0=|\hat{E}^{M'}-\hat{E}^{M''}|>c(\hat{s}(M')+\hat{s}(M''))/2>0$. Hence,
\begin{equation} \label{eq7}
 |\hat{E}^{M'}-\hat{E}^{M_{j-1}}| = |\hat{E}^{M'}-\hat{E}^{M''}| > c \left(\frac{\hat{s}(M')+\hat{s}(M'')}{2}\right).
\end{equation}
Also, by the triangle inequality,
\begin{equation} \label{eq8}
 |\hat{E}^{M_{j-1}} - \hat{E}^{M'}| \leq |\hat{E}^{M_{j-1}}-\theta| + |\hat{E}^{M'}-\theta| \leq \left(b(M_{j-1})+b(M')\right) + \left(\hat{s}(M_{j-1})+\hat{s}(M')\right),
\end{equation}
so, combining (\ref{eq7}) and (\ref{eq8}) yields
\begin{align}
c \left(\frac{\hat{s}(M')+\hat{s}(M'')}{2}\right) &< |\hat{E}^{M_{j-1}}-\hat{E}^{M'}| \leq \left(b(M_{j-1})+b(M')\right) + \left(\hat{s}(M_{j-1})+\hat{s}(M')\right). \label{eq9}
\end{align}
Recall that $M' \geq M_* \geq M_{j-1} \geq M$, so 
\begin{align} \label{eq10}
 b(M') \leq b(M_*) &\leq b(M_{j-1}) \leq b(M) \\
 \hat{s}(M') \geq \hat{s}(M_*) &\geq \hat{s}(M_{j-1}) \geq \hat{s}(M),
\end{align}
so from (\ref{eq9})
\begin{equation*}
\left(\frac{c}{2}-1\right)(\hat{s}(M')+\hat{s}(M_{j-1}))  \leq b(M_{j-1}) + b(M')
\stackrel{(\ref{eq10})}{\leq} 2 \ b(M),
\end{equation*}
and, because $c>2$ and $\hat{s}(M_{j-1})>0$,
\begin{equation} \label{eq:bound_on_s_by_b}
\hat{s}(M') \leq \frac{4}{c-2} b(M).
\end{equation}
Finally,
\begin{equation*}
|\hat{E}^{M_*}-\theta| \leq b(M_*) + \hat{s}(M_*) \stackrel{(\ref{eq10})}{\leq} b(M) + \hat{s}(M') \stackrel{(\ref{eq:bound_on_s_by_b})}{\leq} \left(1+\frac{4}{c-2}\right)b(M),
\end{equation*}
which implies
\begin{equation*}
 |\hat{E}^{M_*} - \theta| \leq \left(1 + \frac{4}{c-2}\right)\left(b(M) + \hat{s}(M)\right),
\end{equation*}
so the second case is proved. Note $C(c) \geq \max_{c>2} \left\{c+1, 1+4/(c-2)\right\}$. If $c=1+\sqrt{5}$, then $C=2+\sqrt{5} < 4.25$.
\end{proof}

\vspace{5mm}

Some remarks about the theorem are collected below.

First, with $n$ datapoints and $k=|\Lambda|$ possible truncation values, the number of operations is $O(k\cdot (k+n))$. To see this, note $M_*$ can be obtained by first ordering the threshold values, initializing $M_* = \max \Lambda$, and decreasing $M_*$ while the condition in (\ref{eq:balancing_theorem}) is satisfied. See Algorithm \ref{alg:balancing_theorem}. Sorting the $k$ values takes $O(k \log(k))$, calculating sample means and variances takes $O(kn)$ and there are $O(k^2)$ comparisons to be made. One can adapt the procedure to be of order $O(kn)$ by only considering the condition in line \ref{alg:while_line} of Algorithm \ref{alg:balancing_theorem} for $j=i+1$, but this increases $C$ by a multiplicative factor of $|\Lambda|$.

Also, while the size of $\Lambda$ is not relevant to the guarantees of the Balancing Theorem, it is clear from the previous paragraph that finding $M_*$ becomes harder.

The condition in (\ref{eq:balancing_theorem}) for decreasing the threshold value from $M'$ to $M''$ can be written as $|\hat{E}^{M'}- \hat{E}^{M''}|\leq c \cdot \Phi(\hat{s}(M'), \hat{s}(M''))$, with $\Phi(\hat{s}(M'), \hat{s}(M'')) = (\hat{s}(M')+\hat{s}(M''))/2$. The proof also holds for other functionals $\Phi(\hat{s}(M'), \hat{s}(M''))$. For example, take $\Phi(\hat{s}(M'), \hat{s}(M'')) = \max\{\hat{s}(M'), \hat{s}(M'')\}$. In fact, this gives an even better constant, namely $C=2+\sqrt{3}$ instead of $2+\sqrt{5}$. However, this comes at the expense of making the procedure winsorize more aggressively. Empirically, $\Phi(\hat{s}(M'), \hat{s}(M'')) = (\hat{s}(M')+\hat{s}(M''))/2$ seems a more robust alternative.

\begin{algorithm}
\caption{Balancing Theorem}\label{alg:balancing_theorem}
\begin{algorithmic}[1]
\Procedure{Balancing\_Theorem}{$\left\{y_i\right\}_{i=1}^n$, $\Lambda$, $c=1+\sqrt{5}$}
\State sort the elements in $\Lambda$ to obtain $M_{(1)} \leq M_{(2)} \leq \cdots \leq M_{(k)}$
\State initialize $M_* := M_{(k)}$; $i := k-1$
\While{$|\hat{E}^{M_{(i)}}-\hat{E}^{M_{(j)}}| \leq c(\hat{s}(M_{(i)})+\hat{s}(M_{(j)}))/2$, for $j = i+1, \ldots, k$} \label{alg:while_line}
\If{$i=1$}
\textbf{return} $M_{(i)}$
\EndIf
\State $M_* := M_{(i)}$
\State $i:= i-1$
\EndWhile
\State \textbf{return} $M_*$
\EndProcedure
\end{algorithmic}
\end{algorithm}

Finally, consider the choices for the functions $b(M)$ and $\hat{s}(M)$ in the importance sampling setting. Let $Y_i = f(X_i)p(X_i)/q(X_i)$ denote the usual importance sampling weights, and take $\hat{E}^M$ to be the usual estimator when winsorizing the sample at $M$, that is, 
\begin{equation*}
\hat{E}^M = \overline{Y^M} = \frac{1}{n} \sum_{i=1}^{n} Y_i^M.
\end{equation*}
The goal is to choose $M_* \in \Lambda$ to balance both the bias and the variance of the estimator, and obtain an estimate $\hat{E}^{M_*} = \overline{Y^{M_*}}$. Thus, it makes sense to take 
\begin{align} \label{eq:b_bias}
b(M) & =\bias(M)= |\E[Y_1^M]-\E[Y_1]|, \\ \label{eq:s_std}
\hat{s}(M) &= \frac{t}{\sqrt{n}-t} \hat{\sigma}^M,
\end{align}
with $t \in \R$ a constant, $t < \sqrt{n}$, and $\hat{\sigma}^M = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \overline{Y^M})^2}$. The reason for the factor $t/(\sqrt{n}-t)$ is discussed in the next section. For now, note the theorem gives a natural bound on $|\overline{Y^{M_*}} - \theta|$, controlling it by both bias and a multiple of the sample standard deviation. Recall the sum of bias and standard deviation is connected to the squared error risk via (\ref{eq:bias-variance}).

With the choices $(\ref{eq:b_bias})$ and $(\ref{eq:s_std})$, picking a scale $t$ amounts to implicitly setting how much to weight the importance of bias versus variance. For example, if $t=0$ then $\hat{s}(M)\equiv 0$, and the procedure always selects the threshold $M_* = \max \Lambda$, so it censors the data as little as possible. This is a consequence of weighting bias infinitely more than variance. The scale $t$ is also important in a more subtle way. The Balancing Theorem assumes
\begin{equation}  \label{eq:balancing_thm_hypotheses}
|\hat{E}^M - \theta| \leq b(M)+\hat{s}(M), \quad \forall M \in \Lambda,
\end{equation}
and since $\overline{Y^M}$ and $\hat{\sigma}^M$ are random, this can only hold probabilistically. Higher values of $t$ make these hypotheses more likely, but the conclusion of the theorem less useful.

Showing $(\ref{eq:balancing_thm_hypotheses})$ requires some knowledge about the underlying distribution of $Y_1, \ldots, Y_n$. To obtain tight bounds on $P[|\overline{Y^M} - \theta|>\bias(M) + t \hat{\sigma}^M/(\sqrt{n}-t)]$, a Central Limit Theorem-type argument can be used, as shown in the next section.


\section{Probabilistic bounds} \label{sec:probabilistic_bounds}

The main goal of this section is to bound the probability that $|\overline{Y^M} - \theta| \leq \bias(M)+t \hat{\sigma}^M/(\sqrt{n}-t)$ holds for all $M$, as a function of the sample size $n$ and the number of threshold values considered $|\Lambda|$. This provides a full proof of Theorem \ref{thm:1} and establishes the conditions under which the guarantees of the Balancing Theorem hold in the importance sampling setting. The strengths and weaknesses of the proposed method are then discussed.

In the interest of generality, no assumptions on the distribution of the weights $Y_i$ are made, other than the existence of a mean, $\E[Y_1]< \infty$. However, a large sample size may be needed for the Balancing Theorem to hold with high probability under such a lax moment hypothesis.

In terms of the truncation levels, assume $M$ is chosen in a data-independent manner. This is not crucial, as long as there is a probabilistic bound for the data-dependent choice of $M$. For instance, the case of no truncation, $M= \max_{1\leq i \leq n}Y_i$, can be considered if there are bounds on the distribution of $Y_i$. In particular,
the existence of a second moment gives a bound via Chebyshev's inequality, and higher-order moments give even finer control. In terms of data-independent values, $M=\sqrt{n}$, as suggested in \cite{ionides2008truncated} following asymptotic considerations, can always be included.

Also, let $K > 0$ be such that $\E[|Y_i^{M} - \E[Y_1^{M}]|^3] < K (\V[Y_i^M])^{3/2}$, so the variance of the winsorized sample can be bounded in terms of the third absolute moment. In a setting where the variance of $Y_i$ is so large, or even infinite, that winsorizing the terms are worth considering, $K$ is not expected to be too large. In particular, the bound is implied by the condition $\V[Y_i^{M}] \geq \alpha M^2$, for $\alpha \in (0, 1)$, since
\begin{equation*}
	\E[|Y_i^{M} - \E[Y_1^{M}]|^3] \leq 2^2 (\E[|Y_i^{M}|^3] + (\E[|Y-1^M|])^3) \leq 8 M^3 = \frac{8}{\alpha^{3/2}} \alpha^{3/2} M^3 \leq \frac{8}{\alpha^{3/2}} (\V[Y_i^M])^{3/2}.
\end{equation*}

To upper bound $P[|\overline{Y^M} - \theta| > \bias(M)+t \hat{\sigma}^M/(\sqrt{n}-t)]$, the argument proceeds by first showing via a Central Limit Theorem-type argument that, for all $M\in \Lambda$,
\begin{equation*}
P\left[|\overline{Y^M} - \E[Y_1]| \leq \bias(M) + t \hat{\sigma}^M/(\sqrt{n}-t)\right] \geq 1 - 2(1 - \Phi(t)) + \text{error}(t, n, M).
\end{equation*}
and then using a Berry-Esseen bound on the $t$-statistic to give precise bounds on the error.


\subsection{Using the Central Limit Theorem} \label{sec:using_CLT}

Since $\{Y_i^M\}$ are iid with finite mean and variance, by the usual Central Limit Theorem,
\begin{equation*}
 P\left[\frac{\sqrt{n}| \frac{1}{n}\sum_{i=1}^{n}Y_i^M-\E[Y_1^M]|} {\sqrt{\E[(Y_1^M - \E[Y_1^M])^2]}} \geq t \right]\stackrel{n \to \infty}{\longrightarrow} 2\left(1-\Phi(t)\right).
\end{equation*}

Using the Strong Law of Large Numbers and the Continuous Mapping Theorem, 
\begin{equation*}
 \frac{\sqrt{\E[(Y_1^M - \E[Y_1^M])^2]}}{\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \E[Y_1^M])^2}} \stackrel{as, p}{\longrightarrow} 1.
\end{equation*}

Hence, by Slutsky's Theorem and the Central Limit Theorem,
\begin{align*}
 \lim_{n \to \infty} & P\left[ \left| \frac{1}{n} \sum_{i=1}^{n} Y_i^M - \E[Y_1^M] \right| \geq \frac{t}{\sqrt{n}}\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \E[Y_1^M])^2}\right] = 2(1 - \Phi(t)).
\end{align*}

Call $\Delta^M = \frac{1}{n}\sum_{i=1}^{n}Y_i^M-\E[Y_1^M]$, so the equation above reads
\begin{equation} \label{eq1}
P\left[|\Delta^M| \geq \frac{t}{\sqrt{n}}\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \E[Y_1^M])^2}\right] \stackrel{n \to \infty}{\longrightarrow} 2(1-\Phi(t)).
\end{equation}


Rewrite
\begin{equation} \label{eq4}
\frac{1}{n} \sum_{i=1}^{n} (Y_i^M-\E[Y_1^M])^2 = \left(\frac{1}{2n^2} \sum_{i, j=1}^{n}(Y_i^M - Y_j^M)^2\right) + \left(\left(\frac{1}{n}\sum_{i=1}^{n}Y_i^M - \E[Y_1^M]\right)^2\right).
\end{equation}

Since
\begin{align*}
 \frac{1}{2n^2} \sum_{i, j=1}^{n}(Y_i^M - Y_j^M)^2 &= \frac{1}{2n^2} \sum_{i, j=1}^{n} (Y_i^M - \overline{Y^M} -(Y_j^M - \overline{Y^M}))^2 \\
 &= \frac{1}{n} \sum_{i=1}^{n} (Y_i^M - \overline{Y^M})^2 - \frac{1}{n^2} \sum_{i, j=1}^{n} (Y_i^M - \overline{Y^M})(Y_j^M - \overline{Y^M}) \\
 &= \frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \overline{Y^M})^2 = (\hat{\sigma}^M)^2,
\end{align*}
the right-hand side of (\ref{eq4}) is just $(\hat{\sigma}^M)^2 + (\Delta^M)^2$. Putting this in (\ref{eq1}) and using the AM-GM inequality, with limiting probability $1- 2(1- \Phi(t))$,
\begin{equation*}
 |\Delta^M| \leq \frac{t}{\sqrt{n}} \sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \E[Y_1^M])^2} = \frac{t}{\sqrt{n}} \sqrt{(\hat{\sigma}^M)^2 + (\Delta^M)^2} \leq \frac{t}{\sqrt{n}} (\hat{\sigma}^M + |\Delta^M|),
\end{equation*}
or, under the assumption $\sqrt{n}>t$, note $|\Delta^M|\cdot \left(1 - \frac{t}{\sqrt{n}}\right)\leq \hat{\sigma}^M \frac{t}{\sqrt{n}}$. Putting it all together,
\begin{equation} \label{eq5}
\lim_{n \to \infty} P\left[|\Delta^M| \leq \frac{t}{\sqrt{n}-t}\hat{\sigma}^M\right] \geq 1 - 2(1-\Phi(t)).
\end{equation}

Above, a concentration bound for $\Delta^M = \frac{1}{n}\sum_{i=1}^{n}Y_i^M - \E[Y_1^M]$ was obtained, but in reality the object of interest is to bound the error incurred by the winsorized estimator, namely
\begin{equation*}
\frac{1}{n} \sum_{i=1}^{n} Y_i^M - \E[Y_1] = \frac{1}{n} \sum_{i=1}^{n} Y_i^M - \E[Y_1^M] + \left(\E[Y_1^M] - \E[Y_1]\right).
\end{equation*}

From (\ref{eq5}) and the reverse triangle inequality,
\begin{align} \label{eq6}
& \lim_{n\to\infty} P\left[\left|\frac{1}{n} \sum_{i=1}^{n} Y_i^M - \E[Y_1]\right| \leq |\E[Y_1^M] - \E[Y_1]| + \frac{t}{\sqrt{n}-t}\hat{\sigma}^M\right] \\
 &\hspace{2em}\geq \lim_{n \to \infty} P\left[\left|\frac{1}{n}\sum_{i=1}^{n} Y_i^M - \E[Y_1^M]\right| \leq \frac{t}{\sqrt{n}-t} \hat{\sigma}^M\right] \geq 1 - 2(1- \Phi(t)). \label{eq14}
\end{align}

Hence, calling $\bias(M) = |\E[Y_1^M]-\E[Y_1]|$, the inequality reads
\begin{equation*}
P\left[|\overline{Y^M} - \E[Y_1]| \leq \bias(M) + \frac{t}{\sqrt{n}-t}\right] \geq 1 - 2(1 - \Phi(t)) + \text{error}(t, n, M).
\end{equation*}


\subsection{Using a Berry-Esseen bound for the $t$-statistic} \label{sec:Berry-Esseen}

Now, finite-sample bounds on the error above are needed so that, for each $M$, $t$ (and possibly $n$) can be chosen to ensure that, with some pre-specified probability $1-\delta$, it holds that $|\overline{Y^M} - \E[Y_1]| \leq \bias(M)+t \hat{\sigma}^M/(\sqrt{n}-t)$.

To this end, define the demeaned random variables
\begin{equation*}
Z_i = Y_i^M - \E[Y_1^M],
\end{equation*}
and rewrite (\ref{eq14}) in terms of $Z_i$ to obtain
\begin{align}
P & \left[\bigg| \frac{1}{n} \sum_{i=1}^{n} Y_i^M - \E[Y_i^M] \bigg| \leq \frac{t}{\sqrt{n}-t} \hat{\sigma}^M\right] \\
&= P\left[\bigg|\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \E[Y_1^M])\bigg| \leq \frac{t}{\sqrt{n}-t}\sqrt{\frac{1}{n}\sum_{i=1}^{n}\left((Y_i^M - \E[Y_1^M])-(\overline{Y^M}-\E[Y_1^M])\right)^2}\right]\\
&= P\left[|\bar{Z}|\leq \frac{t}{\sqrt{n}-t} \sqrt{\frac{1}{n}\sum_{i=1}^{n}(Z_i-\bar{Z})^2}\right]
= P\left[\Bigg|\frac{\sqrt{n}\bar{Z}}{\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Z_i-\bar{Z})^2}}\Bigg| \leq \frac{\sqrt{n}t}{\sqrt{n}-t}\right]. \label{eq16}
\end{align}

There exist Berry-Esseen bounds for the self-normalized sum $\sum_{i=1}^{n}Z_i/\sqrt{\sum_{i=1}^{n}Z_i^2}$, so rewrite the statistic above as
\begin{align*}
\frac{\sqrt{n}\bar{Z}}{\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Z_i-\bar{Z})^2}} &= \frac{\sqrt{n}\frac{1}{n}\sum_{i=1}^{n}Z_i}{\sqrt{\frac{1}{n}\sum_{i=1}^{n}Z_i^2 - \frac{1}{n^2}(\sum_{i=1}^{n}Z_i)^2}}  = \frac{\frac{\sum_{i=1}^{n}Z_i}{\sqrt{\sum_{i=1}^{n}Z_i^2}}}{\sqrt{1 - \frac{1}{n}\left(\frac{\sum_{i=1}^{n}Z_i}{\sqrt{\sum_{i=1}^{n}Z_i^2}}\right)^2}} = h\left(\frac{\sum_{i=1}^{n}Z_i}{\sqrt{\sum_{i=1}^{n}Z_i^2}}\right),
\end{align*}
where $h(z)=z/\sqrt{1-z^2/n}$ is a monotonic function of the self-normalized sum.

To simplify the notation, call
\begin{equation*}
\tilde{S} = \frac{\sum_{i=1}^{n}Z_i}{\sqrt{\sum_{i=1}^{n}Z_i^2}}, \qquad
S = h(\tilde{S}) = \frac{\sqrt{n}\bar{Z}}{\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Z_i- \bar{Z})^2}}.
\end{equation*}
A finite sample bound for $S$ in (\ref{eq16}) can be obtained in terms of $\tilde{S}$. Indeed, note
\begin{align*}
P[S\leq z] &= P\left[\tilde{S} \leq \frac{z}{\sqrt{1+z^2/n}}\right].
\end{align*}

Due to winsorizing, $\E[Z_i^2] < \infty$, and so the self-normalized Berry-Esseen inequality of \cite{shao2005explicit} yields:
\begin{align*}
\bigg|P[S\leq z] - \Phi\left(\frac{z}{\sqrt{1+z^2/n}}\right)\bigg| &= \bigg|P\left[\tilde{S}\leq \frac{z}{\sqrt{1+z^2/n}}\right] - \Phi\left(\frac{z}{\sqrt{1+z^2/n}}\right)\bigg| \\
&\leq 25 \sum_{i=1}^{n} \E[|Z_i|^3] \frac{1}{\left(\sqrt{\sum_{i=1}^{n}\E[Z_i^2]}\right)^3}.
\end{align*}

Using the bound on the third moment, $\E[|Z_i|^3] \leq K (\E[Z_i^2])^{3/2}$, so
\begin{align*}
\bigg| P[S\leq z] - \Phi\left(\frac{z}{\sqrt{1+z^2/n}}\right) \bigg| \leq \frac{25 \sum_{i=1}^{n} \E[|Z_i|^3]}{\left(\sqrt{\sum_{i=1}^{n}\E[Z_i^2]}\right)^3} \leq \frac{25 K n }{n^{3/2}} = \frac{25 K}{\sqrt{n}}.
\end{align*}

In terms of the original variables,
\begin{align*}
P\left[\bigg|\frac{1}{n}\sum_{i=1}^{n}Y_i^M - \E[Y_1^M]\bigg| \leq \frac{t}{\sqrt{n}-t} \hat{\sigma}^M\right] &= P\left[|S| \leq \frac{\sqrt{n}t}{\sqrt{n}-t}\right] = P\left[|\tilde{S}| \leq \frac{\frac{\sqrt{n}t}{\sqrt{n}-t}}{\sqrt{1+\frac{1}{n}\left(\frac{\sqrt{n}t}{\sqrt{n}-t}\right)^2}}\right]\\
&= P\left[|\tilde{S}|\leq t \sqrt{\frac{n}{(\sqrt{n}-t)^2 + t^2}}\right] \\
&\geq 1-2\left(1- \Phi\left(t \sqrt{\frac{n}{(\sqrt{n}-t)^2+t^2}}\right)\right) - 2\frac{25 K}{\sqrt{n}} \\
& \stackrel{n \to \infty}{\longrightarrow} 1- 2(1-\Phi(t)).
\end{align*}

Finally, by using a union bound over all the $M_j$, it is possible to select $t_{M_j}$ (and possibly $n_{M_j}$), $j=1, \ldots, k$, to ensure that 
\begin{equation*}
 P\left[|\overline{Y^{M_j}} - \E[Y_1]| \leq \bias(M_j)+t_{M_j} \hat{\sigma}^M/(\sqrt{n_{M_j}}-t_{M_j}), \ j=1, \ldots, k\right] \geq 1 - \delta.
\end{equation*}
For example, with constant values of $t$ and $n$ for all truncation levels $M_j$, and assuming $\E[|Y_i^{M_j} - \E[Y_1^{M_j}]|^3] < K (\V[Y_i^{M_j}])^{3/2}$ for all $j=1, \ldots, k$,
\begin{equation} \label{eq:delta}
\delta = 2|\Lambda|\left(1+ 2 \cdot \frac{25 K}{\sqrt{n}} - \Phi\left(t \sqrt{\frac{n}{(\sqrt{n}-t)^2+t^2}}\right)\right).
\end{equation}

\vspace{5mm}

Unfortunately, a large value of $n$ is needed to obtain a useful bound, on the order of at least $10^8$. On the other hand, this value is likely overly conservative since both the union bound and the Berry-Esseen bound are generally very loose in practice. Indeed, the simulations in Section \ref{sec:simulations} show that good results may still be achieved with smaller samples sizes.

Any value for $t$ can be picked, and it is clear that larger $t$ makes the bound more likely. The price to pay, however, is that the bound $(\ref{eq:balancing_theorem_conclusion})$ becomes less meaningful, since the standard deviation is multiplied by a larger quantity. Also, as a consequence, the procedure overvalues the standard deviation over bias, and becomes more prone to winsorizing. 

\subsection{Putting it all together}

From the Balancing Theorem, as long as $|\overline{Y^M} - \E[Y_1]| \leq \bias(M)+t \hat{\sigma}^M/(\sqrt{n}-t)$ holds for all $M \in \Lambda$, then $|\overline{Y^{M_*}} - \E[Y_1]| \leq C \min_{M \in \Lambda} \left\{\bias(M) + t \hat{\sigma}^M/(\sqrt{n}-t)\right\}$, with $M_*$ picked as in $(\ref{eq:balancing_theorem})$. The calculations in Section \ref{sec:Berry-Esseen} show that, under the assumption $\E[|Y_i^{M_j} - \E[Y_1^{M_j}]|^3] < K (\V[Y_i^{M_j}])^{3/2}$ for $j=1, \ldots, k$, the hypothesis of the Balancing Theorem holds with probability $1- \delta$, with $\delta$ defined in $(\ref{eq:delta})$.
Hence, putting it all together, Theorem \ref{thm:1} is proved, and reproduced below for convenience.

\begin{theorem} \label{thm:4}
Let $\left\{Y_i\right\}_{i=1}^n$ be random variables distributed iid with mean $\theta$. Consider winsorizing $Y_i$ at different threshold levels in a pre-chosen set $\Lambda=\{M_1, \ldots, M_k\}$ to obtain winsorized samples $\{Y_i^{M_j}\}_{i=1}^n$, $j=1, \ldots, k$. Pick the threshold level according to the rule
\begin{equation} \label{eq:lepski_rule_2}
M_* = \min\left\{M \in \Lambda \ : \ \forall M', M'' \geq M, \quad  |\overline{Y^{M'}}-\overline{Y^{M''}}| \leq c \cdot \frac{t}{\sqrt{n}-t} \cdot \left(\frac{\hat{\sigma}^{M'}+\hat{\sigma}^{M''}}{2}\right)\right\},
\end{equation}
where $c, t$ are chosen constants, $t < \sqrt{n}$, $\overline{Y^M} = \frac{1}{n}\sum_{i=1}^{n}Y_i^M$ and $\hat{\sigma}^{M}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(Y_i^M - \overline{Y^M})^2}$. 
Let $K>0$ be such that $\E[|Y_i^{M_j} - \E[Y_i^{M_j}]|^3] \leq K (\V[Y_i^{M_j}])^{3/2}$ for all $j$. Then, with probability
\begin{equation*}
1 - 2|\Lambda|\left(1 + \frac{50K}{\sqrt{n}}-\Phi\left(t \sqrt{\frac{n}{(\sqrt{n}-t)^2+t^2}}\right)\right),
\end{equation*}
it holds
\begin{equation} \label{eq:optimal_error}
|\overline{Y^{M_*}}-\theta| \leq C \min_{M \in \Lambda}\left\{|\E[Y_i^M]-\theta| +  \frac{t}{\sqrt{n}-t}\hat{\sigma}^M\right\},
\end{equation}
where $C=C(c)$ can be made less than $4.25$.
\end{theorem}

\subsection{Strengths and weaknesses} \label{subsec:strengths_and_weaknesses}

In this subsection, the strengths and weaknesses of the proposed method are discussed. First, consider the weaknesses, along with possible fixes.
\begin{itemize}
\item The pre-chosen set of threshold values $\Lambda$ is very important for the method to work well, and there is no theoretical guidance as to how to set it. Including extremely high or low threshold values can nudge the procedure towards over- or under-winsorizing, and simply scaling the values in $\Lambda$ can make condition (\ref{eq:balancing_theorem}) more or less likely to fail. A conservative proposal is to pick a sequence of exponentially decreasing weights, starting from a high value that encourages little to no winsorizing (see also \cite{mathe2006lepskii}).

\item Only winsorizing the sample around $0$ has been considered. Although it is easy to generalize the method to non-symmetric endpoints $M_a, M_b$ instead of $-M, M$, it is not clear how to set them, since the sample mean is an unreliable estimate. Still, if $f(x)>0$, as is the case with the self-avoiding walks in Section \ref{sec:introduction}, winsorizing around $0$ forcibly biases the estimator. Alternative methods (e.g., using some of the data for a preliminary mean estimate around which to winsorize) require extra distributional information to enforce the same theoretic guarantees. 

\item In a setting where finding the mean is hard, the sample standard deviation can be a poor estimator of the standard deviation. On the other hand, other functions $\hat{s}(M)$ can be used, as long as they are observed and non-decreasing. This might make the hypotheses of the Balancing Theorem harder to prove and the conclusion less relevant. 

\item The upper bound $|E^{M_*} - \theta| \leq C \min_{M \in \Lambda}\left\{\hat{s}(M)+\bias(M)\right\}$, while useful to ensure the price to pay in either bias or variance is not too high, might still be loose enough so that it doesn't confer advantages over the usual importance sampling estimator.

\item A sample size $n > 10^8$, necessary for the optimality guarantees to hold with reasonable probability, is considered large in many settings. As mentioned above, however, this is overly conservative.

\item The method seems too aggressive, in that even if the sample bias increases relative to the sample variance, it might still recommend winsorizing. This suggests trying to relax condition (\ref{eq:lepski_rule_2}) to a more natural $|\hat{E}^{M'} - \hat{E}^{M''}| \leq c |\hat{s}(M')-\hat{s}(M'')|$.

\item Finally, the censoring imposed by winsorizing might be too harsh a cutoff. Methods that rely on soft-thresholding could perform much better and rely less on the threshold level $M_*$ chosen.
\end{itemize}


Now, consider the strengths of winsorizing importance sampling using the Balancing Theorem. 
\begin{itemize}
\item First and foremost, the theorem gives an effective, principled way to perform winsorization, along with finite-sample guarantees.
\item The user is allowed to encode some prior information about the problem via the choice of possible threshold values. The method works even if the values are picked in a data-dependent manner (as long as there is distributional information to obtain new probability bounds akin to those of Section \ref{sec:Berry-Esseen}).
\item The method performs well empirically, censoring little in settings where the usual importance sampling estimator does well, and censoring more when it doesn't. It seems to outperform the usual importance sampling estimator in a variety of cases, and compares well to picking a threshold level based on cross-validation, which is a much more computationally intensive procedure. See Section \ref{sec:simulations}.
\item In spite of Algorithm \ref{alg:balancing_theorem} being of quadratic order, it usually works quickly, particularly since it does not have to consider all thresholding levels and winsorizing is a fast operation. There is a linear-time algorithm also based on the Balancing Theorem, resulting in a worse theoretical bound, but similar empirical performance.
\item The underlying idea in the Balancing Theorem generalizes to many other problems in Statistics where there is a bias-variance trade-off indexed by a parameter choice.
\end{itemize}


\section{Simulations} \label{sec:simulations} \indent

In this section, examples with real and synthetic data are used to evaluate the method's performance. Below, the winsorized importance sampling procedure with threshold levels picked via the Balancing Theorem is dubbed \emph{balanced importance sampling}. First, slightly modified versions of the four synthetic examples in \cite{vehtari2015pareto} are considered, as well as a mixture example, and then the self-avoiding walk problem discussed in Section \ref{sec:SAW} is analyzed.

In the examples, the balanced importance sampling estimator is compared to two others: the usual importance sampling estimator with no winsoring, and a winsorized version in which the threshold level is picked via 10-fold cross-validation. The usual estimator serves as the main benchmark in settings where the variance of the weights is small. When the variance is big, some form of winsorization is better than none, and picking the threshold level via 10-fold cross-validation constitutes a point of reference. Note cross-validation is computationally much more intensive than the balanced procedure, and it comes with few theoretical guarantees, being particularly unstable in the presence of large weights. In the examples below, the cross-validated procedure took between $10$ to $20$ times longer to run (the time difference generally depends on the number of threshold values being considered, as well as how early the balanced procedure stops).

For most of the examples, the conclusion is that for small variances balanced importance sampling tracks the usual estimator well, and as the proposal distribution becomes worse, the balanced estimator generally performs much better, due to trading-off bias for variance by winsorizing. In the real dataset, the results obtained by cross-validation are significantly worse than the ones obtained by the balanced procedure, while in the synthetic ones they look similar.

The sample sizes are generally taken to be $n=10^4$. For the optimality guarantees to hold with any reasonable probability, a sample size of at least $n>10^8$ would be needed, but this is often quite impractical. It is also a loose upper bound, in any case. By choosing $n=10^4$, the main interest here is in whether the procedure yields sensible results in common applied settings.

In all the examples, the notation of Section \ref{sec:truncated_IS} is used, and the parameters of the balanced procedure are fixed at $t=2$ and $c= 1+\sqrt{3}$. Setting $c = 1+\sqrt{3}$ makes the procedure less likely to winsorize than the optimal choice of $1+\sqrt{5}$. This means the procedure becomes more conservative in a setting where its theoretical guarantees may not hold, but comes at the expense of increasing the value of $C$ in (\ref{eq:optimal_error}). 

\subsection{Synthetic datasets} \label{subsec:synthetic_examples}

In all of examples below, adapted from \cite{vehtari2015pareto}, the true value of the parameter is known, which allows the estimation errors to be computed. For most examples, the proposed winsorization levels are fixed at $\Lambda = \left\{550, 500, 400, 200, 100, 10\right\}$, and $n=10,000$ samples are drawn from the proposal distribution to generate an estimate $\hat{\theta}$. Each experiment is repeated $1,000$ times to obtain the distribution of the error. 

For each example, three plots are provided. First, a violin plot, showing the density of the three estimators, for different underlying parameters. In these plots, the true value of the parameter is subtracted from the estimates, so the more closely concentrated are around zero, the better. Second, the mean-squared error (MSE) incurred by each estimator, $\frac{1}{n}\sum_{i=1}^{n}(\hat{\theta}_i - \theta)^2$, is plotted. Because the MSE is too susceptible to outliers, a third plot  is provided with the mean absolute deviation (MAD), $\frac{1}{n}\sum_{i=1}^{n}|\hat{\theta}_i - \theta|$, which is more stable under large deviations. The plots have different scales throughout the examples. A jitter is added to the points to aid in the visualization, and some values of the importance sampling MSE are omitted if they are too large.

\subsubsection{Exponential distribution}

For the first example, consider a proposal distribution $q(x) \sim \text{Expo}(1)$, and target distribution $p(x) \sim \text{Expo}(\nu)$, for different values of $\nu \in \{1.3, 1.5, 1.9, 2, 2.1, 3, 4, 10\}$. The target function is $f(x)=x$, so the parameter to be estimated is the mean of $p$, and the possible levels of truncation are $\Lambda = \left\{550, 500, 400, 200, 100, 10\right\}$. 

The proposal distribution is narrower then the target distribution, the more so the larger $\nu$ is. Note the variance of the target distribution is finite only if $\nu<2$, so the usual importance sampling estimator is expected to deteriorate significantly as $\nu>2$.

Overall, Figures \ref{fig:cv_exponential_violin}, \ref{fig:cv_exponential_MSE_n_10000} and \ref{fig:cv_exponential_MAD_n_10000} show that for small values of $\nu$, the three estimators perform similarly and have low variance, so little winsorization seems required. With larger $\nu$, the variance of the estimator grows and both winsorized procedures censor the samples to obtain better MSE and MAD. Even so, for $\nu < 4$, the usual estimator is still competitive. The reduction of variance at the expense of bias is particularly clear in Figure \ref{fig:cv_exponential_violin}.

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_exponential/cv_exponential_violin_n_10000}
 \caption{Violin plot for Exponential example}
 \label{fig:cv_exponential_violin}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_exponential/cv_exponential_MSE_n_10000}
\caption{Mean squared error for Exponential example}
\label{fig:cv_exponential_MSE_n_10000}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_exponential/cv_exponential_MAD_n_10000}
\caption{Mean absolute deviation for Exponential example}
\label{fig:cv_exponential_MAD_n_10000}
 \end{center}
\end{figure}

\subsubsection{Normal distribution}

Consider the proposal distribution $q(x) \sim N(0, \nu)$ for a target distribution $p(x) \sim N(0, 1)$, and parameters $\nu \in \{0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2\}$. The target function is again $f(x)=x$ and $\Lambda = \left\{550, 500, 400, 200, 100, 10\right\}$. Smaller values of the parameter make the the proposal distribution $q$ a worse approximation to the target $p$, as it becomes narrower. As opposed to the previous example, here it is the proposal distribution that is varying.

This represents the best-case scenario for winsorizing. As the procedures winsorize at $-M$ and $M$, Lemma \ref{lemma:2} implies that winsorizing around the true mean of a symmetric distribution can only help. Both balanced importance sampling and the CV winsorized version take advantage of this. The violin plot in Figure \ref{fig:cv_normal_violin} reveals that variance is the culprit for the worsening performance of the usual importance sampling estimator. Since in general it is impossible to winsorize around the unknown true mean, the example is overly optimistic.

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal/cv_normal_violin_n_10000}
 \caption{Violin plot for Normal example}
 \label{fig:cv_normal_violin}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal/cv_normal_MSE_n_10000}
\caption{Mean squared error for Normal example}
\label{fig:cv_normal_MSE_n_10000}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal/cv_normal_MAD_n_10000}
\caption{Mean absolute deviation for Normal example}
\label{fig:cv_normal_MAD_n_10000}
 \end{center}
\end{figure}

\subsubsection{$t$ distribution}

Consider a proposal distribution $q(x)\sim t_{21}(\nu, 1- 1/21)$, with target distribution $t_{21}(0, 1)$ and different parameters $\nu \in \{0, 0.5, 1, 1.5, 2, 2.5, 3\}$. The notation $t_{21}(\nu, 1- 1/21)$ refers to the $t$ distribution with 21 degrees of freedom, location $\nu$ and scale $1 - 1/21$. \cite{vehtari2015pareto} suggest this example to emulate the usage of importance sampling in Bayesian inference, particularly leave-one-out cross-validation. As opposed to the two previous examples, both the mean and variance now differ between the proposal and target distributions. Because the variance is almost the same, the proposal distribution is shifted and just a bit narrower than the target distribution. The target function is $f(x)=x$ and $\Lambda = \left\{550, 500, 400, 200, 100, 50, 5, 1\right\}$. The set $\Lambda$ is slightly changed to allow for threshold values closer to zero.

As the mean $\nu$ increases, the proposal distribution provides a worse fit, so the usual importance sampling estimator's performance degrades considerably. Figure \ref{fig:cv_t_violin} shows how quickly the variance deteriorates. On the other hand, both the balanced and the CV winsorized estimators censor some of the weights, so the MSE and MAD do not grow too much. Figure \ref{fig:cv_t_MAD_n_10000}, in particular, shows that the two procedures are picking different truncation levels throughout the examples.

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_t/cv_t_violin_n_10000}
 \caption{Violin plot for $t$ example}
 \label{fig:cv_t_violin}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_t/cv_t_MSE_n_10000}
\caption{Mean squared error for $t$ example}
\label{fig:cv_t_MSE_n_10000}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_t/cv_t_MAD_n_10000}
\caption{Mean absolute deviation for $t$ example}
\label{fig:cv_t_MAD_n_10000}
 \end{center}
\end{figure}

\subsubsection{Multivariate Normal distribution}

For a multivariate example, consider a proposal $q(\mathbf{x}) \sim t_{21, \nu}(0.4 \cdot \mathbbm{1}, 0.8 \cdot I)$, with target distribution $p(\mathbf{x})\sim N_{\nu}(0, 1)$. The parameter $\nu \in \{20, 40, 50, 80, 100\}$ indicates the dimension of the distributions. The target function is $f(\mathbf{x})=\sum_{i=1}^{\nu} x_i$ and, as before, $\Lambda = \left\{550, 500, 400, 200, 100, 50, 10\right\}$. Because the number of samples take longer to compute in high dimensions, only $100$ simulations are used, with $n=1,000$ samples in each simulation.

From Figure \ref{fig:cv_mvnormal_violin}, it is clear increasing the dimension significantly impacts the variance of the usual importance sampling estimator, while winsorizing helps both the balanced and the CV estimators in relatively equal terms. For $\nu=20$ dimensions, all three estimators are comparable, but for higher dimensions both the MSE and MAD of the usual estimator are much bigger. 

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_mvnormal/cv_mvnormal_violin_n_1000}
 \caption{Violin plot for Multivariate Normal example}
 \label{fig:cv_mvnormal_violin}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_mvnormal/cv_mvnormal_MSE_n_1000}
\caption{Mean squared error for Multivariate Normal example}
\label{fig:cv_mvnormal_MSE_n_1000}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_mvnormal/cv_mvnormal_MAD_n_1000}
\caption{Mean absolute deviation for Multivariate Normal example}
\label{fig:cv_mvnormal_MAD_n_10000}
 \end{center}
\end{figure}

\subsubsection{Normal mixture}

Finally, consider a proposal distribution $q(x) \sim N(0, 4)$ with target $p(x) \sim 0.8 \cdot N(0, 0.5) + 0.2 N(\nu, 0.5)$, and $\nu \in \{1, 3, 5, 7, 9, 11, 12\}$. The target function is $f(x)=x$, the threshold values are $\Lambda = \left\{550, 500, 400, 200, 100, 10\right\}$, and again $n=10,000$ samples are used. Note that as $\nu$ is increased the proposal is less suited as an approximation to the target, since the mixture starts generating points that are too far removed.

From Figure \ref{fig:cv_normal_mixture_violin}, note that for $\nu < 7$, the variance increases but the bias is still kept low. At $\nu = 5$, the CV winsorized procedure is already censoring the data to the point of introducing serious bias (but reducing the variance). When $\nu = 7$ the bias becomes too big, and the balanced procedure starts to truncate as well. At this point, the usual estimator has smaller MSE and MAD than both winsorized procedures, but from then on the variance becomes too big and the error from the usual estimator becomes too large to even appear in Figures \ref{fig:cv_normal_mixture_MSE_n_10000} and \ref{fig:cv_normal_mixture_MAD_n_10000}. Both winsorized estimators incur roughly the same error.

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal_mixture/cv_normal_mixture_violin_n_10000}
 \caption{Violin plot for Mixture Normal example}
 \label{fig:cv_normal_mixture_violin}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal_mixture/cv_normal_mixture_MSE_n_10000}
\caption{Mean squared error for Mixture Normal example}
\label{fig:cv_normal_mixture_MSE_n_10000}
 \end{center}
\end{figure}

\begin{figure}[htbp]
 \begin{center} \includegraphics[width=1\textwidth]{example_normal_mixture/cv_normal_mixture_MAD_n_10000}
\caption{Mean absolute deviation for Mixture Normal example}
\label{fig:cv_normal_mixture_MAD_n_10000}
 \end{center}
\end{figure}

\subsection{Real dataset: complete self-avoiding walks} \label{subsec:real_example}

Recall the original problem of complete self-avoiding walks, discussed in Section \ref{sec:SAW}. The goal is to estimate the number $Z$ of complete self-avoiding walks on an $m \times m$ grid, that is, the number of self-avoiding walks that start at $(0, 0)$ and end at $(m, m)$. The target distribution is $p(x) = \frac{1}{Z} \cdot \mathbb{I}_{[x \text{ is CSAW}]}$, where $x$ denotes a self-avoiding walk. If $q$ is any proposal such that $p(x)=0$ whenever $q(x)=0$, then, from (\ref{eq:importance_sampling_identity}), the usual importance sampling estimator is given by drawing $x_i \iid q$, and estimating $\hat{Z} = \frac{1}{n} \sum_{i=1}^{n} \frac{1}{q(x_i)} \mathbb{I}_{[x_i \text{is CSAW}]}$.

Consider three different proposals, all of them built similarly, but with slightly differing notions of ``available neighbor'' points. For all proposals, start at $(0, 0)$; pick an available neighbor uniformly at random, and go to that neighbor; keep picking available neighbors at random until the walk reaches the point $(m, m)$ or is forced to intersect with itself (as in Figure \ref{fig:1}). Let $d_j$ be the number of available neighbors at step $j$, so each neighbor is picked with probability $1/d_j$. Define the probability of path $x$ to be the product of the individual probabilities at each step, namely $q(x) = \prod_{j=1}^{l_x} 1/d_j$, with $l_x$ being the length of walk $x$, and $d_j$ the . Figure \ref{fig:2} provides an example. The three proposals are only different in how they define an ``available neighbor''.

First, let $q_1$ be the proposal distribution in which an ``available neighbor'' is any neighbor point that has not been visited before. Walks generated by $q_1$ might get trapped, in the sense that the path $x$ is forced to intersect with itself before reaching $(m, m)$. In this case, $\frac{1}{q(x)}\mathbb{I}_{[x \text{ is CSAW}]} = 0$, and the path contributes with weight zero in the estimate of $\hat{Z}$. See Figure \ref{fig:all_traps}.

\begin{figure}[htbp]
 \centering
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_28_modified.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_23_modified.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_27_modified.png}
	\end{minipage}
 \caption{Three walks drawn from $q_1$, which allows all traps; the blue one is assigned probability $q(x)=1^{-5}2^{-18}3^{-15}$. The estimate after generating these 3 walks is $\hat{Z} = \frac{1}{3}\sum_{i=1}^{3}\frac{1}{q(x_i)}\mathbb{I}_{[x_i \text{ is CSAW}]}= 2^{18} \cdot 3^{14} \approx 3.76 \cdot 10^{12}$}.
 \label{fig:all_traps}
\end{figure}

To define $q_2$ and $q_3$, note two kinds of traps can happen to a walk. One occurs when the walk hits the boundary and moves back towards the origin, as in the yellow point in the first red path in Figure \ref{fig:all_traps}. This might happen at any of the four boundaries of the grid, and it necessarily results in a trapped walk. The second type occurs when the walk gets trapped within itself, as in the yellow point in the second red path in Figure \ref{fig:all_traps}. Define $q_2$ such that it never samples paths that are trapped in the boundary, only in the interior; $q_3$ is defined so that it does not sample trapped paths, either in the boundary or in the interior (for computationally efficient ways of generating such paths, see \cite{bousquet2014importance}). 

Because different proposals define available neighbors differently, the same walk $x$ might have different probabilities under $q_1, q_2$ and $q_3$. Figure \ref{fig:comparison_of_traps} provides an example.

\begin{figure}[htbp]
 \centering
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_4_modified_all.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_4_modified_interior.png}
	\end{minipage}
	\begin{minipage}{0.32\textwidth} 		\includegraphics[width=1\textwidth]{path_all_traps/all_traps_plot_11_4_modified_no.png}
	\end{minipage}
 \caption{The probability of a same path $x$ can be different for $q_1$ (left), $q_2$ (middle) and $q_3$ (right); the red points show the differences. For $q_1$, all traps can happen; for $q_2$, there is only one available neighbor at the second red point, as going down results in a boundary trap; for $q_3$, all traps are avoided, including the interior trap that occurs if the walk goes down on the first red point. Note $q_3(x)<q_2(x)<q_1(x)$.}
 \label{fig:comparison_of_traps}
\end{figure}

Proposal $q_3$ is the best suited for the problem, followed by $q_2$ and then $q_1$. While $q_3$ is supported on the set of complete self-avoiding walks, $q_2$ and $q_1$ generate many walks that are trapped. As a consequence, $q_2$, and even more so $q_1$, sample complete self-avoiding walks with lower probability than $q_3$, and so when these walks are eventually sampled they receive a much larger weight. The fact that many walks under $q_2$ and $q_1$ contribute with weights zero, while a few ones contribute with enormous weights adds to the importance sampling estimator's variance.

How much can the winsorized procedure aid in estimating $Z$ with $q_1$, $q_2$ or $q_3$ as the proposal distribution? Since $q_1$ induces the estimator with the largest variance, the balanced importance sampling estimator is expected to be the most useful in this case, but for $q_3$ it might help very little, or none at all.

For each simulation run, $\num[group-separator={,}]{10000}$ paths are sampled from each $q_k$, and three estimators considered: the usual importance sampling estimator, the balanced estimator, and the winsorized procedure with threshold picked via 10-fold cross-validation. This was repeated for $\num[group-separator={,}]{1000}$ simulation runs, and both the MSE and MAD for each of the three methods were calculated. Let $c=1+\sqrt{3}$, $t=2$, and $\Lambda = \left\{10^{21}, 5\cdot 10^{23}, 10^{25}, 5\cdot 10^{26}, 10^{28}\right\}$, so the range of values span from large thresholds (implying no winsorization) to small threshold (implying winsorizing past the actual mean). The results can be found in Table \ref{table:1}.

\begin{table}
\begin{center}
 \begin{tabular}{c|c|c|c}
 \hline \hline
 \textbf{all traps}, $q_1$ & Importance Sampling & CV Winsorized IS & Balanced IS \\ \hline
 MSE & $2.075\cdot 10^{49}$ & $2.457\cdot 10^{48}$ & $2.437\cdot 10^{48}$ \\ \hline
 MAD & $1.817\cdot 10^{24}$ & $1.567 \cdot 10^{24}$  &  $1.561 \cdot 10^{24}$ \\ \hline
 \hline
 \textbf{interior traps}, $q_2$ & Importance Sampling & CV Winsorized IS & Balanced IS \\ \hline
 MSE & $1.524\cdot 10^{48}$ & $2.432\cdot 10^{48}$ & $9.61\cdot 10^{47}$ \\ \hline
 MAD & $7.782\cdot 10^{23}$ &  $1.559\cdot 10^{24}$ &  $9.697\cdot 10^{23}$ \\ \hline
 \hline 
 \textbf{no traps}, $q_3$ & Importance Sampling & CV Winsorized IS & Balanced IS \\ \hline
 MSE & $3.148\cdot 10^{46}$ & $2.301\cdot 10^{48}$ & $2.425\cdot 10^{46}$ \\ \hline
 MAD & $1.396\cdot 10^{23}$ &  $1.517\cdot 10^{24}$ &  $1.266\cdot 10^{23}$ \\ \hline
 \hline
 \end{tabular}
  \caption{Results of applying the three estimators to the proposals $q_1$ (all traps), $q_2$ (interior traps), and $q_3$ (no traps). Note the errors are huge.} \label{table:1}
\end{center}
\end{table}

The balanced procedure generally yields the best results, often picking a threshold value that does not over-winsorize, but still effectively trading-off some bias for variance. Cross-validation yields the poorest results, despite being computationally more intensive. As opposed to the examples in Subsection \ref{subsec:synthetic_examples}, the rare but very large weights in this setting means the training and testing folds used by cross-validation are very discrepant, and as a result it does not pick good threshold values.

The table also shows how much better the estimation under $q_3$ is for the usual importance sampling estimator. There is an improvement in MSE of an order of magnitude in the estimator in going from $q_1$ to $q_2$, and two orders of magnitude in going from $q_2$ to $q_3$. Balanced importance sampling shows an improvement of two orders of magnitude in going from $q_1$ to $q_3$, so that even for $q_3$ the balanced estimator performs better than usual importance sampling. While in a setting with extremely high variance such as these the results may vary significantly, re-running this example with different seeds yielded comparable results.

Finally, note the entire procedure is heavily reliant on the choice of threshold values $\Lambda$. Seemingly sensible options, such as $\Lambda=\{10^{24}, 10^{25}, 10^{26}, 10^{27}\}$, give poorer results for the balanced procedure, as well as the cross-validated one, by giving few threshold choices between over and under-winsorization. On the other hand, even better results than those of Table \ref{table:1} can be attained by picking values that do not encourage over-winsorization, say $\Lambda=\{5 \cdot 10^{26}, 6 \cdot 10^{26}, 7 \cdot 10^{26}, 8 \cdot 10^{26}, 9 \cdot 10^{26}, 10^{27}, 2 \cdot 10^{27}, 3 \cdot 10^{27}, 4 \cdot 10^{27}, 5 \cdot 10^{27}\}$. In this case, however, cross-validation picks a similar set of values to the balanced procedure, so the risks of partitioning the data to pick the threshold level do not become apparent.

\section{Conclusion} \label{sec:conclusion}

This work investigated the gains obtained by winsorizing the usual importance sampling estimator. A concrete version of the Balancing Principle was employed to determine a threshold level at which the sample is winsorized in a pre-chosen set without sacrificing too much bias for the reduction in variance. The method is probabilistic in nature, and finite-sample bounds on its optimality guarantees were obtained.

The empirical performance of the procedure was considered in a series of examples. On both synthetic and real datasets, the resulting estimator yields sensible results: on par with the usual importance sampling estimator when the sample variance is low, and offering a significant improvement when the sample variance is high. 

There are many directions to take to further improve the method. First and foremost, it requires the user to propose a set of threshold values from which the method picks the best one, but it is not clear how to choose this set. An obviously poor choice of threshold values dooms the procedure, but even a priori reasonable ones might be problematic. One avenue for future investigations is finding a canonical way of picking these threshold values. Another direction is investigating winsorizing, possibly non-symmetrically, around values other than zero. In particular, it is not clear how to pick this value, since the optimal choice is to winsorize around the unknown mean of the distribution, and estimating the mean is the goal of the procedure in the first place. Furthermore, a soft-threholding approach might be considered, instead of winsorizing. Other potential improvements were collected in Subsection \ref{subsec:strengths_and_weaknesses}.

Finally, this paper intends to stimulate further research into making the usual importance sampling estimator more robust to poor proposal distributions, and also encourage researchers to look at the many unexplored applications of the Balancing Principle in statistics.

\section*{Acknowledgements}
The author gratefully acknowledges IMPA's hospitality, where part of this work was developed, and would like to thank Roberto de Oliveira and Persi Diaconis for many helpful discussions and suggestions. 

\bibliography{bibliography}{}
\nocite{*}
\bibliographystyle{apalike}


\end{document}
\begin{thebibliography}{}

\bibitem[Bassetti and Diaconis, 2006]{bassetti2006examples}
Bassetti, F. and Diaconis, P. (2006).
\newblock Examples comparing importance sampling and the metropolis algorithm.
\newblock {\em Illinois Journal of Mathematics}, 50(1-4):67--91.

\bibitem[Bousquet-M{\'e}lou, 2014]{bousquet2014importance}
Bousquet-M{\'e}lou, M. (2014).
\newblock On the importance sampling of self-avoiding walks.
\newblock {\em Combinatorics, Probability and Computing}, 23(5):725--748.

\bibitem[Bousquet-M{\'e}lou et~al., 2005]{bousquet2005self}
Bousquet-M{\'e}lou, M., Guttmann, A.~J., and Jensen, I. (2005).
\newblock Self-avoiding walks crossing a square.
\newblock {\em Journal of Physics A: Mathematical and General}, 38(42):9159.

\bibitem[Chichignoud et~al., 2016]{chichignoud2016practical}
Chichignoud, M., Lederer, J., and Wainwright, M.~J. (2016).
\newblock A practical scheme and fast algorithm to tune the lasso with
  optimality guarantees.
\newblock {\em Journal of Machine Learning Research}, 17(231):1--20.

\bibitem[Chow and Studden, 1969]{chow1969}
Chow, Y.~S. and Studden, W.~J. (1969).
\newblock Monotonicity of the variance under truncation and variations of
  jensen's inequality.
\newblock {\em Ann. Math. Statist.}, 40(3):1106--1108.

\bibitem[Delyon et~al., 2016]{delyon2016integral}
Delyon, B., Portier, F., et~al. (2016).
\newblock Integral approximation by kernel smoothing.
\newblock {\em Bernoulli}, 22(4):2177--2208.

\bibitem[Fithian and Wager, 2014]{fithian2014semiparametric}
Fithian, W. and Wager, S. (2014).
\newblock Semiparametric exponential families for heavy-tailed data.
\newblock {\em Biometrika}, 102(2):486--493.

\bibitem[H{\"a}marik and Raus, 2009]{hamarik2009balancing}
H{\"a}marik, U. and Raus, T. (2009).
\newblock About the balancing principle for choice of the regularization
  parameter.
\newblock {\em Numerical Functional Analysis and Optimization},
  30(9-10):951--970.

\bibitem[Ionides, 2008]{ionides2008truncated}
Ionides, E.~L. (2008).
\newblock Truncated importance sampling.
\newblock {\em Journal of Computational and Graphical Statistics},
  17(2):295--311.

\bibitem[Johansson, 2003]{johansson2003estimating}
Johansson, J. (2003).
\newblock Estimating the mean of heavy-tailed distributions.
\newblock {\em Extremes}, 6(2):91--109.

\bibitem[Knuth, 1976]{knuth1976mathematics}
Knuth, D.~E. (1976).
\newblock Mathematics and computer science: coping with finiteness.
\newblock {\em Science (New York, NY)}, 194(4271):1235--1242.

\bibitem[Knuth, 1995]{Knuth:1995:SPC:526202}
Knuth, D.~E. (1995).
\newblock {\em Selected Papers on Computer Science}.
\newblock CSLI Publications, Stanford, CA, USA.

\bibitem[Lazarov et~al., 2007]{lazarov2007balancing}
Lazarov, R.~D., Lu, S., and Pereverzev, S.~V. (2007).
\newblock On the balancing principle for some problems of numerical analysis.
\newblock {\em Numerische Mathematik}, 106(4):659--689.

\bibitem[Li and Werner, 2017]{li2017empirical}
Li, H. and Werner, F. (2017).
\newblock Empirical risk minimization as parameter choice rule for general
  linear regularization methods.
\newblock {\em arXiv preprint arXiv:1703.07809}.

\bibitem[Liu and Lee, 2016]{liu2016black}
Liu, Q. and Lee, J.~D. (2016).
\newblock Black-box importance sampling.
\newblock {\em arXiv preprint arXiv:1610.05247}.

\bibitem[Math{\'e}, 2006]{mathe2006lepskii}
Math{\'e}, P. (2006).
\newblock The {L}epskii principle revisited.
\newblock {\em Inverse problems}, 22(3):L11.

\bibitem[Northrop et~al., 2017]{northrop2017cross}
Northrop, P.~J., Attalides, N., and Jonathan, P. (2017).
\newblock Cross-validatory extreme value threshold selection and uncertainty
  with application to ocean storm severity.
\newblock {\em Journal of the Royal Statistical Society: Series C (Applied
  Statistics)}, 66(1):93--120.

\bibitem[Raus and H{\"a}marik, 2017]{raus2017heuristic}
Raus, T. and H{\"a}marik, U. (2017).
\newblock Heuristic parameter choice in tikhonov method from minimizers of the
  quasi-optimality function.
\newblock {\em arXiv preprint arXiv:1708.02149}.

\bibitem[Sen et~al., 2017]{sen2017identifying}
Sen, R., Shanmugam, K., Dimakis, A.~G., and Shakkottai, S. (2017).
\newblock Identifying best interventions through online importance sampling.
\newblock In {\em International Conference on Machine Learning}, pages
  3057--3066.

\bibitem[Shao, 2005]{shao2005explicit}
Shao, Q.-M. (2005).
\newblock An explicit berry--esseen bound for student's t-statistic via.
\newblock {\em 'Stein''s Method and Applications'}, 5:143.

\bibitem[Taddy et~al., 2016]{taddy2016scalable}
Taddy, M., Lopes, H.~F., and Gardner, M. (2016).
\newblock Scalable semiparametric inference for the means of heavy-tailed
  distributions.
\newblock {\em arXiv preprint arXiv:1602.08066}.

\bibitem[Vehtari et~al., 2015]{vehtari2015pareto}
Vehtari, A., Gelman, A., and Gabry, J. (2015).
\newblock Pareto smoothed importance sampling.
\newblock {\em arXiv preprint arXiv:1507.02646}.

\end{thebibliography}