[R] glm problem

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Feb 15 10:13:33 CET 2009



Roger wrote:
> Thanks for the reply, that was a typo only in the post. as i was trying to
> remove some 'sensitive names'.  In my real work,  i made sure that
> 
> 1) this command runs without problem
> qdata.glm = glm(X258 ~ ., family = binomial, data = qdata[
> sample(dim(qdata)[1], 1000), ] )
> 
> 
> 
> 2) these two gave a warning
> qdata.sample = qdata[sample(dim(qdata)[1], 1000), ]
> qdata.glm = glm(X258 ~ ., family = binomial, qdata.sample)
> 
> Warning message:
> In glm.fit(x = X, y = Y, weights = weights, start = start, etastart =
> etastart,  :
>  fitted probabilities numerically 0 or 1 occurred

Probably you have only one class in your sample.

Uwe Ligges

> 
> Can you explain why this is?
> 
> Thanks!
> 
> 
> 
> 
> On Sat, Feb 14, 2009 at 8:09 AM, Duncan Murdoch <murdoch at stats.uwo.ca>wrote:
> 
>> On 13/02/2009 11:59 PM, Roger wrote:
>>
>>> Hello,
>>>
>>> I have a weird problem here.  What I want to do is that I need to draw
>>> 1000
>>> samples from a matrix, and use glm on them.
>>>
>>> when I used this command, it runs without the problem
>>>
>>>> qdata.glm = glm(X258 ~ ., family = binomial, data =
>>>>
>>> q2data[sample(dim(q2data)[1], 1000), ])
>>>
>>>
>>> but if I drew the sample first and run glm() on that sample, it gave a
>>> warning.
>>>
>>>> qdata.sample = q2data[sample(dim(qdata)[1], 1000), ]
>>>>
>> This looks like a typo:  you took the dim of the wrong thing here.
>>
>> Duncan Murdoch
>>
>>  qdata.glm = glm(X258 ~ ., family = binomial, qdata.sample)
>>> Warning message:
>>> In glm.fit(x = X, y = Y, weights = weights, start = start, etastart =
>>> etastart,  :
>>>  fitted probabilities numerically 0 or 1 occurred
>>>
>>> Because I need to use that same sample later, I have to save it in
>>> qdata.sample. therefore the first command does not work in my case because
>>> I
>>> cannot actually get the same 1000 sample after that.
>>>
>>> anyone knows how to solve this?
>>>
>>> Thanks!
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list