Repository navigation
Conversation
This was referenced Nov 24, 2026
bashtage
force-pushed
the
wip-dynamic-factor-ar-errors-start
branch
2 times, most recently
from
November 24, 2026 16:18
095f128 to
64f1379
Compare
| # The innovation variances of the autoregressions, as in the | ||
| # other cases: their mean ("scalar"), themselves ("diagonal") or | ||
| # the Cholesky factor of their diagonal matrix ("unstructured") | ||
| error_cov_params = np.r_[error_cov_params] |
bashtage
force-pushed
the
wip-dynamic-factor-ar-errors-start
branch
from
November 25, 2026 12:14
64f1379 to
eeaaccc
Compare
With autoregressive errors (error_order > 0, error_var=False), DynamicFactor.start_params filled the error covariance parameters with the innovation variance of each series' autoregression whatever the error_cov_type, so with error_cov_type="scalar" (one parameter) or "unstructured" (k_endog (k_endog + 1) / 2 parameters) it raised "ValueError: could not broadcast input array from shape (3,) into shape (1,)" (or "(6,)"), and so did fit without start_params. Stacked on statsmodels#11133 (the start of an unstructured error covariance with VAR errors), which changes the neighbouring lines. Changes - As for white noise and VAR errors, the start is the mean of the innovation variances ("scalar") or the Cholesky factor of their diagonal matrix ("unstructured"); "diagonal" is unchanged. Not changed - error_cov_type="diagonal", and the other starting parameters. Tests (test_dynamic_factor.py) - Without factors and with an AR(1) error, and with a factor and AR(1) or AR(2) errors: the "scalar" and "unstructured" error covariance starts are the mean and the square roots (on the diagonal of the lower triangle) of the "diagonal" start, the other starting parameters equal those with "diagonal", and the "unstructured" start gives the log-likelihood of the "diagonal" start (the same covariance matrix). All six cases fail on statsmodels#11133.
bashtage
force-pushed
the
wip-dynamic-factor-ar-errors-start
branch
from
November 28, 2026 22:06
eeaaccc to
02713f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#11133 and #11083, which this PR was stacked on, are merged. It changes the error block of
start_paramsnext to the change of #11133. Merges cleanly with #11085-#11089 and #11121.BUG: Start the DynamicFactor error covariance of AR errors by its type
With autoregressive errors (error_order > 0, error_var=False),
DynamicFactor.start_params filled the error covariance parameters with the
innovation variance of each series' autoregression whatever the
error_cov_type, so with error_cov_type="scalar" (one parameter) or
"unstructured" (k_endog (k_endog + 1) / 2 parameters) it raised
"ValueError: could not broadcast input array from shape (3,) into shape
(1,)" (or "(6,)"), and so did fit without start_params.
Stacked on #11133 (the start of an unstructured error covariance with VAR
errors), which changes the neighbouring lines.
Changes
innovation variances ("scalar") or the Cholesky factor of their diagonal
matrix ("unstructured"); "diagonal" is unchanged.
Not changed
Tests (test_dynamic_factor.py)
Without factors and with an AR(1) error, and with a factor and AR(1) or
AR(2) errors: the "scalar" and "unstructured" error covariance starts are
the mean and the square roots (on the diagonal of the lower triangle) of
the "diagonal" start, the other starting parameters equal those with
"diagonal", and the "unstructured" start gives the log-likelihood of the
"diagonal" start (the same covariance matrix). All six cases fail on
ENH: Add error_cov_start to choose the DynamicFactor error covariance start #11133.
tests added / passed.
code/documentation is well formatted.
properly formatted commit message. See
NumPy's guide.
AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the
<...>placeholders in the second option with the tool name(s) and how the tool's output was
used.
Tool(s): Claude Code (Claude Opus 5.5).
Used for: finding the bug in a coverage audit of the state space code, writing the fix and its tests, and checking them (tests failing on the base, mutation check).
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.
🤖 Generated with Claude Code