Skip to main content

Questions tagged [deviance]

Deviance is a measure of distance between two probability distributions. In the case of GLMs, (total) deviance is twice the difference in log-likelihood between the full model and the restricted model.

Filter by
Sorted by
Tagged with
2 votes
0 answers
27 views

Proportion deviance explained by a predictor in a GAM fitted using mgcv with 'select=TRUE' (variable selection using double penalty)

Objective: To calculate proportion deviance explained by a predictor. Approach: Following this post by Simon Wood, the deviance explained by a predictor x1 is the ...
dicrurus's user avatar
1 vote
1 answer
26 views

How to interpret dispersion estimated for a Poisson model?

Suppose I have the following data: $(N_i, x_i, \nu_i)$ for $i=1,\dots,n$. I motivate this quickly from car insurance pricing. $N_i$ represents the number of claims, $x_i$ are some features I know and $...
julian2000P's user avatar
5 votes
1 answer
217 views

F-test for nested GLM

Assume we are given two nested GLM models $M_0 \subset M_1$ with $q$ and $p$ parameters respectively. We also know that dispersion parameter in both models is estimated as the same value, denote it $\...
Jacek's user avatar
  • 51
0 votes
0 answers
39 views

Questions regarding the definition of the deviance in the context of GLMs

I've been self-studying GLMs and I have some questions regarding the deviance in the context of GLMs. In Generalized Additive Models An Introduction with R, the author defines the deviance of a model ...
Dude3400's user avatar
0 votes
0 answers
15 views

Comparing GLMs with different fitted distributions

I have a scenario where I need to compare some generalized liner models (with same link function, target variable, but not necessarily nested) with k fold cross validation, using a cost function to ...
user101874's user avatar
1 vote
0 answers
58 views

Rel. contribution of each term to deviance explained (in GAM)

I have seen this and similar questions all over the place, but no really satisfying answers: How can we quantify the contribution that each term in a GAM (using mgcv package) adds to the total ...
user_20201213's user avatar
4 votes
1 answer
81 views

How Do I Calculate the Scaled Deviance of a GLM with Gamma(Exponential) Distributed Dependent Variable?

I'm fitting a generalized linear model to a theoretically exponentially distributed dataset. The exponential distribution has PDF $$ f(y;\lambda) = \lambda e^{-\lambda y} $$ This question Deviance for ...
Jack Guan's user avatar
  • 103
1 vote
1 answer
89 views

Manual variable selection in GAM model based in deviance explained

I'm fitting a generalized additive model (GAM) to predict bottlenecks in a manufacturing process of a company. They have data of the bottlenecks that occurs in their process of making hot steel rolls. ...
Raheshi Knuwga's user avatar
2 votes
0 answers
21 views

Logistic Regression Pattern in Deviance Variance Across Variables

I fitted a Logistic Regression model for a Customer Churn dataset with the following results I tested this model with a validation set and calculated the ROC AUC score, which was approximately 0.85 – ...
lucas17's user avatar
  • 21
3 votes
0 answers
134 views

How can we justfify the assumption of equal scale/variance in the definition of R-squared from Deviances in GLMs?

If we take the R-squared to be the comparison of Deviances between models (the model of interest, the saturated model, and the constant model), we can write it as (see this answer CC BY-SA 4.0): $$R_{...
Firebug's user avatar
  • 19.4k
3 votes
1 answer
100 views

Prove that the Deviance and the Generalised Pearson Statistic are asymptotically equivalent

I am reading the paper Exponential Dispersion Models from Jørgesen and at page $137$ I have encountered a claim that I don't know how to prove. The author claims that the Generalised Pearson Statistic,...
No-one's user avatar
  • 202
1 vote
1 answer
119 views

Solution for Overdispersion in Poisson Regression

I have run poisson regression in SPSS (Generalized Linear Model), where BMI is my IV and length of stay (LOS) in hospital for certain disease is my DV (and it's a count variable). When I run poisson, ...
Hussain's user avatar
  • 151
3 votes
1 answer
63 views

Should Kullback-Leibler as an R2 value be large or small for better goodness-of-fit

I am trying to use the Kullback-Leibler as an R2 value for goodnes-of-fit for GLM models. The R package performance defines their function as: ...
simpson's user avatar
  • 133
1 vote
0 answers
93 views

Is there a justification for the Bernoulli deviance in the R stats package?

Using the standard glm(...) function in R for Bernoulli regression, it appears that the residual deviance has the same value as the binomial deviance where each ...
Straine's user avatar
  • 11
1 vote
0 answers
85 views

Hierarchical partitioning for GAM model?

I am fitting a gam model with multiple environmental factors as predictors (actual evapotranspiration, climate water deficit, wind speed, etc). My goal is to understand how each one of them contribute ...
salomon_user's user avatar
3 votes
1 answer
448 views

Pearson chi squared test vs deviance test in GLM

From my understanding, both Pearson chi squared test and deviance test can be used to assess the goodness of fit for GLM, but they have different alternative hypotheses. For the Pearson chi-squared ...
user344849's user avatar
0 votes
0 answers
42 views

Is Pearson's chi-squared appropriate for models with low deviance explained?

I'm working on fitting a binomial GLM using LASSO in R (package glmnet). My response variable is a proportion which is generated using count data (successes and failures). The main purpose of my model ...
pfadenhw's user avatar
3 votes
1 answer
195 views

Gam using mgcv is giving negative deviance explained

I run a null binomial generalized additive models (gam) using mgcv and it gives negative deviance explained! As far as I know deviance explained is analogue of R^2 ...
user avatar
4 votes
3 answers
2k views

How to extract the residual and null deviances from a glmmTMB object (to calculate D2, the deviance explained)?

The context is about the use of a given model deviance (often referred to as “Residual deviance” in R) and that of its “Null deviance” to calculate D2, the deviance explained for models with non-...
julienbio99's user avatar
4 votes
1 answer
938 views

Is unit deviance (statistics) equivalent to the loss function (machine learning)

In this page from scikit learn, about GLM, the notion of unit deviance is introduced as loss function (from the machine learning perspective). I want to know if there is equivalence between these two ...
John Smith's user avatar
0 votes
1 answer
63 views

Testing the interaction of B:C on a glm using the analysis of deviance in R

A glm, where the response is Poisson distributed, is tested by using the analysis of deviance. In R the model looks like this: ...
stats19's user avatar
  • 61
0 votes
0 answers
34 views

How to fit a nested glm model using deviance for selectio?

I have weight as response variable which is continuous variable. And 3 explanatory variables viz; Parity(Count), Age(continuous) and Sex(Factor). I want to fit a glm model using deviances analysis to ...
A M Bello's user avatar
0 votes
0 answers
344 views

Why are the deviance residuals in my binomial GLM all zeroes?

I am currently trying to run a binomial GLM to investigate the influence of temperature (factor: 5 levels 20, 23, 26, 29, 32 degrees Celsius) and species (factor: 2 levels HA and AP) on the likelihood ...
Insect_biologist's user avatar
0 votes
1 answer
194 views

Null deviance vs deviance of null model

In GLM analysis, is the null deviance of a model the same thing as the deviance of a null model?
christophe's user avatar
2 votes
1 answer
150 views

Discrepancy between model selection based on REML score vs explained deviance in GAMs

Will be grateful for insights into the issue below! I have two explanatory GAMs below (in this example implemented with mgcv), where the effects of x1 and x2 are of interest. x1 is air temperature, x2 ...
Jade's user avatar
  • 361
1 vote
0 answers
29 views

Deviance vs Predictive Power of a variable in Logistic Regression

I have a question. I have a logistic regression model with two variables a & b. In the analysis of deviance table (type = 2) seems that variable b is more significant than a. But when I plot the ...
lola's user avatar
  • 139
3 votes
1 answer
448 views

Understanding KL divergence in chapter 7 of Statistical Rethinking

I'm having a hard time understanding McElreath's explanation of how the KL divergence allows us to decide whether one of two models is closer to the 'real' model. Here is what McElreath writes on p. ...
matsuo_basho's user avatar
2 votes
1 answer
66 views

Intuition behind the null distribution of the deviance statistic in survival models

I am reading Tutz & Schmid "Modeling Discrete Time-to-Event Data" (2016) chapter 4 Evaluation and Model Choice section 4.2 Residuals and Goodness-of-Fit. A goodness-of-fit statistic ...
Richard Hardy's user avatar
4 votes
2 answers
356 views

Why null deviance is different from my manual calculations?

Let's consider this very simple example with Poisson regression: ...
Lucian's user avatar
  • 203
3 votes
1 answer
125 views

F statistic for 3 nested models

Given models M1 and M2, the first with q parameters and the second with p>q parameters, and assuming that M1 is nested in M2, then we can test the hypothesis that the smaller model is adequate by ...
WeakLearner's user avatar
  • 1,511
0 votes
0 answers
209 views

Deviance statistic vs Wald test

I have a question. I have run a logistic regression model with 5(X1,..., X5) continuous predictors. The predictor with the highest coefficient is X2, but the predictor that reduces the most deviance ...
lola's user avatar
  • 139
0 votes
0 answers
138 views

H2O Deviance - Negative Binomial

I'm hoping to get some clarifications on the deviance calculation of negative binomial. From H2O documentation, the deviance formula for negative binomial regression is expressed as: $$D=2\sum_{i=1}^{...
Naomi's user avatar
  • 1
2 votes
1 answer
360 views

In Poisson models with an offset, should performance metrics (such as deviance) be calculated in terms of raw counts or counts per exposure?

For context, I need some metrics that can compare a standard Poisson regression (with population offset) to a random forest regressor with Poisson criterion. The test predictions for both methods are ...
jmc8's user avatar
  • 143
3 votes
0 answers
1k views

Is the F test in ANOVA a likelihood ratio or Wald's one?

I'm trying to figure out, if the F test in ANOVA is the Wald's test or LRT? I learned, that the LRT compare nested models and "assess" the reduction in residual variance. This would justify ...
Blitzkordk's user avatar
1 vote
1 answer
462 views

Discrepancy in degrees of freedom from R svyglm vs glm

I fitted a Poisson model using svyglm in R. The null and residual deviances from the svyglm model are as expected. For the degrees of freedom however, I get confusing results. With a sample size of n=...
Ter's user avatar
  • 11
1 vote
0 answers
123 views

How to compare the goodness of fit between linear and logit? Why linear deviance is less than logit?

How can I evaluate which model - between linear and logit - determine the best fit to the data? The models use the same input variables and I thought that comparing the deviances was the proper choice ...
StefanoB's user avatar
0 votes
0 answers
718 views

How to implement logistic regression deviance from scratch

As a learning exercise, I'm trying to implement the deviance for logistic regression from scratch. I understand the deviance to be: $\mathcal{L}_S - \mathcal{L}_M$, where $\mathcal{L}_s$ is equal to ...
Estimate the estimators's user avatar
0 votes
0 answers
105 views

Deviance of a larger model is much larger than the deviance of the reduced(nested) model

I am doing a logistic regression with 8 variables but for some reason the model with the second degree of interaction has a much larger deviance than the nested model without interaction. Because of ...
Yungturtll's user avatar
1 vote
0 answers
255 views

How is that possible that SAS and R can test for main and interaction effects for the GEE if it has no likelihood?

I was taught, that GEE, being not likelihood based, has no way to compare models. That we cannot assess the main and interaction effects the way we do with ordinary GLM, OLS, GLS, mixed models and so ...
Zanyaaa's user avatar
  • 91
5 votes
1 answer
1k views

GLM tests involving deviance and likelihood ratios

I'm a little confused about the different common tests for GLMs. There is the null deviance, which is similar to a likelihood ratio for the difference between the saturated model and the model with ...
fmtcs's user avatar
  • 555
5 votes
1 answer
404 views

Why is deviance $\neq -2\times$logLik for logistic regression in R?

Just tried to compute McFadden's $R^2$ from hand in R from a fitted logistic regression, but stumbled accross the problem that the reported deviance is not equal to -2 times the reported log-Liklihood:...
cdalitz's user avatar
  • 5,430
3 votes
2 answers
2k views

Overfitting, but why is the training deviance dropping?

The test set values increase over iterations signaling overfitting, but why is the training set deviance continuing to drop at the same time? This seems to indicate to me that the training set is ...
Roger's user avatar
  • 47
1 vote
0 answers
70 views

Is deviance a relevant metric for non-linear (neural) model?

Is deviance a relevant metric for non-linear (e.g. neural network) models? $$ D(y,\hat\mu)=2\left ( log((p(y|\hat\theta_{s})) - log(p(y|\hat\theta_{0})))) \right ) $$ For example, when we model ...
Pawel's user avatar
  • 111
2 votes
0 answers
482 views

For Poisson GLMs, when does the residual deviance follow a chi square distribution?

According to Generalized Linear Models by McCullagh and Nelder (I am looking at the 2nd edition, 1999), the deviance function is defined as $$D(y; \hat{\pi}) = 2[l(\tilde{\pi}; y)- l(\hat{\pi}; y)]$$ ...
minsalty's user avatar
  • 121
1 vote
0 answers
353 views

Interpretation of Multinomial Logistic Regression model fit in R

I have fitted a multinomial logistic regression model in R. The data has 35 independent variables and the dependent variable has 3 levels. I do not find information on how to interpret the outcome of ...
codeforfun's user avatar
2 votes
2 answers
5k views

What is null hypothesis in the deviance goodness of fit test for a GLM model?

To test the goodness of fit of a GLM model, we use the Deviance goodness of fit test (to compare the model with the saturated model). In many resource, they state that the null hypothesis is that &...
InTheSearchForKnowledge's user avatar
0 votes
0 answers
285 views

How the deviance residual of a GLM model is actually calculated

The deviance residual of a GLM model is defined to be: $2 (log L_{Saturated Model} - log L_{GLM Model})$ where Saturated model is the model that has as many parameter as the number of data points. As ...
InTheSearchForKnowledge's user avatar
1 vote
2 answers
560 views

Bit confused on the concept of Deviance

So, I understand what the deviance is; the deviance is simply the residual sum of squares. However, what I don't really get is the decomposition of the total sum of squares. That is $\sum_{i=1}^\infty ...
Sam Connell's user avatar
3 votes
1 answer
2k views

How to calculate the percentage deviance explained wiith glm.nb?

I’ve observed that when I fit a Negative Binomial regression with glm.nb, the null deviance I get from the model differs from the deviance of the null model. I ...
Lucia Babino's user avatar
0 votes
1 answer
144 views

Is the residual deviance / residual dof equivalent to reduced Chi^2?

Question: I'm using a poisson fit; is the residual deviance = $ \chi^{2}$, and residual deviance / residual degrees of freedom = $\chi^{2}_{reduced}$? Does this method provide a valid tool comparable ...
Epideme's user avatar
  • 149

1
2 3 4 5