Transformations are when you literally “transform” your data into something slightly different. For example, you can transform the data set {4, 5, 6} by subtracting 1, so the set becomes {3, 4, 5}. The many reasons why you might want to transform your data include: reducing skew, normalizing your data or simply making the data easier to understand. For example, the familiar Richter scale is actually a logarithmic transformation: an earthquake of magnitude 4 or 6 is easier to understand than a magnitude of 10,000 or 1,000,000.

**Contents:**

- Time Series Transformation
- Common Transformation Types
- Transformations in Matrices, Regression & Hypothesis Testing

## 1. Time Series Transformation

Most real-life data sets aren’t stationary. If you’ve got a real-life data set, in most cases you won’t be able to run any processes on the data set directly, and you won’t be able to make useful predictions from it. One solution is to make the model stationary by transforming it. A stationary data set will not experience a change in distribution shape when there’s a shift in time; Basic properties of the distribution like the mean, variance and covariance remain constant. This makes the model better at predictions. After you’ve made predictions, the transformations are reversed so that the new model predicts the behavior of the original time series.Some models can’t be easily transformed—like models with seasonality, which refers to regular, periodic fluctuations in time series data. These can sometimes be broken down into smaller pieces (a process called *stratification*) and individually transformed. Another way to deal with seasonality is to subtract the mean value of the periodic function from the data.

## Common Transformation Types

Transformations might include:

**Differencing:**differenced data has one less point than the original data. For example, given a series Z_{t}you can create a new series Y_{i}= Z_{i}– Z_{i}– 1.**Fitting a curve to the data:**after you have fit the curve, you can then model the residuals from that curve. Curve fitting algorithms include: gradient descent, Gauss-Newton and the Levenberg–Marquardt algorithm.**Taking the logarithm.**Log transformation is where you take the natural logarithm of variables in a data set.**Square root transformations**. Simply take the square root of your variables, i.e. x → x^{(1/2)}= sqrt(x). This will have a moderate effect on the distribution and usually works for data with non-constant variance. However, it is considered to be weaker than logarithmic or cube root transforms.**Taking the square:**x → x^{2}can reduce left skewness. It has a medium effect on data.**Cube Root Transformations:**x → x^{(1/3)}is useful for reducing right skewness. Can be applied to positive and negative values.**Reciprocal Transformations:**the reciprocal transformation x → 1/x has a very large change on the shape of a distribution and reverses the order of values with the same sign; The negative reciprocal, x to -1/x, also has a drastic effect but preserves the variable order. This can be a particularly useful transformation for a set of positive variables where a reverse makes sense. For example, if you have number of patients per doctor, you can transform to doctors per patient (Cox, 2005).

## Other Transformations

Many different types of transformations are used in different areas of statistics.

**Normalization in Hypothesis Testing / Regression Analysis**

A Box Cox transformation is used when you need to meet the assumption of normality for a statistical test or procedure. It transform non-normal dependent variables into a normal shape. Another way to normalize data is to use the Tukey ladder of powers (sometimes called the Bulging Rule), which can change the shape of a skewed distribution so that it becomes normal or nearly-normal. A third, related procedure, is a Fisher Z-Transformation. The Fisher Z transforms the sampling distribution of Pearson’s r (i.e. the correlation coefficient) so that it becomes normally distributed.

**Matrix Albegra:**

A vector transformation is a specific type of mapping where you associate vectors from one vector space with vectors in another space. Linear transformation, sometimes called linear mapping, is a special case of a vector transformation.

Generalized Procrustes analysis, which compares two shapes in Factor Analysis, uses geometric transformations (i.e. rescaling, reflection, rotation, or translation) of matrices to compare the sets of data. The following image shows a series of transformations onto a green target triangle.

## References

Cox, N. (2005). Transformations: An Introduction. Retrieved February 25, 2018 from: http://fmwww.bc.edu/repec/bocode/t/transint.html

If you prefer an online interactive environment to learn R and statistics, this *free R Tutorial by Datacamp* is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try *this Statistics with R track*.

*Facebook page*and I'll do my best to help!