private LogitMixParticle sufficientStatUpdate(
LogitMixParticle priorParticle, ObservedValue<Vector, Matrix> data) {
final LogitMixParticle updatedParticle = priorParticle.clone();
final KalmanFilter filter = updatedParticle.getRegressionFilter();
final UnivariateGaussian evComponent = updatedParticle.EVcomponent;
final boolean isOne = !data.getObservedValue().isZero();
final int smplLowerIdx = DiscreteSamplingUtil.sampleIndexFromProportions(
getRandom(), updatedParticle.getComponentLikelihoods());
// final int smplLowerIdx = DiscreteSamplingUtil.sampleIndexFromProbabilities(
// getRandom(), this.evDistribution.getPriorWeights());
final UnivariateGaussian partComponent =
this.evDistribution.getDistributions().get(smplLowerIdx);
final double dsampledAugResponse = sampleAugResponse(
updatedParticle.getPriorPredMean(),
updatedParticle.getPriorPredCov(), isOne,
partComponent);
// TODO we should've already set this, so it might be redundant.
filter.setMeasurementCovariance(
MatrixFactory.getDefault().copyArray(new double[][] {{
evComponent.getVariance() + partComponent.getVariance()}}));
final Vector sampledAugResponse =
VectorFactory.getDefault().copyValues(
dsampledAugResponse
- evComponent.getMean().doubleValue()
- partComponent.getMean().doubleValue());
updatedParticle.setAugResponseSample(sampledAugResponse);
final MultivariateGaussian posteriorState = updatedParticle.getLinearState().clone();
filter.update(posteriorState, sampledAugResponse);
updatedParticle.setLinearState(posteriorState);
return updatedParticle;
}