Skip to contents

Given draws from the predictive distribution of the random intercept model, project these draws onto (a subset of) the covariates using Mahalanobis loss. This produces many predictive draws for the regression coefficients, which provides uncertainty quantification.

Usage

proj_posterior_randint(
  post_y_pred,
  XX,
  sub_x = 1:ncol(XX),
  post_sigma_e,
  post_sigma_u,
  post_y_pred_sum = NULL
)

Arguments

post_y_pred

S x m x n matrix of posterior predictive draws at the given XX covariate values

XX

n x p matrix of covariates

sub_x

vector of inclusion indicators for the p covariates; the remaining coefficients will be fixed at zero

post_sigma_e

(nsave) draws from the posterior distribution of the observation error SD

post_sigma_u

(nsave) draws from the posterior distribution of the random intercept SD

post_y_pred_sum

(nsave x n) matrix of the posterior predictive draws summed over the replicates within each subject (optional)

Value

post_beta: the S x p matrix of draws from the projected predictive distribution of the regression coefficients.