Repository navigation
Mixed-model RESI confidence intervals (lmer and lme) - #57
Merged
Merged
Conversation
- R/resi_mixed_ci.R: asymptotic Var(RESI) from school-level influence values (outcome noise, random design incl. unit counts, sandwich meat, and the variance-component term for the model-based covariance), feeding the existing normal/QF/CF intervals; fast exact CR2 (.mixedCiCR2) used for clubSandwich::vcovCR(type = "CR2") on unweighted lmerMod fits. - resi.lmerMod gains ci.method and ci.design and returns interval columns. - R/mixed_simulations.R: hybridPlasmodeSim() and Lyu-Welsh limit helpers. - Fix the sign of the large-noncentrality branch in .resi_ci_qf. - Mixed point-estimate fixes (n level labels), print rounding, tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ngular fits against clubSandwich Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- .mixedCiBaseLme(): lme4-style representation (X, y, Zt, Lambdat, Lind, theta, sigma) of an lme fit, reproducing lme's beta, vcov and logLik; theta respects pdDiag/pdIdent constraints. Fits with varFunc/corStruct or other pdMat classes fall back to point estimates with a warning. - resi.lme gains ci.method/ci.design; resi.lme and resi.lmerMod share .resiMixedWithCi(). ANOVA heading preserved. - Fast exact CR2 also used for supported lme fits. - Tests: lme vs lmer intervals agree; lme CR2 equals clubSandwich. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…asmode skips rank-deficient replicates - .resi_ci_qf (m1 = 1): P(chi2_1(ncp) >= q) = pnorm(sqrt(ncp) - sqrt(q)) + pnorm(-sqrt(ncp) - sqrt(q)) for all q and ncp. pnchisq warned about lost precision for moderately large arguments and returned 0 in far tails. - hybridPlasmodeSim: replicates whose resampled design loses a factor level (rank-deficient refit) are counted as failed fits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…opes - .resi_ci_mixed(ref.df = NULL): g - 1 for cluster-robust (CR2) intervals, normal otherwise. Normal/QF/CF/signed-CF support a finite reference df; QF/CF use t noise with an unscaled signal, integrated over W ~ chi^2_d with 20-node generalized Gauss-Laguerre quadrature. - resi_pe for mixed models: random-slope terms use the number of units at the slope level as n. - hybridPlasmodeSim/lyuLimitResi support child-level random effects. - Tests for the finite-df intervals and CR2 t widths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds asymptotic confidence intervals for RESI in linear mixed models (
lmerMod,nlme::lme), targeting the Lyu–Welsh large-cluster limit.Changes
.resi_ci_mixed(): normal, quadratic-form (QF) and characteristic-function (CF) intervals for coefficients and ANOVA terms.clubSandwichfor random slopes and singular fits.ref.df = NULL); model-based intervals stay normal.Validation (AIgams repo, branch
mixed-resi-ci:resiLongCalibrationSim/calibration_report.html)mlmRev::egsingle:mlmRev::star.Known limitation: CR2 undercovers for random-slope terms at g = 15.