# Introduction: A statistician's guide to functional calculus.

With this post I would like to embark on one of the tasks that motivated me to start this blog: a readable introduction, intended for workaday statisticians, to differentiable calculus with functionals. My goal is to write the sort of thing that would have helped me a couple years ago as I started learning about this useful and enlightening subject during my PhD. To that end, I hope to sketch some of the many ways functionals show up in statistics, what new concepts are needed to extend ordinary Euclidian calculus to spaces of functions, and provide lots of examples of how infinite-dimensional calculus can go right and wrong. I may sketch some proofs when they provide intuition, but I will generally not reproduce rigorous results. I will try, however, to point to where rigorous results can be found. My only ambition is to provide context and motivation for reading the considerable rigorous literature that already exists.

Finally, I should add that my understanding of this topic is quite modest and far from complete. Writing these posts will be as much to refine my own understanding as to provide understanding to the reader. I will surely make errors, and may start down some dead ends without realizing it.

## Functionals

A “functional” is simply a map from a function to a real number. It is, in other words, a function of a function, whose domain is the reals. We will at times refer to maps from functions to other functions, or, in the extreme, to functions between generic Banach spaces (which we will define later). Perhaps confusingly, such exotic maps are still referred to as plain old functions. As such, in my opinion, the term “functional” seems a bit pretentious and could perhaps be discarded.

Here, the term “functional calculus” means taking derivatives and forming Taylor series approximations to functionals. Of course, such a calculus also requires thinking carefully about the notions of smoothness and continuity.

For the rest of this post, let’s just take a look at some examples of functionals in statistics without examining their properties just yet.

## The evaluation functional.

The evaluation functional is perhaps the simplest example. Let , by which I mean that is a function that takes in a real and returns a real. I will also write this as , i.e., means the set of functions from to .

Fix some . The “evaluation functional” maps to its value at : . (If you think this functional is so simple that nothing much can be said about it, go read a little bit about reproducing kernel Hilbert spaces.)

Note that we could equally well have written the evaluation functional as and taken . Which range we choose depends on what we want to do or emphasize. Many operations in statistics have functions implicit in them, and are written with these functions implicity held fixed. If, instead, we fix every other aspect of the operation but vary the function, we define a functional.

## The sample mean.

The sample mean provides quite a rich set of functionals. Let us define some independent and identically distributed (IID) data, , and consider the quantity

Let us consider some ways to represent this as a functional by varying different aspects.

#### The distribution function.

Let us fix and write for the cumulative distribution function of . Thus, . Let us write

(I use the subscript for “CDF”.) With this functional, . If we define the empirical distribution to be , then . By considering different arguments to , we can quantify the effect of different distribution functions on the sample mean. Similarly, the quantity measures how close the sample mean is to the population mean.

Functionals that look like are particularly important in classical frequentist statistics. One can see how a notion of “continuity” of , together with a notion of “closeness” of and , could provide consistency results. One can also see how the sensitivity of to “small” changes of gives a notion of robustness. Making such ideas precise is one reason to study functional calculus.

#### The density.

Of course, the distribution function is not the only way to describe a distribution. Let denote the density of the data with respect to the Lebesgue measure, and write

I use the subscript for “density”. The population expectation can be written as . Technically the empirical distribution cannot be represented in this form, but you might imagine fudging it with the diract delta function and . (Whether such a fudge is legal is definitely something that we will need to think about carefully.)

Functionals that look like are particularly important in Bayesian statistics when considering sensitivity to the prior density, as posterior expectations can typically be written as ratios of integrals over the prior density. Again, some notion of the “smoothness” of a functional like naturally informs the robustness of a Bayesian posterior, and functional calculus is one tool to do so.

#### The target function.

If we fix the vector , then we can define a functional

With this definition, the sample mean of is , and the sample variance is given by . One might imagine choosing some class of functions, , and finding

For example, the Rademacher complexity of a function class takes the form of . Though I should mention that (as of the time of wrigin at least), I don’t know much about applications of functional calculus to such set complexity measures.

## Optimization problems and maximum likelihood estimators.

Suppose we want to solve an optimization problem

As the optimization objective is a sample mean, this can also be written as a distribution functional:

With this definition, .

We might also consider the loss function itself:

We also might consider the effect of a regularizer:

with .

By considering the smoothness of and we can quantify the effect on the optimum of changing the optimization problem. For example, suppose we intend to be a maximum likelihood estimator, in which case would be the negative log likelihood. If we are worried that the model is misspecified, we might ask how much using a different model class would have changed our results.

As a special case, suppose we have a generalized linear model with regressors , responses , and an inverse link function :

A maximum likelihood estimator would depend on the functional form of , say through the log likelihood . We could then write

Here, we might imagine restricting to have certain properties, such as symmetry, unimodality, and so on.

## Generic functionals of the distribution function.

More general functionals of the distribution function provide an important set of use cases for functional calculus in statistics. For example, the median functional can be defined as

One might analyze, for example, and hope that smoothness properties of give rise to a central limit theorem for the median.

## Bayesian statistics

Given a parameter , data , prior (here with respect to the Lebesgue measure), and model , the Bayesian posterior expectation of a quantity is

Here, there are loads of functionals to be found. Many of the examples we have already considered apply. For example, we could take the expectation to be a functional of the model or , of the true distribution, , of the data (which would enter if contains IID data), or of the density of the data, or of the argument .

A special focus in the Bayesian literature has been given to the map from the prior density to the posterior expectation:

We might imagine the prior living within a parametric class or some constrained non-parametric class. We could also take other summary statistics of the posterior which are themselves functionals, such as the median, and write them as functionals of any of the above inputs, such as the prior:

## Where next?

The behavior of the functionals encompasses quite a few of the fundamental concerns of statistics. Take a functional, of the distribution function, for example. The asymptotic bias and variance of a statistic is given by the variability of around . Predictive error can be estimated by considering the effect on of creating a held-out set. Examining robustness to misspecification of all sorts requires considering varying functional inputs to statistical procedures.

Often in statistics, functionals can be quite complicated or expensive to evaluate. To make matters worse, the set of arguments is infinite dimensional! Consequently, it can be very useful for both theoretical understanding and for computation to form local approximations to functionals, as one forms Taylor series approximations in ordinary calculus. Since the underlying spaces are infinite dimensional, it will turn out that we have to be a bit more careful than in ordinary Euclidian calculus, and some intuition fails to pass over. But once one is aware of these issues, one can begin to operate on functionals with the same mechanical confidence as with ordinary functions.

The first step will be formalzing a generic conception of spaces of functions. In statistics, this will typically mean extending the domain of our functionals to more capcious spaces which include some functions which do not represent proper distributions. Namely, we will be doing calculus on Banach spaces—which we will define and describe next time.