From 8fa967ab6765a9cc40975abc7c7166ddaf1e7d5c Mon Sep 17 00:00:00 2001 From: Andy Eck Date: Mon, 29 Jun 2026 14:53:20 -0500 Subject: [PATCH] correct wild bootstrap to use perturbed reduced residual rather than full residual per Benjamin Kay Jun 24 email --- +nla/+helpers/wildBootstrap.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/+nla/+helpers/wildBootstrap.m b/+nla/+helpers/wildBootstrap.m index fb964a35..ee7bfac9 100755 --- a/+nla/+helpers/wildBootstrap.m +++ b/+nla/+helpers/wildBootstrap.m @@ -38,13 +38,20 @@ residual = origResidual; end + covariateIsNoise = inContrasts == 0; + %generate new values by using betas from noise only, and adding in %random multiplier of residual + beta_reduced = beta(covariateIsNoise,:); + X_reduced = inX(:,covariateIsNoise); + %Find a residual based off of only the coefficients and x data for those noise coefficients; + residual_reduced = inY - (X_reduced * beta_reduced); + numObs = size(inX,1); residualNoiseMultFactor = getRademacherVector(numObs); - covariateIsNoise = inContrasts == 0; - outY = inX(:,covariateIsNoise) * beta(covariateIsNoise,:) + (residualNoiseMultFactor .* residual); + + outY = X_reduced * beta_reduced + (residualNoiseMultFactor .* residual_reduced); end