Inverts a known aggregation operator Y = T(X) + eps to recover the
fine-scale latent X from coarse / aggregate observations Y, using
a Gaussian-mixture prior on the latent. Implements the
aggregate-likelihood / kernel-downsizing framework (Sejdinovic et
al.) as a kernR-side method consuming an optional
proxymix::fit_proxymix() latent prior.
Usage
aggregate_downscale(
y,
aggregator,
latent_prior,
sigma_y = 0.1,
n_samples_per_component = 200L,
min_ess_fraction = 0.1,
seed = NULL
)Arguments
- y
Numeric vector of length
dim_y, or1 x dim_ymatrix. The observed aggregate.- aggregator
Either a numeric
dim_y x dim_xmatrix (treated as a linear aggregator and dispatched to the closed-form path) or a functionfunction(x) -> y_matrixthat maps ann x dim_xmatrix of latent samples to ann x dim_ymatrix of aggregates (non-linear IS path).- latent_prior
Either (a) a list with elements
means(N x dim_xmatrix or list ofdim_x-vectors),covariances(list ofNdim_x x dim_xmatrices),weights(length-Nnumeric, summing to 1) – or (b) aproxymix::gmm_fit(any object exposing@means,@covariances,@weightsslots).- sigma_y
Numeric. Observation noise standard deviation (scalar;
eps ~ N(0, sigma_y^2 I)). Default0.1.- n_samples_per_component
Integer. Importance-sampling sample count per prior component (non-linear path only). Default
200L.- min_ess_fraction
Numeric in
(0, 1]. ESS-floor reliability gate for the IS path: when per-component ESS drops belowmin_ess_fraction * n_samples_per_component, a warning is emitted. Default0.1. Set0to disable.- seed
Integer or
NULL. Random seed (non-linear path).
Value
An object of class "aggregate_downscale" with components:
posterior_mean– length-dim_xnumeric,E[X | y].posterior_cov–dim_x x dim_xmatrix,Cov[X | y](law-of-total-covariance over mixture components).posterior_weights– length-Nnumeric, posterior mixture weights (sum to 1).posterior_components_means– list ofNlength-dim_xposterior component means.posterior_components_covariances– list ofNposterior component covariances.aggregator_type–"linear"or"nonlinear".method–"linear_closed_form"or"nonlinear_is".ess_per_component– length-Nper-component ESS (IS path only;NAfor closed form).ess_warning–TRUEif any per-component ESS fell below the floor (IS path only).n_components,sigma_y,n_samples_per_component,call.
Details
This is the third downscaling method in kernR, structurally different from the existing pair:
kernel_downscale()(CME, Park-Muandet-Fukumizu-Sejdinovic 2013) – paired (coarse, fine) training data; supervised regression.dist_regression()(Szabo-Sriperumbudur-Poczos-Gretton 2016) – distribution-to-distribution mapping from a bag-of-points design.aggregate_downscale()(this function) – only aggregate observations + known aggregator + parametric latent prior. Used when no paired training data exists (only coarse-grid observations) but the aggregation operator is known (spatial averaging, temporal averaging, linear or non-linear projection).
Two computational paths, selected on aggregator's class:
Linear-Gaussian closed form (when
aggregatoris a matrixA): each prior component's posterior is a Kalman update;K_k = Sigma_k A^T (A Sigma_k A^T + sigma_y^2 I)^{-1};mu_k|y = mu_k + K_k (y - A mu_k),Sigma_k|y = (I - K_k A) Sigma_k; posterior mixture weights reweight by per-component evidenceN(y | A mu_k, A Sigma_k A^T + sigma_y^2 I).Non-linear importance sampling (when
aggregatoris a function): drawn_samples_per_componentsamples from each prior component, evaluateT(.), weight by Gaussian likelihoodN(y | T(x), sigma_y^2 I), recover posterior moments + reweighted mixture weights from the importance-weighted samples. Reports per-component effective sample size; warns when below a stated floor.
The aggregate-likelihood / GMM-proxy direction is shared with the
companion proxymix Tier-2 stub proxymix::from_aggregate_likelihood(),
which targets the same problem from the prior-fitting side; this
function targets it from the consumption side (inversion given a
fitted prior).
See also
kernel_downscale(), dist_regression().
Other downscaling and embeddings:
dist_regression(),
fit_cme(),
kernel_downscale(),
posterior_sample_aggregate()
Examples
set.seed(1L)
# Linear-Gaussian: spatial averaging of two adjacent cells.
A <- matrix(c(0.5, 0.5), nrow = 1L)
prior <- list(
means = list(c(0, 0), c(2, 2)),
covariances = list(diag(2L), diag(2L)),
weights = c(0.5, 0.5)
)
fit <- aggregate_downscale(y = 1.0, aggregator = A,
latent_prior = prior, sigma_y = 0.2)
fit$posterior_mean
#> [1] 1 1
# Non-linear: aggregator is sin of the sum.
agg_fn <- function(x) matrix(sin(rowSums(x)), ncol = 1L)
fit2 <- aggregate_downscale(y = 0.5, aggregator = agg_fn,
latent_prior = prior, sigma_y = 0.1,
n_samples_per_component = 300L, seed = 1L)
#> Warning: aggregate_downscale(): per-component IS effective sample size fell below 10% of n_samples_per_component for component(s) 2 (ESS = 27.9). Increase `n_samples_per_component`, sharpen the prior, or consider a coarser aggregator if posterior is locally narrow.
fit2$posterior_mean
#> [1] 0.8567869 0.8729094
