MeasurementError#

class pymc_experimental.statespace.models.structural.MeasurementError(name: str = 'MeasurementError')[source]#

Measurement error term for a structural timeseries model

Parameters:

name (str, optional) – Name of the observed data. Default is “obs”.

Notes

This component should only be used in combination with other components, because it has no states. It’s only use is to add a variance parameter to the model, associated with the observation noise matrix H.

Examples

Create and estimate a deterministic linear trend with measurement error

from pymc_experimental.statespace import structural as st
import pymc as pm
import pytensor.tensor as pt

trend = st.LevelTrendComponent(order=2, innovations_order=0)
error = st.MeasurementError()
ss_mod = (trend + error).build()

with pm.Model(coords=ss_mod.coords) as model:
    P0 = pm.Deterministic('P0', pt.eye(ss_mod.k_states) * 10, dims=ss_mod.param_dims['P0'])
    intitial_trend = pm.Normal('initial_trend', sigma=10, dims=ss_mod.param_dims['initial_trend'])
    sigma_obs = pm.Exponential('sigma_obs', 1, dims=ss_mod.param_dims['sigma_obs'])

    ss_mod.build_statespace_graph(data, mode='JAX')
    idata = pm.sample(nuts_sampler='numpyro')
__init__(name: str = 'MeasurementError')[source]#

Methods

__init__([name])

build([name, filter_type, verbose])

Build a StructuralTimeSeries statespace model from the current component(s)

make_and_register_data(name, shape[, dtype])

Helper function to create a pytensor symbolic variable and register it in the _name_to_data dictionary

make_and_register_variable(name, shape[, dtype])

Helper function to create a pytensor symbolic variable and register it in the _name_to_variable dictionary

make_symbolic_graph()

populate_component_properties()