statsmodels.tsa.statespace.sarimax.SARIMAX.score_obs#
- SARIMAX.score_obs(params, method='approx', transformed=True, includes_fixed=False, approx_complex_step=None, approx_centered=False, **kwargs)#
Compute the score per observation, evaluated at params
- Parameters:
- paramsarray_like
Array of parameters at which to evaluate the score.
- method{‘approx’, ‘harvey’},
optional The method by which the score is calculated. Default is ‘approx’.
- transformedbool,
optional Whether or not params is already transformed. Default is True.
- includes_fixedbool,
optional If parameters were previously fixed with the fix_params method, this argument describes whether or not params also includes the fixed parameters, in addition to the free parameters. Default is False.
- approx_complex_stepbool,
optional Whether or not to approximate the derivatives of the loglikelihood using complex step differentiation. Default is True.
- approx_centeredbool,
optional Whether or not to use a centered approximation for finite difference derivatives, when approx_complex_step is False. Default is False.
- **kwargs
Additional arguments to the loglike method.
- Returns:
- score
ndarray Score per observation, evaluated at params, shaped (nobs, k_params). If parameters were fixed with the fix_params method and includes_fixed is False, it has a column for each free parameter only, as score.
- score
Notes
This is a numerical approximation. By default, it is calculated using first-order complex step differentiation on the loglikeobs method, or finite differences if approx_complex_step is False. The “harvey” method uses the method from Harvey (1989), section 3.4.5.
If transformed is False and method is “harvey” or complex step differentiation is used, the score with respect to the untransformed parameters is computed from the score with respect to the transformed parameters by the chain rule.
Changed in version 0.16.0: With
transformed=False, the “harvey” method returned the score with respect to the transformed parameters, at the untransformed parameters, and the default complex step differentiation was applied through transform_params, which gave wrong values for models whose transformation is not complex differentiable, such as VARMAX.With the “harvey” method and finite differences,
approx_centered=Truewas ignored and forward differences were used.With fixed parameters and
includes_fixed=False, the score has a column for each free parameter only. It also had columns for the fixed parameters, and withtransformed=Falseit was evaluated with the fixed values transformed as if they were unconstrained.