L0glm provides conditional posterior summaries, selected-model
standard errors and bootstrap selection stability. These optional
calculations are requested in summary() and leave the
fitted point estimates unchanged.
library(L0glm)
set.seed(51)
X <- matrix(rnorm(200*10),200,10)
y <- 1+2*X[,1]-2*X[,2]+rnorm(200)
fit <- l0glmFit(X,y,intercept=TRUE,lambda='gic')Conditional posterior summaries and sampling
posterior <- summary(fit,inference='posterior',
control.inference=list(nsim=2000L,seed=1))$inference
posterior$coefficients
#> term channel selected.estimate mode estimate std.error
#> 1 Intercept 1 1.1742432 1.1742432 1.1742432 0.07887247
#> 2 x2 1 1.9537009 1.9537009 1.9537009 0.08452514
#> 3 x3 1 -1.9873599 -1.9873599 -1.9873599 0.08004978
#> 4 x5 1 -0.1487977 -0.1487977 -0.1487977 0.07460205
#> 5 x8 1 -0.2132204 -0.2132204 -0.2132204 0.08058415
#> cred.low cred.high row column
#> 1 1.0196560 1.328830457 1 1
#> 2 1.7880347 2.119367130 2 1
#> 3 -2.1442546 -1.830465200 3 1
#> 4 -0.2950150 -0.002580342 5 1
#> 5 -0.3711624 -0.055278332 8 1
posterior$prior.source
#> [1] "flat prior on the refitted support"
draws <- simulate(posterior,nsim=1000L,seed=2)
dim(draws)
#> [1] 11 1000An accepted full unpenalized support refit uses a flat prior. A fit
that retains adaptive-ridge shrinkage uses a frozen Gaussian prior,
obtained by one inverse-square update at its fitted coefficients.
Mandatory coefficients have a flat prior; prior.mean
supplies the other prior centres. With selected coefficient support
J, prior precision P and fitted noise parameters \widehat\psi, the target is
p(\beta_J\mid y,J,P,\widehat\psi)\propto \exp\{\ell(\beta_J,\widehat\psi)-\tfrac12(\beta_J-c)^TP(\beta_J-c)\} 1_{\mathcal C}(\beta_J).
The calculation finds a separate conditional mode with this prior and noise held fixed. It uses a local Gaussian likelihood approximation, with the full coefficient covariance. Nonnegative coefficients are sampled from a truncated joint Gaussian. Multinomial draws preserve the zero-sum CLR constraints. For Gaussian identity models with known dispersion, the frozen-prior Gaussian calculation is exact, including its truncation.
The table reports the original estimates, conditional modes,
posterior means, standard deviations and equal-tail credible limits.
Sparse draws retain the original coefficient dimensions, with excluded
entries zero. simulate(fit,...) constructs the posterior
directly; simulate(posterior,...) reuses its stored
information without retaining a copy of the training data.
Cholesky sampling and independent rejection are used when practical.
Native Gibbs sampling handles more restrictive nonnegative regions. For
a Gibbs run, increase burnin or thin and
compare seeds when posterior correlations are strong.
max.parameters and max.cells bound the
information and draw storage.
Selected-support standard errors
details <- summary(fit,inference='conditional')
details$inference$coefficients
#> term channel selected.estimate estimate std.error statistic
#> 1 Intercept 1 1.1742432 1.1742432 0.07887247 14.887871
#> 2 x1 1 1.9537009 1.9537009 0.08452514 23.113845
#> 3 x2 1 -1.9873599 -1.9873599 0.08004978 -24.826551
#> 4 x4 1 -0.1487977 -0.1487977 0.07460205 -1.994552
#> 5 x7 1 -0.2132204 -0.2132204 0.08058415 -2.645934
#> p.value df conf.low conf.high boundary row column
#> 1 5.524526e-34 195 1.0186906 1.329795862 FALSE 1 1
#> 2 9.355406e-58 195 1.7870001 2.120401723 FALSE 2 1
#> 3 2.789541e-62 195 -2.1452344 -1.829485386 FALSE 3 1
#> 4 4.748463e-02 195 -0.2959281 -0.001667208 FALSE 5 1
#> 5 8.811402e-03 195 -0.3721488 -0.054291976 FALSE 8 1The selected coefficients are refitted without a sparsity penalty, with their observation weights, offsets and coefficient constraints retained. The table includes both the selected point estimates and the refitted estimates, standard errors, intervals and Wald tests. The original fitted model is preserved.
Gaussian and other ordinary GLMs use model-based information; estimated scales use selected-model Pearson dispersion. Negative binomial models retain fixed shape or reestimate it as specified. Multinomial covariance is computed on its selected zero-sum subspace and returned in CLR coordinates. Cox inference uses weighted Breslow partial-likelihood information. Nonnegative boundaries and singular information receive unavailable ordinary Wald standard errors.
The nominal fixed-model interpretation treats the chosen support as given. When support recovery is reliable, it approaches the ordinary inference problem with the correct model. Selection itself can add substantial uncertainty near detection thresholds.
Bootstrap selection stability
uncertainty <- summary(fit,inference='bootstrap',
control.inference=list(nboot=199L,seed=1))
uncertainty$inference$coefficients
uncertainty$inference$diagnosticsEach replicate resamples observation rows and their weights and offsets, then reruns the saved fit specification, including SIS/ISIS, interaction generation and local support refinement. Starting exclusions remain fixed as specified. Intervals include zero estimates when a coefficient is absent. Sparse draws and selection frequencies retain every original predictor, with a shared union of generated interaction terms. Failed fits, solver warnings, convergence and timings are recorded.
A supplied seed preserves the caller’s random-number state. The
default memory guard prevents large dense row-resampling blocks;
max.cells can be set explicitly when the required memory is
available. Predictors are kept eligible throughout the resampling
procedure according to their original starting restrictions.
A model extracted from l0glmTune() retains its chosen
penalty for this bootstrap. A refit callback can repeat
tuning within each replicate:
retune <- function(args) {
args$lambda <- NULL
args$family <- gaussian()
do.call(l0glmTune,c(args,list(tune='cv',nfolds=5L,nlambda=10L,
plot=FALSE,printbest=FALSE)))$fit_best
}
uncertainty <- summary(fit,inference='bootstrap',
control.inference=list(nboot=199L,seed=1,refit=retune))Bootstrap intervals describe resampling variability. Near selection thresholds, ordinary bootstrap and fixed-model intervals can have imperfect nominal coverage; selection frequencies are useful stability diagnostics, rather than a proof that the selected support is correct. See the reference page for covariance formulas, controls and the discussion by Leeb and Poetscher (2008).
Frequentist coverage in deconvolution
A 95% conditional credible interval need not cover a fixed true coefficient in 95% of repeated datasets after variable selection. Shifted PSF columns are highly correlated: omitted neighbouring peaks can bias retained coefficients, and an estimated adaptive prior introduces additional shrinkage. Dispersion and support uncertainty are held fixed in the posterior calculation.
The following experiments use nonnegative GIC-preset deconvolution. Single-channel designs have 1,000 scans, 1,000 predictors and 100 peaks, with 200 repeated noise draws. Three-channel designs have 500 scans, 500 predictors and 50 shared peaks, with 100 repeats. Gaussian noise has SD 5; Poisson means use the simulated signal. Each interval uses 2,000 coefficient draws. The reference fits restrict the design to the true predictors.
| Noise and model | Coverage among recovered true coefficients | Coverage across all true coefficients | True-predictor reference |
|---|---|---|---|
| Poisson, single channel | 74.0% | 62.3% | 94.9% |
| Gaussian, known variance, single channel | 79.5% | 71.2% | 94.7% |
| Gaussian, estimated variance, single channel | 81.8% | 74.4% | 94.7% |
| Poisson, three channels | 86.2% | 74.8% | 94.2% |
| Gaussian, known variance, three channels | 87.7% | 84.4% | 95.2% |
| Gaussian, estimated variance, three channels | 91.4% | 90.0% | 95.3% |
The second column conditions on recovery at the exact predictor location. The third also counts missed peaks as uncovered. Monte Carlo standard errors for the recovered-coefficient coverage are about 0.2–0.4 percentage points across replicates. All runs completed successfully. These results support using the intervals to describe uncertainty within the selected model; they do not provide selection-adjusted confidence guarantees. The bootstrap additionally describes selection stability, with its own coverage considerations near thresholds.
Reproduce the coverage experiments.
Reducing peak heights twentyfold gives recovered-coefficient coverage of 67.1% for Poisson and 71.1% for Gaussian noise with estimated variance in the single-channel experiment. The true-predictor references give 92.6% and 94.6%, respectively. The reproducible benchmark includes these lower-signal cases.
