# calculating R square for a logistic regression [duplicate]

can anyone help me with how to calculate R-squared for a logistic regression- How do I use the deviance for this Purpose ?

Additionaly, the question in matlab: I am calculating a psychometric function using the "glmfit" function in matlab, with 'probit' parameter.

It returns "dev" variable, and I do not understand how to calculate from this value the goodness of fit of the model - R-squared.

Any advice?

• I think only pseudo exists – SmallChess Mar 11 '17 at 22:07
• Welcome to CV. Since you're new here, you may want to take our tour, which has information for new users. There is no direct equivalent of $R^2$ (in the linear regression) for logistic regression. But it is possible to compute other measures resembling $R^2$ called pseudo-$R^2$'s. However, their interpretation might be tricky and yield different results. For more information, check this link. Also, questions focusing on programming, debugging, or performing routine operations within a statistical computing platform are off-topic here. – T.E.G. Mar 11 '17 at 22:07
• While questions focusing on programming, debugging, or performing routine operations within a statistical computing platform are off-topic here, they on-topic with the sister site Stack Overflow. Stack Overflow has the expectation that you will provide what code you have created and explain where you are stuck. – Tavrock Mar 11 '17 at 22:35
• @StudentT There's also Lonnie Magee's Generalized $R^{2}$ based on log-likelihood measures: Magee, L. (1990). $R^{2}$ measures based on Wald and likelihood ratio joint significance tests. The American Statistician, 44(3):250–253. – Alexis Mar 12 '17 at 0:52