September 2017
Beginner to intermediate
304 pages
7h 2m
English
We have already seen that PACF gives us the coefficients for various orders in our AR model. Taking advantage of this, we can get the coefficients for our first and second lag terms along with the intercept (or error term) in our model using a slightly modified version of the pacf() function shown in the following code:
// autoregressive calculates an AR model for a series // at a given order. func autoregressive(x []float64, lag int) ([]float64, float64) { // Create a regresssion.Regression value needed to train // a model using github.com/sajari/regression. var r regression.Regression r.SetObserved("x") // Define the current lag and all of the intermediate lags. for i := 0; i < lag; i++ { r.SetVar(i, ...Read now
Unlock full access