Using a single parameter covariance matrix


#1

Here is a really simple gaussian model. The problem I am having has to do with specifying the covariance matrix of the likelihood. If I use a pre-determined value such as np.eye(len(Y)), the model samples within 1 minute. However, if I change the covariance matrix such that there is a single variable along the diagonal of the covariance matrix, tau * np.eye(len(Y)), then the model takes >6 hours to sample. Does anyone know why this is?

linear_model = pm.Model()
Y = X_prop[0,:]
with linear_model:
   tau = pm.HalfNormal('sd', sd=5.)
   m = pm.MvNormal('means', mu = np.array([0 for i in range(len(Y))]), cov = np.diag([2.0 for i in range(len(Y))]), shape = len(Y))
   lik = pm.MvNormal('lik', mu = m, cov = tau * np.eye(len(Y)), shape = len(Y), observed=Y )
   trace = pm.sample(1000, tune=1000,njob=1)

#2

Can you share some of the data you are using to reproduce the problem?