sts_decompose_forecast_by_component: Decompose a forecast distribution into contributions from...

View source: R/sts-functions.R

sts_decompose_forecast_by_componentR Documentation

Decompose a forecast distribution into contributions from each component.

Description

Decompose a forecast distribution into contributions from each component.

Usage

sts_decompose_forecast_by_component(model, forecast_dist, parameter_samples)

Arguments

model

An instance of sts_sum representing a structural time series model.

forecast_dist

A Distribution instance returned by sts_forecast(). (specifically, must be a tfd.MixtureSameFamily over a tfd_linear_gaussian_state_space_model parameterized by posterior samples).

parameter_samples

list of tensors representing posterior samples of model parameters, with shapes list(tf$concat(list(list(num_posterior_draws), param<1>$prior$batch_shape, param<1>$prior$event_shape), list(list(num_posterior_draws), param<2>$prior$batch_shape, param<2>$prior$event_shape), ... ) ) for all model parameters. This may optionally also be a named list mapping parameter names to tensor values.

Value

component_dists A named list mapping component StructuralTimeSeries instances (elements of model$components) to Distribution instances representing the marginal forecast for each component. Each distribution has batch shape matching forecast_dist (specifically, the event shape is [num_steps_forecast]).

See Also

Other sts-functions: sts_build_factored_surrogate_posterior(), sts_build_factored_variational_loss(), sts_decompose_by_component(), sts_fit_with_hmc(), sts_forecast(), sts_one_step_predictive(), sts_sample_uniform_initial_state()


tfprobability documentation built on Sept. 1, 2022, 5:07 p.m.