projection_mean {BMIselect} | R Documentation |
Projecting Posterior Means of Full-Model Coefficients onto a Reduced Subset Model
Description
Given posterior means of beta1_mat
(and optional intercepts
alpha1_vec
) from a full model fitted on D
imputed
datasets, compute the predictive projection onto the submodel defined by
xs_vec
. Returns the projected coefficients (and intercepts, if requested).
Usage
projection_mean(X_arr, beta1_mat, xs_vec, sigma2, alpha1_vec = NULL)
Arguments
X_arr |
A 3-D array of predictors, of dimension |
beta1_mat |
A |
xs_vec |
Logical vector of length |
sigma2 |
Numeric scalar; the residual variance from the full model (pooled across imputations). |
alpha1_vec |
Optional numeric vector of length |
Value
A list with components:
beta2_mat
A
D * p
matrix of projected submodel coefficients.alpha2_vec
(If
alpha1_vec
provided) numeric vector lengthD
of projected intercepts.
Examples
# Simulate a single imputation with n=50, p=5:
D <- 3; n <- 50; p <- 5
X_arr <- array(rnorm(D * n * p), c(D, n, p))
beta1_mat <- matrix(rnorm(D * p), nrow = D)
# Suppose full-model sigma2 pooled is 1.2
sigma2 <- 1.2
# Project onto predictors 1 and 4 only:
xs_vec <- c(TRUE, FALSE, FALSE, TRUE, FALSE)
proj <- projection_mean(X_arr, beta1_mat, xs_vec, sigma2)
str(proj)
# With intercept:
alpha1_vec <- rnorm(D)
proj2 <- projection_mean(X_arr, beta1_mat, xs_vec, sigma2, alpha1_vec)
str(proj2)