# 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.

• 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. - Reinstate Monica Mar 11 '17 at 22:07
• @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