This function presents diagnostic plots of estimate Yhat and response Y.

1 | ```
Ydiagnostics(Y, Yhat, ...)
``` |

`Y` |
R object representing response, coercible to a vector. |

`Yhat` |
R object representing estimate, coercible to a vector. The length of Y and Yhat must be equal. |

`...` |
Options for |

The plots shown are:

Y vs Yhat. Under a perfect noise-free fitting, this would be a straight line with the points lined up on the red line, and the correlation wpuld be 1.0000.

Y, Yhat and Y-Yhat (residual) time domain plots. The time steps are in samples.

These show the ACF for the original Y, the residual, and |residual|. The latter helps identify nonlinearity in the residual.

Invisibly returns TRUE; this routine is only used for its graphical side effects described in Details.

`cor`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# The order here looks backwards, but is chosen to
# simulate a typical pair - Yhat will normally have
# a smaller range than Y.
set.seed(2)
nObs <- 100 # Number of observations
x <- stats::filter(rnorm(nObs),c(-0.99),
method="recursive")
x <- x + (x^2) # Nonlinear component
myLags <- 0:2
X <- eTrim(eLag(x,myLags))
Y <- X[,+1,drop=FALSE]
X <- X[,-1,drop=FALSE]
lmObj <- lm(Y ~ X)
Yhat <- predict(lmObj)
Ydiagnostics(Y,Yhat)
``` |

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.