# Multivariate linear regression with different prior distributions for coefficients

Hi, first time user of Pymc3. I’m trying to fit a multivariate Bayesian linear regression model where a portion of the coefficients (beta1) have Gaussian prior, and the remaining coefficients (beta2) have lognormal prior (because they have to be positive). The likelihood is Gaussian. I have some code below which does run but I’m not sure if it’s doing the right thing, so it would be helpful if someone can help double check (or suggest ways how to double check). I’m mainly concerned if the logic of splitting the design matrix in the likelihood is correct.

``````  designmatrixpart1 = designmatrix[:, beta1indices]
designmatrixpart2 = designmatrix[:, beta2indices]
with Model() as model:

sigma = InverseGamma("sigma", alpha=3.0,beta=0.5, testval=1.0)

beta1=pm.Normal('beta1', mu=priormean1,
sigma=priorcovariance1,
shape=priormean1.shape[0])
tau=5
beta2 = pm.Lognormal('beta2', mu=np.log(priormean2 - 1 / (2 * tau),
tau=tau,
shape=priormean2.shape[0])

likelihood = pm.Normal("y", mu=pm.math.dot(designmatrixpart1, beta1) + pm.math.dot(
designmatrixpart2, beta2), sigma=sigma, observed=data)

trace = sample(10000, return_inferencedata=True, chains=1, init='jitter+adapt_diag', tune=5000, target_accept=0.85)``````