Bayesian analysis: Estimate whether a parameter is 0 or not I have the following problem: I need to assess whether a given
parameter $B$ is equal to 0. Let's consider the following model (my problem is more complicated but I think that this example is sufficient):
$$ Y_i \sim N(A \cdot X_i+B,\sigma^2)  $$ 
the observations $Y_i$ being independent conditionally on $A$, $B$, and explanatory variables $(X_i)$. I
used a non-informative prior for $A$, $\sigma$ and $B$. Then I estimate the
95% level hpd interval for $p(B|Y)$ and check whether $0$ belongs to
this interval.
I have two questions regarding this strategy. 
First, is it a correct way to answer the problem? If yes, are there some authoritative references? Perhaps I lack the keywords because I did not find anything. If not,
what is a good alternative to my problem?
Second, in practice $B<0$ has no physical meaning (while analytically there
is no problem to define the model for $B<0$). However, in practice if I
restrict the domain of the prior of $B$ to non-negative values the described
strategy becomes not feasible (I guess). Is it a real problem?
 A: If you are interested in TESTING B=0, then the standard Bayesian solution (i.e. the most accepted), to that problem is the Bayes Factor (BF). Suppose you want to test model 1 against model 2. Let 
$\pi_1(\theta_1|y)= \frac{L(\theta_1)\pi_1(\theta_1)}{p_1(y)}$, $p_1(y)=\int L(\theta_1)\pi_1(\theta_1)d\theta_1$
$\pi_2(\theta_2|y)= \frac{L(\theta_2)\pi_2(\theta_2)}{p_2(y)}$, $p_2(y)=\int L(\theta_2)\pi_2(\theta_2)d\theta_2$
Then the BF of model 1 against model 2 is simply $BF_{12}=p_1(y)/p_2(y)$ and it tells, for instance, how much likely is model 1 with respect to model 2. 
BFs automatically penalise for model complexity and are asymptotically related to the BIC information criterion. See Kass and Raftery (1995) https://www.stat.washington.edu/raftery/Research/PDF/kass1995.pdf for more dails on its interpretation.
It does have some problems, though. For instance, it is not well-defined with improper priors. See, for instance, Robert and Marin (2007)
http://www.amazon.com/Bayesian-Core-Practical-Computational-Statistics/dp/0387389792.
Of course, not ALL Bayesians are happy with BFs. Some prefer to use the DIC or similar Bayesian information criteria. There are also some proposals for Bayesian testing via HPDs or credible intervals, but in my opinion, this approach is quite limited, and is not yet widely accepted. See, for instance this issue What is the connection between credible regions and Bayesian hypothesis tests?.
A: The model you describe is simple univariate linear regression and what you want to do is to test wether your intercept is greater then zero. You can use MCMC obtaining posterior distribution of such model and then you can check what is the proportion of cases where $B > 0$:
$$ \Pr(B > 0) = \frac{1}N \sum^N_{i=1} \mathbf{1}(B_i) $$
where
$$
\mathbf{1}(B_i) =
\begin{cases} 
1 &\text{if } & B_i > 0, \\
0 &\text{if } & B_i \leq 0.
\end{cases}
$$
for all $B_i$ values from $i = 1,...,N$ MCMC replications. This gives you posterior probability of $B > 0$. Since $B$ is continuous checking whether it is exactly zero does not make sense. Examples of using such approach could be found in possibly any handbook on Bayesian statistics.
If you restrict the range of $B$'s by choosing some prior that is only positive, then there is no point in checking if there are posterior $B$ values less then zero. In Bayesian approach you choose some priors for your parameters and every prior brings some information in your model ("noninformative" is a misleading term), however in many cases you do not want to use prior to restrict range of your values, but rather you use prior that enables "improbable" values with lower probability (example here). On the other hand, if values of $B$ simply cannot be less then zero, then you can restrict your prior but you should describe this approach and its rationale in your report.
