Alternating conditional expectations

Alternating conditional expectations (ACE) is an algorithm to find the optimal transformations between the response variable and predictor variables in regression analysis.

Introduction
In statistics, a nonlinear transformation of variables is commonly used in practice in regression problems. Alternating conditional expectations (ACE) is one of the methods to find those transformations that produce the best fitting additive model. Knowledge of such transformations aids in the interpretation and understanding of the relationship between the response and predictors.

ACE transforms the response variable $$Y$$ and its predictor variables, $$X_i$$ to minimize the fraction of variance not explained. The transformation is nonlinear and is iteratively obtained from data.

Mathematical description
Let $$Y,X_1,\dots,X_p$$ be random variables. We use $$X_1,\dots,X_p$$ to predict $$Y$$. Suppose $$\theta(Y),\varphi_1(X_1),\dots,\varphi_p(X_p)$$ are zero-mean functions and with these transformation functions, the fraction of variance of $$\theta(Y)$$ not explained is
 * $$ e^2(\theta,\varphi_1,\dots,\varphi_p)=\frac{\mathbb{E}\left[\theta(Y)-\sum_{i=1}^p \varphi_i(X_i)\right]^2}{\mathbb{E}[\theta^2(Y)]}$$

Generally, the optimal transformations that minimize the unexplained part are difficult to compute directly. As an alternative, ACE is an iterative method to calculate the optimal transformations. The procedure of ACE has the following steps:
 * 1) Hold $$\varphi_1(X_1),\dots,\varphi_p(X_p)$$ fixed, minimizing $$e^2$$gives $$\theta_1(Y)=\mathbb{E}\left[\sum_{i=1}^p \varphi_i(X_i)\Bigg|Y\right]$$
 * 2) Normalize $$\theta_1(Y)$$ to unit variance.
 * 3) For each $$k$$, fix other $$\varphi_i(X_i)$$ and $$\theta(Y)$$, minimizing $$e^2$$ and the solution is:: $$\tilde{\varphi}_k = \mathbb{E}\left[\theta(Y)-\sum_{i\neq k} \varphi_i(X_i) \Bigg| X_k\right]$$
 * 4) Iterate the above three steps until $$e^2$$ is within error tolerance.

Bivariate case
The optimal transformation $$\theta^*(Y), \varphi^*(X)$$ for $$p=1$$ satisfies
 * $$ \rho^*(X, Y) = \rho^*(\theta^*, \varphi^*) = \max_{\theta, \varphi} \rho(\theta(Y), \varphi(X))$$

where $$\rho$$ is Pearson correlation coefficient. $$ \rho^*(X, Y)$$ is known as the maximal correlation between $$X$$ and $$Y$$. It can be used as a general measure of dependence.

In the bivariate case, the ACE algorithm can also be regarded as a method for estimating the maximal correlation between two variables.

Software implementation
The ACE algorithm was developed in the context of known distributions. In practice, data distributions are seldom known and the conditional expectation should be estimated from data. R language has a package acepack which implements ACE algorithm. The following example shows its usage:

Discussion
The ACE algorithm provides a fully automated method for estimating optimal transformations in multiple regression. It also provides a method for estimating the maximal correlation between random variables. Since the process of iteration usually terminates in a limited number of runs, the time complexity of the algorithm is $$O(np)$$ where $$n$$ is the number of samples. The algorithm is reasonably computer efficient.

A strong advantage of the ACE procedure is the ability to incorporate variables of quite different types in terms of the set of values they can assume. The transformation functions $$\theta(y), \varphi_i(x_i)$$ assume values on the real line. Their arguments can, however, assume values on any set. For example, ordered real and unordered categorical variables can be incorporated in the same regression equation. Variables of mixed type are admissible.

As a tool for data analysis, the ACE procedure provides graphical output to indicate a need for transformations as well as to guide in their choice. If a particular plot suggests a familiar functional form for a transformation, then the data can be pre-transformed using this functional form and the ACE algorithm can be rerun.

As with any regression procedure, a high degree of association between predictor variables can sometimes cause the individual transformation estimates to be highly variable, even though the complete model is reasonably stable. When this is suspected, running the algorithm on randomly selected subsets of the data, or on bootstrap samples can assist in assessing the variability.