mmse#
- swordfish.function.mmse()#
Return the coefficient estimates of X and mean square errors of an ordinary- least-squares regression of Y on X with intercept with a rolling window. The length of the window is given by the parameter window.
The mean square error (MSE) is calculated with the following formula:
\[\begin{align*} MSE &= \frac{1}{n}\sum_{i=1}^n\left(Y_i-\hat{Y}_i\right)^2 \end{align*}\]- Parameters:
Y (Constant) – A vector indicating the dependent variable.
X (Constant) – A vector indicating the independent variable.
window (Constant) – An integer no smaller than 2 or a scalar of DURATION type indicating the size of the sliding window. Note: The window size is capped at 102400 when m-functions are used in the streaming engines.
minPeriods (Constant, optional) – A positive integer indicating the minimum number of observations in a window required to be not null (otherwise the result is NULL).
- Returns:
A tuple with 2 vectors. The first vector is the coefficient estimates and the second vector is the mean square errors. Each vector is of the same length as X and Y.
- Return type: