statsmodels.regression.recursive_ls.RecursiveLSResults.get_smoothed_decomposition

RecursiveLSResults.get_smoothed_decomposition(decomposition_of='smoothed_state', state_index=None)

Decompose smoothed output into contributions from observations

Parameters:
decomposition_of{“smoothed_state”, “smoothed_signal”}

The object to perform a decomposition of. If it is set to “smoothed_state”, then the elements of the smoothed state vector are decomposed into the contributions of each observation. If it is set to “smoothed_signal”, then the predictions of the observation vector based on the smoothed state vector are decomposed. Default is “smoothed_state”.

state_indexarray_like, optional

An optional index specifying a subset of states to use when constructing the decomposition of the “smoothed_signal”. For example, if state_index=[0, 1] is passed, then only the contributions of observed variables to the smoothed signal arising from the first two states will be returned. Note that if not all states are used, the contributions will not sum to the smoothed signal. Default is to use all states.

Returns:
data_contributionspd.DataFrame

Contributions of observations to the decomposed object. If the smoothed state is being decomposed, then data_contributions is shaped (k_states x nobs, k_endog x nobs) with a pd.MultiIndex index corresponding to state_to x date_to and pd.MultiIndex columns corresponding to variable_from x date_from. If the smoothed signal is being decomposed, then data_contributions is shaped (k_endog x nobs, k_endog x nobs) with pd.MultiIndex-es corresponding to variable_to x date_to and variable_from x date_from.

obs_intercept_contributionspd.DataFrame

Contributions of the observation intercept to the decomposed object. If the smoothed state is being decomposed, then obs_intercept_contributions is shaped (k_states x nobs, k_endog x nobs) with a pd.MultiIndex index corresponding to state_to x date_to and pd.MultiIndex columns corresponding to obs_intercept_from x date_from. If the smoothed signal is being decomposed, then obs_intercept_contributions is shaped (k_endog x nobs, k_endog x nobs) with pd.MultiIndex-es corresponding to variable_to x date_to and obs_intercept_from x date_from.

state_intercept_contributionspd.DataFrame

Contributions of the state intercept to the decomposed object. If the smoothed state is being decomposed, then state_intercept_contributions is shaped (k_states x nobs, k_states x nobs) with a pd.MultiIndex index corresponding to state_to x date_to and pd.MultiIndex columns corresponding to state_intercept_from x date_from. If the smoothed signal is being decomposed, then state_intercept_contributions is shaped (k_endog x nobs, k_states x nobs) with pd.MultiIndex-es corresponding to variable_to x date_to and state_intercept_from x date_from.

prior_contributionspd.DataFrame

Contributions of the prior to the decomposed object. If the smoothed state is being decomposed, then prior_contributions is shaped (nobs x k_states, k_states), with a pd.MultiIndex index corresponding to state_to x date_to and columns corresponding to elements of the prior mean (aka “initial state”). If the smoothed signal is being decomposed, then prior_contributions is shaped (nobs x k_endog, k_states), with a pd.MultiIndex index corresponding to variable_to x date_to and columns corresponding to elements of the prior mean.

Notes

Denote the smoothed state at time \(t\) by \(\alpha_t\). Then the smoothed signal is \(Z_t \alpha_t\), where \(Z_t\) is the design matrix operative at time \(t\).


Last update: Oct 03, 2024