3
$\begingroup$

I am running a generalized linear model with Gamma distribution in R (glm, family=gamma) for my data (gene expression as response variable and few predictors). I want to calculate r-squared for this model.

I have been reading about it online and found there are multiple formulas for calculating $R^2$ (psuedo) for glm (in R) with Gaussian (r2 from linear model), logistic regression (1-deviance/null deviance), Poisson distribution (using pR2 in the pscl package, D-squared value from the modEvA R package). But I could not find anything specific to Gamma distributions.

Can pscl and modEVA packages be used for the Gamma distribution as well, or is there any other formula for doing the same?

$\endgroup$

2 Answers 2

1
$\begingroup$

Your question- yes they can be. Technically, you can use a normal r squared measurement as your goodness of fit measure. It might not be a very good fit measure, but you can certainly use it. Further, you have to ask yourself if your increase in precision is worth the loss of readability of your findings. For example, moving from r-squared to an adjusted r-square is likely to be a meaningful increase in precision at the sacrifice of readability. I personally like McKelvey & Zavoina and other similar approaches (e.g. xu's r squared for mixed models). That does not mean they are the best or only approaches.

$\endgroup$
3
  • $\begingroup$ Thanks for the clarification. Since I have to incorporate this calculation into a script, I will go with the R packages (pscl or modEvA). When you say it might not be a good fit measure, how accurate and reliable these measures are? Do the actual measures deviate a lot form these calculations or they are close but not accurate estimates? $\endgroup$
    – aan
    Commented Jun 2, 2017 at 15:32
  • $\begingroup$ the key thing to understand is that R squared is an estimation of goodness of fit. Depending on how you calculate it, that estimation might get better or worse. You have your model and you test that against your sample. You can then calculate an R squared value based off of how well your model fit your sample. Different R square calculations will give you different measures of goodness of fit. In general, though, most of these all converge at infinity (i.e. you have a big enough sample and it probably does not matter all that much). $\endgroup$
    – JWH2006
    Commented Jun 3, 2017 at 0:27
  • $\begingroup$ to directly answer your questions: 1.) when I say goodness of fit, I mean how reliable the evidence they provide about your models "true" fit to the population. 2.) as for the measures deviating, again, it depends. depends on your model and your sample size. But yes, they can and will. Its best to interpret the r-squared value in context of other values. Nothing stops you from using more than one fit measure. Its common in things like structural equation modeling where they use the CLI, TLI, RMSEA, etc in combination to determine goodness of fit. $\endgroup$
    – JWH2006
    Commented Jun 3, 2017 at 0:32
1
$\begingroup$

Pseudo-$R^2$ formulas aren't specific to distributions. Any generalized linear model will have a likelihood associated with it, and those likelihoods can be used to construct whichever pseudo-$R^2$ you prefer. There is a list of pseudo-$R^2$s with their formulas and a description of their nature here.

$\endgroup$
8
  • $\begingroup$ Couple of things: 1) In my data the response variable is also a continuous variable, since these pseudo R2 are for logistic regression, will they work in my case as well? 2) According to the link you provided: "A pseudo R-squared only has meaning when compared to another pseudo R-squared of the same type, on the same data, predicting the same outcome."Can I use the pseudo R2 for reporting amount of variability explained rather than comparing purposes? 3) Since R2 values vary a lot for the same model (as in example), which one to prefer for my question. $\endgroup$
    – aan
    Commented Jun 2, 2017 at 18:01
  • $\begingroup$ The psR2 don't necessarily have to be "for logistic regression", they're for GLiMs. You have a GLM, so you could use McFadden's, which is analogous to the amount of variability explained. $\endgroup$ Commented Jun 2, 2017 at 19:30
  • $\begingroup$ what does a McFadden R2 value of -1.20 mean $\endgroup$
    – aan
    Commented Jun 2, 2017 at 19:44
  • $\begingroup$ can I use DSquared value instead of McFadden R2, as in my case that seem to make more sense (0.14) as compared to McFadden R2 value (-1.20). $\endgroup$
    – aan
    Commented Jun 2, 2017 at 19:52
  • $\begingroup$ You shouldn't be getting a negative number. Which DSquared? $\endgroup$ Commented Jun 2, 2017 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.