Influence functions and OLS I am trying to understand how influence functions work. Could someone explain in the context of a simple OLS regression
\begin{equation}
y_i = \alpha + \beta \cdot x_i + \varepsilon_i
\end{equation}
where I want the influence function for $\beta$.
 A: Influence functions are basically an analytical tool that can be used to assess the effect (or "influence") of removing an observation on the value of a statistic without having to re-calculate that statistic.  They can also be used to create asymptotic variance estimates.  If influence equals $I$ then asymptotic variance is $\frac{I^2}{n}$.
The way I understand influence functions is as follows.  You have some sort of theoretical CDF, denoted by $F_{i}(y)=Pr(Y_{i}<y_{i})$.  For simple OLS, you have
$$Pr(Y_{i}<y_{i})=Pr(\alpha+\beta x_{i} + \epsilon_{i} < y_{i})=\Phi\left(\frac{y_{i}-(\alpha+\beta x_{i})}{\sigma}\right)$$
Where $\Phi(z)$ is the standard normal CDF, and $\sigma^2$ is the error variance.  Now you can show that any statistic will be a function of this CDF, hence the notation $S(F)$ (i.e. some function of $F$).  Now suppose we change the function $F$ by a "little bit", to $F_{(i)}(z)=(1+\zeta)F(z)-\zeta \delta_{(i)}(z)$ Where $\delta_{i}(z)=I(y_{i}<z)$, and $\zeta=\frac{1}{n-1}$.  Thus $F_{(i)}$ represents the CDF of the data with the "ith" data point removed.  We can do a taylor series of $F_{(i)}(z)$ about $\zeta=0$.  This gives:
$$S[F_{(i)}(z,\zeta)] \approx S[F_{(i)}(z,0)]+\zeta\left[\frac{\partial S[F_{(i)}(z,\zeta)]}{\partial \zeta}|_{\zeta=0}\right]$$
Note that $F_{(i)}(z,0)=F(z)$ so we get:
$$S[F_{(i)}(z,\zeta)] \approx S[F(z)]+\zeta\left[\frac{\partial S[F_{(i)}(z,\zeta)]}{\partial \zeta}|_{\zeta=0}\right]$$
The partial derivative here is called the influence function.  So this represents an approximate "first order" correction to be made to a statistic due to deleting the "ith" observation.  Note that in regression the remainder does not go to zero asymtotically, so that this is an approximation to the changes you may actually get.  Now write $\beta$ as:
$$\beta=\frac{\frac{1}{n}\sum_{j=1}^{n}(y_{j}-\overline{y})(x_{j}-\overline{x})}{\frac{1}{n}\sum_{j=1}^{n}(x_{j}-\overline{x})^2}$$
Thus beta is a function of two statistics: the variance of X and covariance between X and Y.  These two statistics have representations in terms of the CDF as:
$$cov(X,Y)=\int(X-\mu_x(F))(Y-\mu_y(F))dF$$
and
$$var(X)=\int(X-\mu_x(F))^{2}dF$$
where
$$\mu_x=\int xdF$$
To remove the ith observation we replace $F\rightarrow F_{(i)}=(1+\zeta)F-\zeta \delta_{(i)}$ in both integrals to give:
$$\mu_{x(i)}=\int xd[(1+\zeta)F-\zeta \delta_{(i)}]=\mu_x-\zeta(x_{i}-\mu_x)$$
$$Var(X)_{(i)}=\int(X-\mu_{x(i)})^{2}dF_{(i)}=\int(X-\mu_x+\zeta(x_{i}-\mu_x))^{2}d[(1+\zeta)F-\zeta \delta_{(i)}]$$
ignoring terms of $\zeta^{2}$ and simplifying we get:
$$Var(X)_{(i)}\approx Var(X)-\zeta\left[(x_{i}-\mu_x)^2-Var(X)\right]$$
Similarly for the covariance
$$Cov(X,Y)_{(i)}\approx Cov(X,Y)-\zeta\left[(x_{i}-\mu_x)(y_{i}-\mu_y)-Cov(X,Y)\right]$$
So we can now express $\beta_{(i)}$ as a function of $\zeta$.  This is:
$$\beta_{(i)}(\zeta)\approx \frac{Cov(X,Y)-\zeta\left[(x_{i}-\mu_x)(y_{i}-\mu_y)-Cov(X,Y)\right]}{Var(X)-\zeta\left[(x_{i}-\mu_x)^2-Var(X)\right]}$$
We can now use the Taylor series:
$$\beta_{(i)}(\zeta)\approx \beta_{(i)}(0)+\zeta\left[\frac{\partial \beta_{(i)}(\zeta)}{\partial \zeta}\right]_{\zeta=0}$$
Simplifying this gives:
$$\beta_{(i)}(\zeta)\approx \beta-\zeta\left[\frac{(x_{i}-\mu_x)(y_{i}-\mu_y)}{Var(X)}-\beta\frac{(x_{i}-\mu_x)^2}{Var(X)}\right]$$
And plugging in the values of the statistics $\mu_y$, $\mu_x$, $var(X)$, and $\zeta=\frac{1}{n-1}$ we get:
$$\beta_{(i)}\approx \beta-\frac{x_{i}-\overline{x}}{n-1}\left[\frac{y_{i}-\overline{y}}{\frac{1}{n}\sum_{j=1}^{n}(x_{j}-\overline{x})^2}-\beta\frac{x_{i}-\overline{x}}{\frac{1}{n}\sum_{j=1}^{n}(x_{j}-\overline{x})^2}\right]
$$
And you can see how the effect of removing a single observation can be approximated without having to re-fit the model.  You can also see how an x equal to the average has no influence on the slope of the line.  Think about this and you will see how it makes sense.  You can also write this more succinctly in terms of the standardised values $\tilde{x}=\frac{x-\overline{x}}{s_{x}}$ (similarly for y):
$$\beta_{(i)}\approx \beta-\frac{\tilde{x_{i}}}{n-1}\left[\tilde{y_{i}}\frac{s_y}{s_x}-\tilde{x_{i}}\beta\right]
$$
A: Here is a super general way to talk about influence functions of a regression. First I'm going to tackle one way of presenting influence functions:
Suppose $F$ is a distribution on $\Sigma$. The contaminated distribution function, $F_\epsilon(x)$ can be defined as:
$$
F_\epsilon(x)=(1-\epsilon)F+\epsilon\delta_x
$$
where $\delta_x$ is the probability measure on $\Sigma$ which assigns probability 1 to $\{x\}$ and 0 to all other elements of $\Sigma$.
From this we can define the influence function fairly easily:
The influence function of $\hat{\theta}$ at $F$, $\psi_i:\mathcal{X}\to\Gamma$ is defined as: 
\begin{equation}
\psi_{\hat{\theta},F}(x)=\lim\limits_{\epsilon\to 0}\dfrac{\hat{\theta}(F_\epsilon(x))-\hat{\theta}(F)}{\epsilon}
\end{equation}
From here it's possible to see that an influence function is the Gateaux derivative of $\hat\theta$ at $F$ in the direction of $\delta_x$. This makes the interpretation of influence functions (for me) a little bit clearer: An influence function tells you the effect that a particular observation has on the estimator.
The OLS estimate is a solution to the problem:
$$
\hat\theta=\arg\min_\theta E[(Y-X\theta)^T(Y-X\theta)]
$$
Imagine a contaminated distribution which puts a little more weight on observation $(x,y)$:
$$
\hat\theta_\epsilon = \arg\min_\theta (1-\epsilon)E[(Y-X\theta)^T(Y-X\theta)]+\epsilon (y-x\theta)^T(y-x\theta)
$$
Taking first order conditions:
$$
\left\{(1-\epsilon)E[X^TX]+\epsilon x^Tx\right\}\hat\theta_\epsilon = (1-\epsilon)E[X^TY]+\epsilon x^Ty
$$
Since the influence function is just a Gateaux derivative we can now say:
$$
-(E[X^TX]+x^Tx)\hat\theta_\epsilon + E[X^TX]\psi_{\theta}(x,y) = -E[X^TY] + x^Ty
$$
At $\epsilon=0$, $\hat\theta_\epsilon=\hat\theta=E[X^TX]^{-1}E[X^TY]$, so:
$$
\psi_{\theta}(x,y)=E[X^TX]^{-1}x^T(y-x\theta)
$$
The finite sample counterpart of this influence function is:
$$
\psi_{\theta}(x,y)=\left(\dfrac{1}{N}\sum_i X_i^TX_i\right)^{-1}x^T(y-x\theta)
$$
In general I find this framework (working with influence functions as Gateaux derivatives) easier to deal with.
A: Consider a simple linear model $$Y_i=X_i\beta +u$$
where for simplicity, we assume $\mu_X=\mu_Y=0$, and $X_i,Y_i$ are scalar random variables with independent and identical joint measure $P$ of $X,Y$.
Consider the mapping $$\phi:\mathbb{D} \mapsto \mathbb{E} $$
such that $\phi$ maps the joint distribution of $X,Y, {P}$ to $\beta=Cov(X,Y)/V(X)$.
Denote Dirac measure with a mass on the $i$th observation $(X_i, Y_i)$, $\delta_{i}$, and note that based on the linearity mentioned here it is easy to see that
$$\phi((1-t)P+t\delta_i) = \frac{(1-t)\sigma_{XY}+t(1-t)X_iY_i}{(1-t)\sigma_X^2+ t(1-t)X_i^2 },$$
which gives influence function of the ith observation via ordinary derivative (nothing fancy..., sorry)
$$\phi_{(i)}'(P)=\left.\frac{\partial \phi((1-t)P+t\delta_i)}{\partial t}\right|_{t=0} = \frac{X_iY_i}{\sigma_X^2}.$$
In large samples and under a mean-zero and scalar-$\beta$ setting, this (infeasible) conclusion is the same approximation as the solution provided by @jayk.
