# Questions tagged [r-squared]

The coefficient of determination, usually symbolized by $R^2$, is the proportion of the total response variance explained by a regression model. Can also be used for various pseudo R-squared proposed, for instance for logistic regression (and other models.)

249 questions
Filter by
Sorted by
Tagged with
231k views

### When is it ok to remove the intercept in a linear regression model?

I am running linear regression models and wondering what the conditions are for removing the intercept term. In comparing results from two different regressions where one has the intercept and the ...
• 2,031
49k views

### Is $R^2$ useful or dangerous?

I was skimming through some lecture notes by Cosma Shalizi (in particular, section 2.1.1 of the second lecture), and was reminded that you can get very low $R^2$ even when you have a completely linear ...
• 10.1k
13k views

### Is my model any good, based on the diagnostic metric ($R^2$/ AUC/ accuracy/ RMSE etc.) value?

I've fitted my model and am trying to understand whether it's any good. I've calculated the recommended metrics to assess it ($R^2$/ AUC / accuracy / prediction error / etc) but do not know how to ...
• 18.9k
2k views

### How to motivate the definition of $R^2$ in sklearn.metrics.r2_score?

TLDR: What motivates the definition of $R^2$ in the Python function sklearn.metrics.r2_score? DETAILS The Python machine learning package ...
• 65k
3k views

### Interpreting nonlinear regression $R^2$

In ordinary least squares linear regression, $R^2=1-\frac{SSRes}{SSTotal}$ is described as the “proportion of variance explained”. Does this apply to nonlinear regression, too?
• 65k
89k views

### Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?

I have SPSS output for a logistic regression model. The output reports two measures for the model fit, Cox & Snell and ...
• 14.3k
89k views

### Removal of statistically significant intercept term increases $R^2$ in linear model

In a simple linear model with a single explanatory variable, $\alpha_i = \beta_0 + \beta_1 \delta_i + \epsilon_i$ I find that removing the intercept term improves the fit greatly (value of $R^2$ ...
• 2,372
11k views

### Logistic regression with poor goodness of fit (hosmer lemeshow)?

I built a model with 9 categorical predictor variables. Using SPSS, my omnibus test was significant ($\chi^2$=220.01), my -2loglikelihood was 1335.2 (Nagelkerke $R^2$ 0.231), but my Hosmer and ...
• 111
467k views

### When is R squared negative? [duplicate]

My understanding is that $R^2$ cannot be negative as it is the square of R. However I ran a simple linear regression in SPSS with a single independent variable and a dependent variable. My SPSS output ...
• 2,245
2k views

### $R^2$ on out-sample data set

The conventional definition of $R^2$ is: $R^2 = 1-SSE/SST$, where SSE denotes sum of squared errors and SST is total sum of squares ($n\times variance$, n being number of sample points in train set). ...
• 317
368 views

### Is the proportion classified correctly a reasonable analogue of $R^2$ for a classification model?

Let's do some classification and evaluate the prediction quality. The easiest metric to understand is the prediction accuracy, which can be reported as the proportion classified correctly to put the ...
• 65k
156k views

• 5,375
202 views

### How to interpret the UCLA "adjusted count" logistic regression pseudo $R^2?$

Here, UCLA gives a number of pseudo $R^2$ values for evaluating logistic regression models. Despite the issues with doing this, the last two deal with hard classifications rather than the ...
• 65k
22k views

### Manually calculated $R^2$ doesn't match up with randomForest() $R^2$ for testing new data

I know this is a fairly specific R question, but I may be thinking about proportion variance explained, $R^2$, incorrectly. Here goes. I'm trying to use the ...
• 4,323
4k views

### What is an unbiased estimate of population R-square?

I am interested in getting an unbiased estimate of $R^2$ in a multiple linear regression. On reflection, I can think of two different values that an unbiased estimate of $R^2$ might be trying to ...
• 45.5k
76k views

### Pseudo R squared formula for GLMs

I found a formula for pseudo $R^2$ in the book Extending the Linear Model with R, Julian J. Faraway (p. 59). $$1-\frac{\text{ResidualDeviance}}{\text{NullDeviance}}$$. Is this a common formula for ...
• 5,993
43k views

### How to split r-squared between predictor variables in multiple regression?

I have just read a paper in which the authors carried out a multiple regression with two predictors. The overall r-squared value was 0.65. They provided a table which split the r-squared between the ...
• 14.4k
14k views

### Calculating $R^2$ in mixed models using Nakagawa & Schielzeth's (2013) R2glmm method

I have been reading about calculating $R^2$ values in mixed models and after reading the R-sig FAQ, other posts on this forum (I would link a few but I don't have enough reputation) and several other ...
• 797
71k views

### Measuring accuracy of a logistic regression-based model

I have a trained logistic regression model that I am applying to a testing data set. The dependent variable is binary (boolean). For each sample in the testing data set, I apply the logistic ...
• 291
26k views

### MAPE vs R-squared in regression models

Usually regression models are evaluated using $R^2$. I understand this metric can be misleading too at times but as far as I understand the first parameter we look at is $R^2$. There is another ...
• 220
6k views

### Why not use the R squared to measure forecast accuracy?

Why in literature usually the common accuracy measures like MAD, MSE, RMSE, MAPE ... are used. Why not use the $R^2$ (coefficient of determination)? I was thinking about the difference: By using the ...
• 113
8k views

### Can you calculate $R^2$ from correlation coefficents in multiple linear regression?

In simple linear regression, $R^2$ is equivalent to the squared correlation of a dependent and an independent variable. Is this also true for multiple linear regression? For example, I measured trait ...
• 341
1k views

### Why is R2 not reported for GLMs based on last iteration of IRLS weighted least square regression with which it is fit

Given that GLMs are generally fit using iteratively reweighted least squares (based on a Fisher scoring algorithm to maximize the max likelihood objective, which is a variant of Newton-Raphson, see ...
• 3,289
46k views

### Linear regression what does the F statistic, R squared and residual standard error tell us?

I'm really confused about the difference in meaning regarding the context of linear regression of the following terms: F statistic R squared Residual standard error I found this webstie which gave ...
• 753
7k views

### Why squaring $R$ gives explained variance?

This may be a basic question, but I was wondering why an $R$ value in a regression model can simply be squared to give a figure of explained variance? I understand that $R$ coefficient can give the ...
• 199
17k views

### Ridge regression in R with p values and goodness of fit [closed]

Doing ridge regression in R I have discovered linearRidge in the ridge package - which fits a model, reports coefficients and p ...
• 1,485
6k views

### Model uncertainty (model averaging) and R-Squared ($R^2$)

Is it possible to calculate r-squared for an "average model"? Lets say I have 4 different response variables that I want to model to a set (or subset) of 4 independent variables. I'd then like to ...
• 523
2k views

### What does it mean if I have a high F-stat but low $R^2$?

As far as I understand, a high F-stat leads to a high $R^2$, though the converse is not true. What does it mean if I have a high F-stat and a low $R^2$?
• 113
27k views

### Is there any difference between $r^2$ and $R^2$?

The correlation coefficient is usually written with a capital $R$ but sometimes not. I wonder if there really is a difference between $r^2$ and $R^2$? Can $r$ mean something else than a correlation ...
• 627
19k views

### R-squared in quantile regression

I am using quantile regression to find predictors of 90th percentile of my data. I am doing this in R using the quantreg package. How can I determine $r^2$ for ...
• 10.1k
42k views

### What is the relationship between R-squared and p-value in a regression?

tl;dr - for OLS regression, does a higher R-squared also imply a higher P-value? Specifically for a single explanatory variable (Y = a + bX + e) but would also be interested to know for n multiple ...
4k views

### Principal component analysis "backwards": how much variance of the data is explained by a given linear combination of the variables?

I have carried out a principal components analysis of six variables $A$, $B$, $C$, $D$, $E$ and $F$. If I understand correctly, unrotated PC1 tells me what linear combination of these variables ...
• 201
23k views

### Formula for 95% confidence interval for $R^2$

I googled and searched on stats.stackexchange but I cannot find the formula to calculate a 95% confidence interval for an $R^2$ value for a linear regression. Can anyone provide it? Even better, let'...
• 14.4k
998 views

### Justification for and optimality of $R^2_{adj.}$ as a model selection criterion

In a recent thread, use of adjusted $R^2$ ($R^2_{adj.}$) is mentioned in the context of model selection, e.g. The adjustment was invented as a solution to problems caused by variable selection ...
• 68.5k
331 views

### What sense does adjusted $R^2$ and deviance explained mean for quantile generalized additive models (QGAMs)?

I've done some reading here in the past, and my basic assumption is that for a generalized additive model (GAM) or a quantile regression (QR), the following is generally true: For a Gaussian ...
• 15.8k