Deviance Residuals Calculator

Analyze binomial model fit with signed residuals and deviance contributions. Adjust weights and inspect curves. Download clean summaries, tables, and graphs for reporting tasks.

Calculator Form

Use CSV rows in this order: Label, Outcome, Predicted Probability, Weight.

Example Data Table

Label Outcome Predicted Probability Weight Weighted Deviance Deviance Residual
A 1 0.82 1 0.396902 0.630001
B 0 0.31 1.2 0.890553 -0.943691
C 1 0.57 1 1.124238 1.060301
D 0 0.11 0.8 0.186454 -0.431803
E 1 0.93 1.1 0.159656 0.399569

Formula Used

This calculator uses the binomial deviance residual for each observation in a binary response model.

r_i = sign(y_i - p_i) × sqrt( 2w_i [ y_i ln(y_i / p_i) + (1 - y_i) ln((1 - y_i) / (1 - p_i)) ] )

For binary outcomes, the expression simplifies because y is either 0 or 1.

If y = 1: r_i = +sqrt( 2w_i ln(1 / p_i) )
If y = 0: r_i = -sqrt( 2w_i ln(1 / (1 - p_i)) )

Large absolute residuals suggest observations that the model fits poorly.

How to Use This Calculator

  1. Choose single mode for one observation or batch mode for many rows.
  2. Enter the observed binary outcome as 0 or 1.
  3. Provide the fitted probability from your logistic or binomial model.
  4. Set the observation weight. Use 1 when no weighting applies.
  5. For single mode, define the probability range used for the Plotly graph.
  6. For batch mode, paste CSV rows using label, outcome, probability, and weight.
  7. Submit the form to display summary metrics above the calculator.
  8. Download CSV or PDF output for reporting or review.

Frequently Asked Questions

1. What is a deviance residual?

A deviance residual measures how much one observation contributes to model deviance. Its sign shows direction, and its magnitude shows how poorly the fitted probability matches the observed binary outcome.

2. When is a deviance residual considered large?

Analysts often review absolute residuals above 2, and investigate more strongly above 3. These are screening rules, not strict laws, because context and model structure also matter.

3. Why must the predicted probability stay between 0 and 1?

The formula uses logarithms of probability terms. If probability equals 0 or 1 exactly, those logarithms can become undefined or infinite for some outcomes, which breaks stable calculation.

4. What does the sign of the residual mean?

A positive sign means the observed outcome is above the fitted mean. A negative sign means the observed outcome is below the fitted mean for that binary observation.

5. Do weights change the result?

Yes. Larger weights increase the weighted deviance contribution and usually increase the residual magnitude. This matters when grouped data or weighted observations are part of the fitted model.

6. Can I use batch mode to review a whole model quickly?

Yes. Batch mode is useful for scanning many observations, summarizing overall residual behavior, and flagging rows whose absolute residuals exceed your selected review threshold.

7. How is this different from a Pearson residual?

Pearson residuals standardize the raw error using model variance. Deviance residuals instead connect directly to deviance, which often makes them more informative for generalized linear model diagnostics.

8. What should I do after finding a large residual?

Check data entry, confirm coding of the outcome, inspect influential observations, review missing predictors, and consider whether the model form is too simple. A large residual is a signal to investigate, not immediate proof of error.

Related Calculators

glm confidence interval calculatorglm goodness of fitincidence rate ratio calculatorglm sample size calculatorglm coefficient standard errorglm coefficient confidence interval

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.