%posterior predictive - % P(X_n+1) for i=1:MM post_pred_sample(i,:) = expected_function(posterior_sim(i,1),posterior_sim(i,2),posterior_sim(i,3)); % post_var_sample(i,:) = variances_func(posterior_sim(i,1),posterior_sim(i,2),posterior_sim(i,3)); end %now have all the predicted values of fails per month for months 1:m+m2 %now pick out the one that is of interest. %am assuming that this is called from outline 2 which means that we are %interested in predicting month count+1 (outline2 uses the first "count" %observations to estimate the parameters. sorted_post_pred(:,(count+1)) = sort(post_pred_sample(:,(count+1))); upper(count+1)=sorted_post_pred(int32(MM*.025),(count+1)); lower(count+1)=sorted_post_pred(int32(MM*.975),(count+1)); %post_v = mean(post_var_sample); post_prediction(count+1) = mean(post_pred_sample(:,(count+1))); %post_var(count+1) = post_v(count+1) display('#failed in month I+1 -- #predicted -- 95%upper -- 95%lower') [obs(1,(count+1)) post_prediction(count+1) upper(count+1) lower(count+1)]