# Taking the difference of two MCMC chains

We are interested in determining whether a basketball player is more likely to make their second shot if they made their first. We now consider two parameters for our Bernoulli distributions θ1 and θ2.These parameters will then determine the likelihood of making the second throw. θ1 is the parameter for our Bernoulli distribution which gives us the probability of making the second throw given we have won the first, and our θ2 parameter is used to give us the probability of making the second throw if we have lost the first.

Say we have two MCMC chains, acquired through Gibbs sampling methods, the two chains are sampled from the un-normalized beta distributions of our thetas, for the purpose of determining the most probable parameter of their corresponding Bernouli distributions. How now do we determine how different the two chains are and if a player is more likely to make their second shot given they have made their first.

In Kruschke's book the differnce of the two chains are taken.

If we subtract the two chains, chain1 - chain2

chain 1 : [ [ θa , p(θa) ] , [ θb , p(θb) ] ...]
chain 2 : [ [ θ1 , p(θ1) ] , [ θ2 , p(θ2) ] ...]

We would get a chain of differences, [ [ θa - θ1, p(θa) - p(θ1)] ...] What does this chain of differences allow us to do? I am under the impression that this allows you to compare whether there is a "significant" difference between the two chains, but how exactly does this work?

I understand that 'significance' testing is a problematic area in bayesian inference but how do we determine if the two samplings from our un-normalized distributions are for lack of a better word significant.

• I'm not sure I follow. Why are two chains estimating different parameters...? – Mark White Nov 3 '17 at 0:35
• θ1 is the parameter for the Bernoulli distribution which gives the probability of making the second shot given you have made the first. θ2 is the parameter for the Bernoulli distribution which gives the probability of making the second shot given you have not made the first. – Ricardo C Nov 3 '17 at 0:40
• This is confusing: two Markov chains on the same parameter can be compared to check they have the same distribution AND a Markov chain with two components can be used to infer about the difference of those two components. The problems are unrelated. – Xi'an Nov 3 '17 at 7:18

Taking the difference of two Markov chains produced by the same (?) Gibbs sampler does not tell us much about the stationary distribution of these Markov chains and about their convergence properties. It will mostly reflect on the noise at each iteration and on the impact of the starting values. The relevant thing to check in my opinion is whether the stationary distributions of both chains are the same, which can be evaluated by averages and frequencies. For instance, here are two chains created by Gibbs sampling from two different starting points

T=1e3
x=y=z=w=rep(0,T)
x[1]=y[1]=-1
z[1]=w[1]=+1
for (t in 2:T){
x[t]=.9*y[t-1]+sqrt(.9)*rnorm(1)
z[t]=.9*w[t-1]+sqrt(.9)*rnorm(1)
y[t]=.9*x[t]+sqrt(.9)*rnorm(1)
w[t]=.9*z[t]+sqrt(.9)*rnorm(1)
}
plot(x,y,type="l",col="steelblue")
lines(z,y,col="sienna")
plot(x-z,y-w,type="l",col="gold4")


The plot of the difference (right) does not tell much about the different behaviour of the two chains (left):