
Publication Bias Models with MARS
mars authors
Publication-Bias-Models.RmdPublication-bias models describe a specified selection mechanism. They are sensitivity analyses: a changed effect estimate or an asymmetry test does not establish that publication bias caused the observed pattern.
Choose the model and check its support
| Method | Selection weight | Numerical calculation |
|---|---|---|
beta_selection |
Beta kernel of the p-value | Adaptive integration |
beta_binomial |
Beta-binomial weights over p-value bins | Scalar normal interval probabilities |
logistic_selection |
Logistic function of minus log p | Adaptive integration |
P-values use sampling SEs, while the likelihood includes
heterogeneity. Specify the tail and censoring threshold deliberately.
The default censoring threshold is 1e-5 for beta selection
and 1e-12 otherwise. Beta selection requires strictly
positive, numerically distinct bounds.
The selected density is proportional to a normal density times its selection weight. Its normalizer integrates over all possible effects. Weights and normalizers are evaluated on the log scale without absolute weight floors. Displayed weights are relative weights; multiplying all weights by a common constant does not change the selected density.
Independent covariance components factor exactly. Correlated
components with two outcomes use deterministic
conditional-normal integration, splitting at censoring and bin
boundaries. Components with more than two connected outcomes
remain unsupported. Never remove genuine correlations to bypass
this limit. Bivariate fits can be slow, especially with the three
optimization starts used by default. Use
integration_control to change actual quadrature tolerances
and subdivision limits. Scalar beta-binomial calculations use exact
interval probabilities; bivariate outer integrals still use adaptive
integration.
Exact selection functions and their interpretation
For observed effects y_g in study g, the fitted density is
f_{sel}(y_g)=\frac{\phi(y_g;X_g\beta,V_g)\prod_j w(p_{gj})} {E_\phi\{\prod_j w(p_{gj})\}}.
The normalizer depends on the mean, covariance and selection parameters; it is not an empirical average of weights at the observed p-values. Sampling SEs compute p-values for a zero effect, while total covariance describes the normal distribution. Fitting, reported p-values and the Egger check share the same aligned sampling variances without imposing a lower variance floor.
The weight functions are:
- Beta: w(p)=p^{\alpha-1}(1-p)^{\beta-1}, with positive shape parameters. Both shapes equal to one give constant selection. Shapes need not be monotone.
- Beta-binomial: w_j={m\choose j}B(j+\alpha,m-j+\beta)/B(\alpha,\beta), with m=n\_bins-1. This is a constrained two-parameter shape over equal-width p-value bins, not a freely estimated weight for every bin. Both shapes equal to one give constant bin weights.
-
Logistic: w(p)=\mathrm{logit}^{-1}(a-b\log p), with
b>0. This decreases with p; b approaching zero makes weights
approximately constant and can weaken identification of a. This differs from
metafor’s model named"logistic".
The beta function follows Citkowicz and Vevea (2017). The beta-binomial and logistic functions here are specified sensitivity models. Their names do not establish equivalence to similarly named options elsewhere. Multiplying all weights by a constant leaves the selected density unchanged. Even sum-one beta-binomial shape weights are not publication probabilities, observed p-value-bin probabilities or an estimate of the fraction of missing studies.
For dependent effects, the product of outcome-specific weights defines a particular joint study selection mechanism. Retaining covariance does not make this a general model of publication triggered by any one significant outcome. Selective outcome omission and unknown publication rules are not estimated. The independence assumption is between study blocks; within-study correlations remain in the likelihood.
right p-values favor significant positive effects when
weights decrease with p; left favors negative effects.
Two-sided selection does not distinguish their signs. Prespecify
direction and harmonize effect coding. The fitted weight uses
min(max(p,p_value_min),1-p_value_min) for both observations
and normalizers. Changing censoring changes the selection model, so
compare plausible thresholds as sensitivity analyses rather than
selecting a threshold for a preferred result.
Fit and compare scalar sensitivity models
BCG has one effect per trial, so it follows the scalar integration path.
parent <- mars(
data=bcg, formula=yi~1, studyID="trial", variance="vi",
varcov_type="univariate", structure="univariate", estimation_method="MLE"
)
methods <- c("beta_selection","beta_binomial","logistic_selection")
fits <- setNames(lapply(methods,function(method)
publication_bias(parent,method=method,maxit=300)),methods)
comparison <- do.call(rbind,lapply(names(fits),function(method) {
z<-fits[[method]]
data.frame(method=method,estimate=z$coefficients$estimate[1],
standard_error=z$coefficients$std_error[1],
negative_log_likelihood=z$objective,
convergence=z$convergence,
inference_available=z$inference_info$ok)
}))
comparison
#> method estimate standard_error negative_log_likelihood
#> 1 beta_selection -0.9859215 0.3100944 11.84130
#> 2 beta_binomial -0.7817991 0.2191900 12.01635
#> 3 logistic_selection -0.7111764 0.1726633 12.66519
#> convergence inference_available
#> 1 0 TRUE
#> 2 0 TRUE
#> 3 0 TRUECompare these as alternative assumptions, not as an automatic model-selection procedure. Keep the input data, model version, p-value tail, censoring threshold, and covariance assumptions with the analysis. Examine the estimated selection shapes and any boundary behavior.
selection_plot(fits$beta_binomial)
Scalar likelihoods and derivatives are checked against independent
calculations, including a matched metafor beta-selection
example. Agreement requires matched p-value tails, censoring and
covariance assumptions.
Optimization and effective numerical controls
Default fitting tries three deterministic starting shapes. For beta
models, these are (1,1), (0.5,2) and
(2,0.5); for logistic models they are (0,1),
(-2,0.5) and (2,2). Mean starts come from the
parent. Estimated heterogeneity starts use the parent’s positive value,
or 0.01 when zero, multiplied by 1,
0.5 and 2. Fixed parent heterogeneity is never
changed by these starts.
The best valid converged candidate is selected by negative log
likelihood. If none converges, the best finite candidate is returned
with unavailable Wald inference. starts=1 or
starts=2 reduces work but also reduces the search. Positive
nuisance parameters are optimized on log scales; estimated heterogeneity
can approach zero but does not reach an exact zero boundary.
fits$beta_selection$optimization_diagnostics
#> $starts
#> start objective convergence valid selected message
#> 1 1 11.8413 0 TRUE FALSE
#> 2 2 11.8413 0 TRUE FALSE
#> 3 3 11.8413 0 TRUE TRUE
#>
#> $selected_start
#> [1] 3
#>
#> $gradient
#> [1] 5.762492e-05 9.242992e-06 2.827231e-05 -1.522006e-05
#>
#> $scaled_gradient
#> [1] 4.487466e-06
#>
#> $gradient_tol
#> [1] 1e-04
#>
#> $stationary
#> [1] TRUE
#>
#> $extreme_parameters
#> [1] FALSE FALSE FALSE
#>
#> $parameter_scale
#> [1] "mean coefficients and log-positive nuisance parameters"
#>
#> $near_zero_tau
#> [1] FALSEInspect disagreement among start objectives, convergence, the
numerical gradient, extreme nuisance parameters and near-zero
heterogeneity. The stationarity measure is
max(abs(gradient))/(1+abs(negative_log_likelihood)) on the
optimizer scale; gradient_tol=1e-4 is its default
threshold. Nonstationarity suppresses Wald inference. The thresholds for
extreme log nuisance values (abs(value)>20) and
near-zero estimated tau2 (<1e-8) are
descriptive flags. They are sensitive to units and do not constitute
formal identification tests. Multiple starts and a passing gradient do
not prove a global optimum.
tighter <- publication_bias(parent,method="beta_selection",
starts=3,maxit=1000,control=list(reltol=1e-11),
integration_control=list(rel_tol=1e-11,subdivisions=2000,
bivariate_rel_tol=1e-10,bivariate_subdivisions=1000))control affects BFGS optimization.
integration_control affects scalar and bivariate
quadrature, including inner scalar integrals. Infinite normal tails are
retained; no integration range is truncated. Defaults are scalar
relative tolerance 1e-10 with 1000 subdivisions, and
bivariate outer tolerance 1e-9 with 500 subdivisions.
Scalar beta-binomial integration uses interval probabilities. Settings
are stored and reused by profile_likelihood().
Fixed heterogeneity and comparison intervals
Ordinary constant-heterogeneity univariate parents have heterogeneity
re-estimated jointly with selection by ML. An explicitly fixed parent
tau2, including zero, is preserved. Multivariate,
multilevel and scale-location fits condition on the parent’s total
covariance and omit uncertainty in its estimation.
fixed_parent <- mars(bcg,formula=yi~1,studyID="trial",variance="vi",
varcov_type="univariate",structure="univariate",tau2=0)
fixed_bias <- publication_bias(fixed_parent,method="beta_binomial",n_bins=3)
fixed_bias$covariance_mode
#> [1] "fixed_mars_structure"
stopifnot(!"tau2" %in% names(fixed_bias$selection))comparison_vcov="model" uses parent model SEs with
normal-reference intervals. comparison_vcov="robust"
requires a parent fitted with robustID and retains its
normal/t reference and coefficient-specific degrees of freedom.
level=0.95 sets the comparison interval level for both
adjusted and unadjusted estimates; it can be changed explicitly. This
comparison choice does not change the fitted selection likelihood or its
inference choice. Percent change is a signed change divided
by the absolute unadjusted estimate; it is unavailable near zero.
Interval overlap is descriptive and is not a paired test of the estimate
change.
Choose uncertainty explicitly
The default inference="model" uses the inverse observed
Hessian of the negative log likelihood.
inference="sandwich" uses independent study scores:
\widehat{\mathrm{Var}}(\hat\theta) = H^{-1}\left(\sum_g s_g s_g^T\right)H^{-1}.
Sandwich inference requires more studies than parameters and uses no small-sample correction. Both methods use asymptotic normal Wald inference and require converged optimization and valid positive-definite curvature and a passing numerical stationarity check. Otherwise SEs and Wald p-values are unavailable; do not substitute zeros or another method merely to obtain an interval.
sandwich_fit <- publication_bias(
parent,method="beta_binomial",inference="sandwich",
maxit=1000,control=list(reltol=1e-11)
)
sandwich_fit$coefficients
#> term estimate std_error z_value p_value
#> 1 (Intercept) -0.7817999 0.1691157 -4.622869 3.784685e-06
sandwich_fit$standard_error_note
#> [1] "Study-cluster sandwich covariance H^-1 (sum of study score outer products) H^-1; no small-sample correction. Wald inference uses an asymptotic normal reference; finite-sample coverage is not guaranteed. beta_binomial uses discretized p-value bins; coefficient magnitudes can differ materially from beta_selection."Study-cluster sandwich inference assumes independence between studies. Its construction follows the general clustered sandwich approach. It does not guarantee conservative coverage, particularly with few studies or weakly identified selection parameters. Profile likelihood and resampling can provide additional sensitivity checks. A convergence code of zero is not proof of a global optimum.
Preserve scale-location covariance
A parent scale model allows heterogeneity to vary by observation or study. The publication-bias analysis conditions on its fitted total covariance: it does not replace that variation with a common tau-squared or refit the scale coefficients. Uncertainty from estimating the parent covariance is not included.
The covariance is assembled using observation-specific scale variances. Inconsistent parent covariance metadata are rejected. Centering or scaling numerical covariates can improve fitting.
scale_data <- transform(bcg,year_centered=year-mean(year))
scale_parent <- mars(
scale_data,formula=yi~1,scale_formula=~year_centered,
studyID="trial",variance="vi",varcov_type="univariate",
structure="univariate",estimation_method="MLE"
)
expected_variance <- scale_parent$data$vi+
as.numeric(scale_parent$est_values$Tau)
stopifnot(isTRUE(all.equal(
as.numeric(diag(solve(scale_parent$invPsi))),expected_variance,
tolerance=1e-8)))
scale_bias <- publication_bias(
scale_parent,method="beta_binomial",maxit=1000,
control=list(reltol=1e-11)
)
scale_bias$covariance_mode
#> [1] "fixed_mars_structure"
scale_bias$coefficients
#> term estimate std_error z_value p_value
#> 1 (Intercept) -0.8804388 0.1051824 -8.370592 5.732943e-17
stopifnot(!"tau2" %in% names(scale_bias$selection))For repeated outcome categories, observation-local sampling matrices
retain their observation order. Heterogeneity uses the outcome design:
S + Z %*% Tau %*% t(Z). A study containing only category 2
still uses its category-2 heterogeneity, regardless of the number of
rows in that study. The same alignment applies to sampling SEs.
Interpret Egger regression as an asymmetry diagnostic
The diagnostic fits standardized effects on an asymmetry intercept and the original mean design divided by sampling SE, without extra inverse-variance weighting. With an intercept-only mean model, this is classical standardized Egger regression; equivalently, regress raw effects on sampling SE using inverse-variance weights. Original moderators are retained.
egger <- egger_test(parent)
egger
#> Egger-type small-study-effects test
#> Egger-type small-study-effects regression with study-cluster robust SE (CR1S, naive-t)
#> asymmetry SE statistic df p_value
#> -2.112 1.278 -1.653 12 0.1242
#> Independent clusters: 13 | Effects: 13
#> Asymmetry does not establish publication bias.
stopifnot(isTRUE(all.equal(egger$intercept,
fits$beta_binomial$egger_test$intercept)))egger_test() works directly from the ordinary fitted
model and does not require selection-model optimization. A
pub_bias object uses its ordinary parent. It retains
moderators and inherits the parent robust cluster if present, otherwise
its study ID. egger_test(parent,cluster="district") can
select an explicit independent-cluster column. Selection-model
likelihood blocks are unchanged by this diagnostic clustering choice.
network_bias_test() remains the separate covariance-aware
network diagnostic. Egger uses column-scaled QR computation for the
standardized regression, preserving its interpretation under changes of
effect units. Inspect ok and its reason when
unavailable.
Cluster-robust SEs follow egger_robust_args; the default
is CR1S with a G-1 t reference. Count independent studies, not the
number of effects. Diagnostics flag fewer than ten studies and little
variation in SEs. Ten is a rule of thumb, not a guarantee of reliable
inference. A rank-deficient mean/SE design produces an unavailable
diagnostic. The choice of regression and moderators matters. Effect-SE
coupling can create artefactual asymmetry, especially for SMDs and odds
ratios, so the same test should not be applied automatically to every
effect measure. A nonsignificant check does not exclude missing
evidence. See Cochrane
Chapter 13 and the metafor
regression-test documentation.
Selection curves and funnel guides
selection_plot(fits$logistic_selection,normalize=FALSE)
normalize=FALSE plots the direct kernel/shape weights.
normalize=TRUE divides by the maximum weight on the plotted
grid or among bins. The scale therefore can depend on the grid;
comparisons should use the same grid and normalization. Use
normalization for stable display of extreme beta kernels. Neither
display identifies an absolute publication probability.
For funnel_plot(), the adjusted center is the
intercept/reference prediction at predictor zero, while the observed
center is the marginal inverse-sampling- variance mean. An
intercept-free adjusted model uses zero. Raw effects with moderators or
multiple outcomes need not share one expected mean; use suitable strata
and interpret a combined funnel cautiously. Guide contours are center
plus/minus a normal quantile times sampling SE. They omit heterogeneity
and center uncertainty and are neither simultaneous intervals nor
null-significance contours. Curves from nonconverged or unidentified
fits are candidate shapes.
Direct funnel plots and trim-and-fill
Ordinary funnels are available without fitting a selection model:
funnel_plot(parent)
The default adjusted center here is the parent’s fitted reference
mean. For a selection-model object, it is the selection-adjusted
reference. The "observed" center is the
inverse-sampling-variance mean of observed studies, and
"none" omits the line. Moderator and multivariate raw
funnels need not have a single meaningful center. Standard-error axes
decrease upwards, while precision axes increase upwards; plotting limits
can be set through ....
Trim-and-fill adds a separate symmetry-based sensitivity analysis:
filled <- trim_fill(parent,side="right",estimator="L0")
filled
#> Trim-and-fill sensitivity analysis
#> Estimator: L0 | Imputed side: right | Hypothetical studies: 1
#> estimate SE tau2 lower upper
#> original -0.7112 0.1719 0.2800 -1.0481 -0.3743
#> augmented -0.6552 0.1711 0.2975 -0.9905 -0.3199
#> Intervals condition on augmented data and omit imputation uncertainty.
funnel_plot(filled)
Or compute it while plotting and retrieve the result from the returned data:
plotted <- funnel_plot(parent,trim_fill=TRUE,
trim_fill_args=list(side="right",estimator="L0"))
attr(plotted,"trim_fill")$adjusted
plotted[plotted$imputed,]Observed studies are solid circles; hypothetical filled studies are
open circles in a contrasting color. The default center with filling is
the augmented-model estimate, not the reflection center. Both are
recorded, since the final refit can shift the estimate.
center="observed" continues to use observed studies only.
The original fitted object is unchanged. On a pub_bias
object the procedure uses its ordinary parent, and does
not trim selection-adjusted effects or combine two bias adjustments.
Algorithm and supported models
Trim-and-fill supports independent, intercept-only univariate models with at least three studies and one effect per study. Moderator, multilevel, multivariate, scale-location, network and penalized models are rejected. Selecting one outcome/time stratum does not automatically remove within-study dependence; fit a scientifically justified independent analysis rather than discarding correlations merely to enable filling.
Orient effects so the proposed missing side is left, and sort them. Refit after trimming the current estimated number of largest effects, rank absolute deviations from the trimmed mean, and update the missing-study count. Let T be the sum of positive signed ranks, r_- the largest absolute negative rank, and n the number of observed studies. The available estimates are
L_0=\frac{4T-n(n+1)}{2n-1},\qquad R_0=n-r_--1,\qquad Q_0=n-\frac12-\sqrt{2n^2-4T+\frac14}.
Counts are rounded to the nearest integer and truncated at zero. Ties use sequential ranks in sorted effect order. This convention can give positive fills even for exactly symmetric paired data, so counts are sensitive to ties and are not evidence that particular studies are missing. Stop when the count stabilizes; cycles, iteration exhaustion, negative Q0 radicands and fewer than two retained studies are errors. Constant effects yield zero fills. Reflect the selected extreme effects around the converged trimmed center, keep their sampling variances, and refit all observed plus hypothetical effects.
Each fit uses the parent’s ML or REML method and re-estimates
constant heterogeneity; explicitly fixed tau2, including
zero, is preserved. The heterogeneity calculation includes an exact zero
boundary. maxiter=100 controls the trim/refit loop and
tol=1e-8 controls scalar variance optimization on a
scale-free axis. level=0.95 gives conventional normal
intervals conditional on the augmented data. Parent robust covariance is
not transferred to hypothetical studies, and intervals omit
missing-count and imputation uncertainty. Both original and augmented
summaries use the inverse-variance mean SE
1/sqrt(sum(1/(vi+tau2))). They do not copy the parent
joint-Hessian or robust SE, so their intervals can differ from
summary(parent).
side="auto" uses a raw-effect meta-regression on
sampling SE with the parent’s covariance convention: a negative slope
chooses right, otherwise left. It is data-driven and is not a
significance test. Specify a scientifically meaningful side where
possible and compare both directions and alternative estimators.
Automatic direction is unavailable with constant SEs. L0 is the default;
R0 and Q0 can give different missing counts and adjusted estimates.
trim_comparison <- do.call(rbind,lapply(c("L0","R0","Q0"),function(estimator) {
z<-trim_fill(parent,side="right",estimator=estimator)
data.frame(estimator=estimator,imputed=z$n_imputed,
estimate=z$adjusted$estimate,tau2=z$adjusted$tau2)
}))
trim_comparison
#> estimator imputed estimate tau2
#> 1 L0 1 -0.6552344 0.2974650
#> 2 R0 0 -0.7111991 0.2800281
#> 3 Q0 1 -0.6552344 0.2974650Interpretation and validation
Trim-and-fill assumes funnel symmetry; heterogeneity, effect-SE coupling, direction choice and rank ties can influence filling. Hypothetical studies are not recovered unpublished data, and zero fills do not exclude missing evidence. Treat the augmented result as sensitivity to symmetry, not a corrected truth or a validated count of unpublished studies. No missing-count SE or publication-bias p-value is reported. The rank/reflection algorithm follows Duval and Tweedie (2000).
Tests compare counts, imputed effects, inherited variances,
estimates, SEs and heterogeneity against
metafor::trimfill() under matched estimator, side and
ML/REML settings. Matching this calculation does not validate the
symmetry assumption for a particular application. The implementation
uses base R and does not require metafor at runtime.
Network asymmetry and funnel plots
Joint consistent network objects are supported. Network centering uses fitted row-specific predictions, preserving modeled outcome, time, and moderator differences. Direct centering uses comparison/outcome/time strata.
The bias test jointly fits the mean design and sampling-SE effect to
raw effects using the fitted total covariance for GLS. It does not treat
estimated centers as known offsets. Inference uses study-cluster CR1
covariance and a G-1 t reference; more independent studies than
regression parameters are required. The "(Intercept)" row
represents the sampling-SE coefficient, equivalent to the asymmetry
intercept on the standardized scale. Parent covariance remains fixed,
and cross-study covariance is unsupported. Prespecify consistent
contrast directions so a shared asymmetry slope has a meaningful
interpretation across comparisons. Assess effect-measure suitability and
the number of independent studies; the network diagnostic is also a
small-study-effects check. This illustrative network uses two
shared-control contrasts per study, with sampling correlation 0.5
specified explicitly rather than inferred from the marginal
variances.
network_data <- data.frame(
study=rep(1:12,each=2),a="A",b=rep(c("B","C"),12),
yi=seq(.1,.8,length.out=24)+sin(1:24)/10,
vi=rep(seq(.02,.15,length.out=12),each=2)
)
network_covariance <- diag(network_data$vi)
dimnames(network_covariance) <- rep(list(as.character(seq_len(nrow(network_data)))),2)
for (ii in split(seq_len(nrow(network_data)), network_data$study)) {
network_covariance[ii,ii] <- network_data$vi[ii[1]] *
matrix(c(1,.5,.5,1),2)
}
network_fit <- network_meta_coherent(
network_data,"study","a","b","yi","vi",heterogeneity="none",
sampling_covariance=network_covariance
)
network_bias_test(network_fit)$intercept
#> term estimate std_error t_value p_value
#> (Intercept) 2.2619430 0.3469084 6.5202884 <0.0001
network_funnel_plot(network_fit)
Funnel guide lines are descriptive sampling-SE guides, not simultaneous confidence bands or a test for publication bias.
Validation and limits
Permanent regressions check normalizers, derivatives, scale covariance, outcome mapping, permutation invariance, covariance formulas, moderator retention, and network GLS against independent calculations. Additional pilot simulations can examine fitting and inference under specified selection mechanisms.
Pilot simulations measure convergence, unavailable intervals, estimation bias, and coverage among available intervals. Failure counts belong beside coverage: conditioning on successful fits can hide practical limitations. Small pilots do not establish general coverage or validate every selection mechanism. Support remains limited to independent and bivariate connected covariance components, and conditional analyses omit parent-covariance uncertainty.
References
Citkowicz, M., and Vevea, J. L. (2017). A Parsimonious Weight Function for Modeling Publication Bias. Psychological Methods, 22(1), 28–41. https://doi.org/10.1037/met0000119.
Duval, S., and Tweedie, R. (2000). Trim and Fill: A Simple Funnel-Plot-Based Method of Testing and Adjusting for Publication Bias in Meta-Analysis. Biometrics, 56(2), 455–463. https://doi.org/10.1111/j.0006-341X.2000.00455.x.