* Fruewirth-Schnatter's method for upper utility sampling, where
* instead of sampling the predictors, we use the mean.
*/
final MultivariateGaussian predictivePrior = particle.getLinearState().clone();
KalmanFilter kf = particle.getRegressionFilter();
final Matrix G = kf.getModel().getA();
final Matrix F = data.getObservedData();
predictivePrior.setMean(G.times(predictivePrior.getMean()));
predictivePrior.setCovariance(
G.times(predictivePrior.getCovariance()).times(G.transpose())
.plus(kf.getModelCovariance()));
final Vector betaSample =
predictivePrior.sample(getRandom());
// predictivePrior.getMean();
final double predPriorObsMean =
F.times(betaSample).getElement(0);
final int particleCount;
if (particleEntry.getValue() instanceof MutableDoubleCount) {
particleCount = ((MutableDoubleCount)particleEntry.getValue()).count;
} else {
particleCount = 1;
}
for (int p = 0; p < particleCount; p++) {
final double dSampledAugResponse = sampleAugResponse(predPriorObsMean, isOne);
Vector sampledAugResponse = VectorFactory.getDefault().copyValues(dSampledAugResponse);
for (int j = 0; j < 10; j++) {
final LogitMixParticle predictiveParticle = particle.clone();
predictiveParticle.setPreviousParticle(particle);
predictiveParticle.setBetaSample(betaSample);
predictiveParticle.setAugResponseSample(sampledAugResponse);
predictiveParticle.setLinearState(predictivePrior);
final UnivariateGaussian componentDist =
this.evDistribution.getDistributions().get(j);
predictiveParticle.setEVcomponent(componentDist);
/*
* Update the observed data for the regression component.
*/
predictiveParticle.getRegressionFilter().getModel().setC(F);
// TODO would be great to have a 1x1 matrix class here...
final Matrix compVar = MatrixFactory.getDefault().copyArray(
new double[][] {{componentDist.getVariance()}});
predictiveParticle.getRegressionFilter().setMeasurementCovariance(compVar);
final double compPredPriorObsMean =
F.times(betaSample).getElement(0)