# Pseudo R equal to one in logistic regression

In Stata, how can pseudo R equal one? This is accompanied by blank spaces in standard error and other indicators. The analysis is binary logistic regression. What can cause this?

----------------------------------------------------------------------------
F | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
BESIM |   1.194625          .        .       .            .           .
KOMUNIKIM |   .2921695          .        .       .            .           .
KOOPERIM |   4.659727          .        .       .            .           .
ANGAZHIM |   1.470268          .        .       .            .           .
KONTROLL |   .5014514          .        .       .            .           .
BURIME |   23.79765          .        .       .            .           .
KOMPETENCA |   .0178707          .        .       .            .           .
KOSTO |   3.393804          .        .       .            .           .
AGJENCI |   .6703374          .        .       .            .           .
DIJE |   6.720107          .        .       .            .           .
_cons |   6.86e-69          .        .       .            .           .
------------------------------------------------------------------------------
Note: 5 failures and 7 successes completely determined.

• Important nuance: those are not blanks, but periods (stops), which in Stata means missings, meaning here "can't be determined". – Nick Cox Jun 4 '14 at 7:42

As Nick Stauner underlines, the model here is futile. 12 cases, 10 predictors and a constant imply what they imply. You have an analogue of two distinct points in the plane which allow a perfect straight line summary.

Here is a reproducible example for different data in Stata which makes the point again. I use Gaussian noise predictors to make it clear that a model need not have substantive virtues for this to happen.

. sysuse auto, clear
(1978 Automobile Data)

. set seed 2803

. forval j = 1/10 {
2.     gen xj' = rnormal()
3. }

.
. logit foreign x* in 46/57

Iteration 0:   log likelihood = -8.1503192
Iteration 1:   log likelihood =          0
Iteration 2:   log likelihood =          0

Logistic regression                               Number of obs   =         12
LR chi2(-1)     =      16.30
Prob > chi2     =          .
Log likelihood =          0                       Pseudo R2       =     1.0000

------------------------------------------------------------------------------
foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
x1 |   64.69274          .        .       .            .           .
x2 |   36.59078          .        .       .            .           .
x3 |   4.771344          .        .       .            .           .
x4 |  -73.23572          .        .       .            .           .
x5 |  -7.960005          .        .       .            .           .
x6 |   28.43037          .        .       .            .           .
x7 |   27.70408          .        .       .            .           .
x8 |  -36.96143          .        .       .            .           .
x9 |   10.73363          .        .       .            .           .
x10 |   8.389412          .        .       .            .           .
_cons |  -20.56464          .        .       .            .           .
------------------------------------------------------------------------------
Note: 7 failures and 5 successes completely determined.

• Is it clear that the OP only has 12 cases? I wasn't sure from what little is presented. – Nick Stauner Jun 3 '14 at 21:33
• If they had more than 12 and some other problem, I guess that Stata would refuse to show coefficient estimates for every predictor. I will happily revisit the question if the OP adds information to the contrary. It's poor practice to show only part of the output. Although I have no reason to doubt it, it's not even explicit that Pseudo-R is 1. – Nick Cox Jun 4 '14 at 7:43

The note at the bottom of your output is important to understand. See Stata FAQ's Explanation of “completely determined” message: it says you either have a great linear predictor or hidden collinearity among your predictors. This may not explain the problem completely, since their examples don't have pseudo $R^2=1$ nor missing standard errors...but if your outcomes are all separated perfectly by your predictors, that might cause the problem. Logistic regression doesn't work quite so well when all observations are 1 for some combination of predictors or all 0` for some other combination. If you only have 12 cases, this model is probably doomed to failure, but if you have more than that, you might want to try some of the suggestions in answers to these related questions: