
function [pom, pov] = BA_nornor1(data, sigma2, mu, tau2)
%-------------------------------------------------------------------
% [pom, pov] = BA_nornor1(data, sigma2, mu, tau2)
% This function will plot the positions
% of modes (means, medians) of the likelihood, 
% prior, and the posterior in the Normal/Normal Case. 
% Inputs are:
%    data - vector of observations
%    sigma2 - variance of data
%    mu, tau2 - prior mean/variance
% Output is posterior mean/variance  [pom, pov]
%    and the locations of the three densities.
% Example of use: 
%   > dat = 10*randn(1,20);
%   > BA_nornor1(dat, 100, 20, 10)
%--------------------------------------------------------------------
n = length(data);
xbar = mean(data);
lambda = tau2/(tau2 + sigma2/n);
pom = lambda * xbar + (1-lambda)*mu;
pov = sigma2/n * tau2/(tau2 + sigma2/n);
figure(111)
 plot([xbar],[0], '.','markersize',50)
 hold on
 plot([mu],[0],  'g.','markersize',50)
 plot([pom],[0], 'r.','markersize',50)
 hold off
%print -depsc 'C:\Brani\Courses\Bayes\Handouts\Figs\bayes3_3.eps'
%------------------- ISyE8843, Fall 2004-----------------------------------
