void CrossHypotheses::InitializeDerivedQualities() {
  InitializeResponsibility(); // depends on hypotheses
  InitializeTmpVariables();

  // in theory don't need to compute any but test flows
  ComputeBasicResiduals(); // predicted and measured

  InitializeSigma(); // depends on predicted
  ComputeBasicLikelihoods(); // depends on residuals and sigma
  // compute log-likelihoods
  ComputeLogLikelihoods();  // depends on test flow(s)
}
void CrossHypotheses::InitializeDerivedQualities() {

    InitializeResponsibility(); // depends on hypotheses
    // in theory don't need to compute any but test flows
    SetModPredictions();  // make sure that mod-predictions=predictions
    ComputeBasicResiduals(); // predicted and measured

    InitializeSigma(); // depends on predicted

    my_t.SetV(heavy_tailed);

    ComputeBasicLikelihoods(); // depends on residuals and sigma
    // compute log-likelihoods
    ComputeLogLikelihoods();  // depends on test flow(s)
}
// responsibility depends on the relative global probability of the hypotheses and the likelihoods of the observations under each hypothesis
// divide the global probabilities into "typical" data points and outliers
// divide the variant probabilities into each hypothesis (summing to 1)
// treat the 2 hypothesis case to start with
void CrossHypotheses::UpdateResponsibility(const vector<float > &hyp_prob, float typical_prob) {

    if (!success) {
        //cout << "alert: fail to splice still called" << endl;
        InitializeResponsibility();
    } else {
        //  vector<double> tmp_prob(3);
        tmp_prob_d[0] = (1.0f-typical_prob)*scaled_likelihood[0];   // i'm an outlier
        for (unsigned int i_hyp=1; i_hyp<scaled_likelihood.size(); i_hyp++)
            tmp_prob_d[i_hyp] = typical_prob * hyp_prob[i_hyp-1] * scaled_likelihood[i_hyp];

        double ll_denom = 0.0;
        for (unsigned int i_hyp=0; i_hyp<scaled_likelihood.size(); i_hyp++) {
            ll_denom += tmp_prob_d[i_hyp];
        }

        for (unsigned int i_hyp=0; i_hyp<responsibility.size(); i_hyp++)
            responsibility[i_hyp] = tmp_prob_d[i_hyp]/ll_denom;
    }
}