# statsmodels.tsa.ar_model.AR.fit¶

AR.fit(maxlag=None, method='cmle', ic=None, trend='c', transparams=True, start_params=None, solver='lbfgs', maxiter=35, full_output=1, disp=1, callback=None, **kwargs)[source]

Fit the unconditional maximum likelihood of an AR(p) process.

Parameters
maxlagint

If ic is None, then maxlag is the lag length used in fit. If ic is specified then maxlag is the highest lag order used to select the correct lag order. If maxlag is None, the default is round(12*(nobs/100.)**(1/4.)).

method{‘cmle’, ‘mle’}, optional

The method to use in estimation.

• ‘cmle’ - Conditional maximum likelihood using OLS

• ‘mle’ - Unconditional (exact) maximum likelihood. See solver and the Notes.

ic{‘aic’,’bic’,’hic’,’t-stat’}

Criterion used for selecting the optimal lag length.

• ‘aic’ - Akaike Information Criterion

• ‘bic’ - Bayes Information Criterion

• ‘t-stat’ - Based on last lag

• ‘hqic’ - Hannan-Quinn Information Criterion

If any of the information criteria are selected, the lag length which results in the lowest value is selected. If t-stat, the model starts with maxlag and drops a lag until the highest lag has a t-stat that is significant at the 95 % level.

trend{‘c’,’nc’}

Whether to include a constant or not.

• ‘c’ - include constant.

• ‘nc’ - no constant.

transparamsbool, optional

Whether or not to transform the parameters to ensure stationarity. Uses the transformation suggested in Jones (1980).

start_paramsarray_like, optional

A first guess on the parameters. Default is cmle estimates.

solverstr or None, optional

Solver to be used if method is ‘mle’. The default is ‘lbfgs’ (limited memory Broyden-Fletcher-Goldfarb-Shanno). Other choices are ‘bfgs’, ‘newton’ (Newton-Raphson), ‘nm’ (Nelder-Mead), ‘cg’ - (conjugate gradient), ‘ncg’ (non-conjugate gradient), and ‘powell’.

maxiterint, optional

The maximum number of function evaluations. Default is 35.

full_outputbool, optional

If True, all output from solver will be available in the Results object’s mle_retvals attribute. Output is dependent on the solver. See Notes for more information.

dispbool, optional

If True, convergence information is output.

callbackfunction, optional

Called after each iteration as callback(xk) where xk is the current parameter vector.

**kwargs

See LikelihoodModel.fit for keyword arguments that can be passed to fit.

Returns
ARResults

Results instance.

statsmodels.base.model.LikelihoodModel.fit

Base fit class with further details about options.

Notes

The parameters after trend are only used when method is ‘mle’.

References

*

Jones, R.H. 1980 “Maximum likelihood fitting of ARMA models to time series with missing observations.” Technometrics. 22.3. 389-95.