Affine Kernel Dressing transforms the discrete K-member forecast ensemble at time instance n, `ens[n, ]`, to a continuous distribution function for the target `y` by the equation:
p(y|ens) = 1 / K * sum dnorm(y, z.i, s)
where s = (4/3/K)^0.4 * (s1 + s2 * a^2 * var(ens))
and z.i = r1 + r2 * mean(ens) + a * ens
The parameters r1, r2, a, s1, s2 are fitted by minimizing the continuously ranked probability score (CRPS). The optimization is carried out using the R function `optim(...)`.
Since the evaluation of the CRPS is numerically expensive, the optimization can take a long time. Speed can be increased by optimizing the parameters only for a part of the forecast instances.