Observed heterogeneity is variation in outcome propensities explained by measured covariates, such as age or sex. In logistic regression, subjects with different recorded predictor values may have different success probabilities, even before allowing for their previous outcomes. This is heterogeneity visible through observed predictors.
The second logistic regression adds while retaining the first lag and baseline covariates. The models are nested under . Their likelihood-ratio test statistic is the reduction in binomial deviance,
Under the null and regular large-sample conditions for the correctly specified conditional likelihood, this has an approximate chi-squared distribution with one statistical degree of freedom. Since , reject at 5%; the approximate p-value is . Prefer the two-lag model to the one-lag model. Its additional lag captures statistically useful information in the history.
A complete-case analysis changes the mix of people contributing to the logistic regression. Let mean that both required variables are observed, and write . Within , Bayes theorem gives
If completeness depends differently on the two responses, and that selection also varies with partner count or the other predictors, the extra term changes the fitted regression coefficients. For example, people with high counts and poor condom use can be under-represented, weakening or otherwise distorting the apparent association. Dropping people with missing also excludes some whose membership of the target group is unknown.
The fitted conditional association among complete responders need not equal the target-population association. No direction of selection bias follows without specifying the response mechanism. Selection on predictors alone need not bias a correctly specified conditional logistic regression; it is the outcome-related selection described here that removes that reassurance.
Multiple imputation by chained equations specifies one conditional distribution for each incomplete variable. In general, let be the incomplete variables, the fully observed predictors, and the parameters of a model . The notation means all variables except . The models should respect each variable's support and contain the terms needed by the planned analysis.
First choose suitable models and initialise only the missing entries with admissible provisional values. One sweep updates in turn. At update , fit its model to records whose is observed, using the latest filled-in predictors. Draw
The first draw represents parameter uncertainty through a Bayesian posterior; the second represents residual uncertainty through a posterior predictive distribution. Replace the missing entries with these draws, leaving every genuinely observed entry fixed. Repeat whole sweeps until the chain has settled, assessing traces, mixing and plausibility. Obtain completed datasets from independently initialised chains, or sufficiently separated draws after convergence. Both parameter and missing-value uncertainty must be propagated; repeated deterministic prediction is not multiple imputation.
Here use a logistic regression for conditional on , age and sex. For , use an appropriate discrete count model conditional on , age and sex, such as a suitably checked negative binomial regression, allowing enough flexibility for skewness and nonlinear effects. Include interactions or transformations needed by the analysis in the imputation models. If condom use is structurally undefined for a record, preserve that applicability rule rather than treating it as ordinary missing data.
Impute the eligible survey information before discarding records solely because the observed is absent. In each completed dataset select its own records and fit the requested logistic regression. This allows a record with missing to contribute to the target group in some imputations and not others. Models must respect any known eligibility restrictions; if eligibility was independently known, use that information.
For a scalar regression coefficient, let be its estimate and its estimated variance in completed dataset . Rubin's rules give
The standard error is . Use the corresponding multiple-imputation confidence interval, rather than treating one completed dataset as fully observed. For vector coefficients replace the squared differences by outer products and by the covariance matrix. This combines within-imputation and between-imputation uncertainty.
Treat the extra measurements as auxiliary variables for multiple imputation. Include alcohol consumption and disease history as predictors in both the and conditional distributions, together with age, sex and the other incomplete response. If these auxiliary variables themselves have missing entries, give them appropriate models and update them within the same multiple imputation by chained equations sweeps. Preserve observed entries throughout.
Useful auxiliary measurements can improve predictions, precision and the plausibility of missing at random. Their association with the missing responses reduces uncertainty in the imputed values; association with nonresponse may explain some selection that otherwise depends on unobserved values. This can reduce selection bias under the enlarged missing at random model and reduce between-imputation variance. It does not guarantee elimination of missing not at random dependence. They need not be added to the final substantive logistic regression merely because they help imputation: the final analysis should still estimate its intended association.
This is a sequential analysis of deviance for nested generalized linear models. Adding age to the intercept-only logistic regression reduces deviance by , with approximate p-value . Adding frailty to the age model reduces it by another , with p-value . Thus both variables have evidence of association with surgical success, under the model assumptions, and neither should be dropped solely on these results.
The second test assesses frailty adjusted for age, whereas the first assesses age before frailty is included. Sequential tests depend on term order. Evidence for age adjusted for frailty is additionally provided by its full-model Wald test, . Both fitted coefficients are negative: age and frailty are associated with lower fitted success probabilities. On the odds scale, one extra year at fixed frailty multiplies the odds by , and frailty at fixed age multiplies them by . These are odds ratios, not risk ratios, and an observational statistical association does not by itself establish a causal effect.
The proposed generalized additive model retains the binary response and logit link, but replaces the linear age effect by a smooth function:
A penalized cubic regression spline represents ; frailty remains a parametric coefficient. The plotted age smooth is centered, so its vertical values represent an age contribution to log odds, not probabilities or the entire fitted predictor.
The plot gives no evidence that the nonlinear model improves the mean structure. The fitted curve is essentially a straight descending line, and the label s(age,1) reports effective degrees of freedom close to one, consistent with a linear effect. The widening bands near the ends reflect sparse data and increasing uncertainty, not detected curvature. A linear-age logistic regression is therefore adequate on this evidence and simpler to interpret. A formal comparative claim would need a suitable test or predictive/model-selection criterion, but the figure supplies no reason to retain extra nonlinear flexibility.
Introduce a latent Bernoulli distribution indicator , with denoting a structural zero and . Conditional on , retain the negative binomial regression with and . This gives a zero-inflated negative binomial model:
A participant who fishes may still catch zero, so an observed zero does not reveal the latent class. This distinguishes zero inflation from a hurdle model, which truncates the count component at zero. The marginal expectation becomes , and the law of total variance gives
A constant is a parsimonious starting model. If there is evidence that nonparticipation changes with day or other recorded predictors, use logistic regression for instead. Conditional independence of visitors remains an assumption; extra zeros alone do not establish its validity.
For independent random variables , the full logistic regression has linear predictor
Layout A is the reference level in a regression factor. The smaller model sets , leaving the same logit link and the price predictor. In either case
The saturated statistical model allows a separate probability per observation; its maximizing probabilities are , with log-likelihood zero under . Hence the binomial deviance for either fitted model is
Equivalently, write the summands as . The fitted probabilities differ between the two models, but the definition of binomial deviance is the same. A residual deviance for individual binary data need not itself have an accurate chi-squared distribution approximation; the nested-model difference used next has a different asymptotic justification.
There are observations, since the intercept-only model has residual degrees of freedom. Adding price introduces one coefficient and decreases the binomial deviance by . Adding a three-level factor introduces two coefficients and decreases it by . Thus the missing entries are
The likelihood-ratio test comparing the smaller and full logistic regression tests against at least one nonzero layout contrast. Its statistic is . Under ordinary interior-parameter, full-rank and finite-estimate regularity conditions, Wilks theorem gives an asymptotic chi-squared distribution with two degrees of freedom. The reported p-value exceeds , so at that level retain the simpler price-only model.
The table is an analysis of deviance for nested generalized linear models: price is entered before layout. Thus its price row tests the price-only model against an intercept, whereas the layout row tests layout after allowing for price. The latter is the relevant comparison of model1 and model2. Failing to reject a layout effect is not proof that layouts have identical effects; it means these data do not justify the extra two parameters under this test.
Using the smaller logistic regression, approximate pointwise Wald confidence intervals are an estimate plus or minus times its standard error:
Both intervals rely on the large-sample normal approximation and correct model assumptions. The negative slope indicates decreasing purchase probability as price rises. A one-unit price increase multiplies the odds by ; it does not subtract a fixed amount from the probability. There is no significant additional layout effect in the previous likelihood-ratio test, rather than a demonstration of no effect.
In the selected model layout B has the same prediction rule as the other layouts. At price 100 the linear predictor is . Applying the inverse logit link gives
The intercept refers to price zero; if that lies outside the observed price range, its direct substantive interpretation would require extrapolation.
The count weights correct the loss of frequencies for a deliberately coarsened binary response, but do not supply a third outcome category. Thus this remains inappropriate for the full contingency table. With the base R factor convention, it could fit the chosen first damage level versus the other two combined, using a logistic regression and the frequencies as weights. That is a different scientific question. The supplied log-linear model retains all three categories and their counts without this information loss.
Conditional on the covariates, the binary responses are independent with Bernoulli distributions:
Thus , the logistic regression model. The maximum-likelihood estimates are
Using the reported age standard error, an approximate 95% Wald confidence interval is
This interval concerns the age coefficient in log odds per year, with income and loan amount held fixed.
Let be the indicator that man develops heart disease and let . The fitted logistic regression assumes independent Bernoulli responses with
Let be independent standard logistic random variables and define the latent variable
Set exactly when . If is the logistic cumulative distribution function, its symmetry and the identity give
which is precisely the fitted logistic regression.