The model is either:

  • y_i = X1_base*alpha1 + X1_list_[i]*alpha2 + X2*beta + e, e ~ N(0,1/Y_prec[i]*V)

  • y_i = X1_base*alpha1 + X1_list_[i]*alpha2 + X2*V_*beta + e, e ~ N(0,1/Y_prec[i]*V)

Where V = RtR, priors on elements of alpha1, alpha2 and beta are independent. Each column of Y is considered independent

regression_sampler_parallel(
  Y,
  X1_base,
  X1_list_,
  X2,
  Vx_,
  h2s_index,
  chol_V_list_,
  Y_prec,
  Y_prec_a0,
  Y_prec_b0,
  prior_prec_alpha1,
  prior_prec_alpha2,
  prior_mean_beta,
  prior_prec_beta
)

Arguments

Y

n x p matrix of observations

X1_base

n x a1 matrix of X1 covariates common to all p. Can be NULL

X1_list_

p-list of n x a2 matrices of X1 covariates unique to each p. Can be NULL

X2

either X2, a n x b matrix, or Ux, a n x m matrix. If Ux, then V must be non-NULL

h2s_index

p-vector of indices for to select appropriate V of each trait

chol_V_list_

list of cholesky decompositions of V: RtR (each nxn). Can be either dense or sparse

Y_prec

p-vector of Y current precisions

Y_prec_a0, Y_prec_b0

scalars giving the shape and rate of the Gamma distribution for the prior on Y_prec

prior_prec_alpha1

a1 x p matrix of prior precisions for alpha1

prior_prec_alpha2

p-vector of precision of alpha2s for each trait

prior_mean_beta

b x p matrix of prior means of beta

prior_prec_beta

b x p matrix of prior precisions of beta

V_

m x b matrix if X2 is Ux, otherwise NULL

Value

List with elements:

  • alpha1 a1 x p matrix of alpha1

  • alpha2 concatenated vector of alpha2 for all traits

  • beta b x p matrix of beta

  • Y_prec p x 1 vector of Y_prec