Compute Bhat / Shat for one outcome block (joint-sigma2 form)
Source:R/computational_functions.R
cal_Bhat_Shat.RdMarginal OLS coefficient and its joint-sigma2 standard error, suitable for the SER kernel inside SuSiE-style IBSS updates.
Replaces the previous per-(SNP, trait) marginal-residual-variance form that was breaking variational consistency. The per-SNP regressions are gone, so this is also substantially faster (one matrix multiply instead of J*p univariate fits).
Usage
cal_Bhat_Shat(
Y,
X,
sigma2,
lowc_wc = NULL,
ind_analysis = NULL,
v1 = NULL,
resid_var = NULL,
...
)Arguments
- Y
N x J outcome matrix (one column per wavelet position or per univariate trait inside the modality).
- X
N x p predictor matrix (assumed centred/scaled, but correctness does not depend on that).
- sigma2
Numeric, length 1 or length J. The CURRENT IBSS residual-variance estimate for each column of Y. A scalar is recycled to length J via rep_len.
- lowc_wc
Optional integer vector of column indices of Y to mask (low-count wavelet coefficients). Bhat zeroed, Shat set to 1 so they contribute nothing to BF.
- ind_analysis
Optional. NULL -> use all rows. If a list, ind_analysis[[j]] is the row subset for column j of Y (per-trait missingness). If a vector, common subset for all columns.
- v1
Ignored — kept for backward signature compatibility.
- resid_var
Ignored — kept for backward signature compatibility. Pass sigma2 instead.
- ...
Swallowed.