
    M/Ph                     J    d Z ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 d	dZdS )
zZ
Burg's method for estimating AR(p) model parameters.

Author: Chad Fulton
License: BSD-3
    N)Bunch)linear_model)SARIMAXSpecification)SARIMAXParamsTc                    t          | |          }|j        } t          j        | j        t          j        t
                              r| dz  } |j        st          d          t          |          }|dk    rt          j	        |           |_
        n$t          j        | ||          \  |_        |_
        t          d|i          }||fS )a'  
    Estimate AR parameters using Burg technique.

    Parameters
    ----------
    endog : array_like or SARIMAXSpecification
        Input time series array, assumed to be stationary.
    ar_order : int, optional
        Autoregressive order. Default is 0.
    demean : bool, optional
        Whether to estimate and remove the mean from the process prior to
        fitting the autoregressive coefficients.

    Returns
    -------
    parameters : SARIMAXParams object
        Contains the parameter estimates from the final iteration.
    other_results : Bunch
        Includes one component, `spec`, which is the `SARIMAXSpecification`
        instance corresponding to the input arguments.

    Notes
    -----
    The primary reference is [1]_, section 5.1.2.

    This procedure assumes that the series is stationary.

    This function is a light wrapper around `statsmodels.linear_model.burg`.

    References
    ----------
    .. [1] Brockwell, Peter J., and Richard A. Davis. 2016.
       Introduction to Time Series and Forecasting. Springer.
    )ar_orderg      ?z\Burg estimation unavailable for models with seasonal or otherwise non-consecutive AR orders.)specr   )orderdemeanr	   )r   endognp
issubdtypedtypeintis_ar_consecutive
ValueErrorr   varsigma2r   burg	ar_paramsr   )r   r   r   r	   pother_resultss         e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/tsa/arima/estimators/burg.pyr   r      s    F  999DJE
 
}U["(3--00 ! N M N N 	N 	4   A1}}6%== , 1%x9?!A !A !AQX   M m    )r   T)__doc__numpyr   statsmodels.tools.toolsr   statsmodels.regressionr   #statsmodels.tsa.arima.specificationr   statsmodels.tsa.arima.paramsr   r    r   r   <module>r"      s         ) ) ) ) ) ) / / / / / / D D D D D D 6 6 6 6 6 6= = = = = =r   