[R] glm problem

Duncan Murdoch murdoch at stats.uwo.ca
Sat Feb 14 14:09:15 CET 2009


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.




More information about the R-help mailing list