TransferFunctionLinearRegression.priors_from_data#
- TransferFunctionLinearRegression.priors_from_data(X, y)[source]#
Generate data-informed priors that scale with outcome variable.
Computes priors for baseline coefficients, treatment coefficients, and error standard deviation based on the standard deviation of y. This ensures priors are reasonable regardless of data scale.
- Parameters:
X (xr.DataArray) – Baseline design matrix (n_obs, n_baseline_features).
y (xr.DataArray) – Outcome variable (n_obs, 1).
- Returns:
Dictionary with Prior objects for beta, theta_treatment, and sigma.
- Return type:
Dict[str, Prior]
Notes
The returned dictionary contains Prior objects with the following structure:
{ "beta": Prior( "Normal", mu=0, sigma=5 * y_scale, dims=["treated_units", "coeffs"] ), "theta_treatment": Prior( "Normal", mu=0, sigma=2 * y_scale, dims=["treated_units", "treatment_names"], ), "sigma": Prior("HalfNormal", sigma=2 * y_scale, dims=["treated_units"]), }
where
y_scale = std(y).