1

Possible Duplicate:
Why am I getting “algorithm did not converge” and “fitted prob numerically 0 or 1” warnings with glm?

I am trying to to fit glm using the following data with response variable y1 as categorical. The code is giving me the following Warning message:

glm.fit: fitted probabilities numerically 0 or 1 occurred

Sometimes, it does give me error

glm.fit: algorithm did not converge

From the data it is evident that there is a clear relation between predictor and response variable.

  1. Is the 'did not converge' error because of less number of data points?

  2. glm is converting the response variable into factor as shown below. Is this normal?

  3. Having an x1 and x2 value, how can I know the response?

      x1 = c(runif(10,50,100) , runif(10,101,150) )
      x2 = c(runif(10,1,50) , runif(10,51,100) )
      y1 = c(rep('n',10), rep('y',10)) 
      tmpData = data.frame(x1,x2,y1)
      tmpData
      str(tmpData)
      model <- glm(formula = 'y1~x1+x2', family=binomial(), na.action=na.omit, data=tmpData)
      summary(model) 
    
     >str(tmpData)
    'data.frame':   20 obs. of  3 variables:
     $ x1: num  97.9 90.3 62.1 76 63.5 ...
     $ x2: num  18.6 49.4 21.2 47.7 24.8 ...
     $ y1: Factor w/ 2 levels "n","y": 1 1 1 1 1 1 1 1 1 1 ...
    
Community
  • 1
  • 1
user1140126
  • 2,621
  • 7
  • 29
  • 34
  • 2
    have you googled this error message? Or google for "complete separation" ... or search on SO: http://stackoverflow.com/questions/8596160/why-am-i-getting-algorithm-did-not-converge-and-fitted-prob-numerically-0-or – Ben Bolker Jan 09 '13 at 16:53
  • 1
    This is a common problem in R with the glm, if you google a bit you will find different clues to look for. one of the reasons might be that your data is too perfect. Do a search in http://stats.stackexchange.com/ and you will find out many questions/answers for the same problem you have. – Gago-Silva Jan 09 '13 at 16:57
  • This is a repost of this closed question: http://stats.stackexchange.com/questions/47327/how-to-perform-glm-on-categorical-data-in-r – Aaron left Stack Overflow Jan 09 '13 at 16:58

0 Answers0