Rotates an array into two parts, one of which has mean zero.

1 | ```
demean_tensor(X, mode_reps)
``` |

`X` |
An array, one of whose modes is assumed to be samples from the array normal model. |

`mode_reps` |
The mode(s) that contain(s) the samples, or repetitions, from the array normal model. |

If one mode contains samples (or repetitions), then this function
will rotate the array into two parts, a mean part and a covariance
part. The 'covariance part' has mean zero and the rest of the
methods in this package apply. The 'mean part' is simply the sample
mean. If the data are array normal, then the 'covariance part' will
also be array normal with the *exact* same covariance
structure as the original tensor, except that there are one fewer
samples.

`Y`

An array that has the same dimensions as `X`

except that the mode `mode_reps`

has dimension one
smaller. This array is mean 0 array normal with the same
covariance structure as `X`

.

`X_bar`

The sample mean of `X`

. Under the array normal
model, `X`

and `Y`

are statistically independent.

David Gerard.

Gerard, D., & Hoff, P. (2015).
Equivariant
minimax dominators of the MLE in the array normal model. *Journal of
Multivariate Analysis*, 137, 32-49.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.