Re: [R] glm problem

2009-02-15 Thread Roger
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


Can you explain why this is?

Thanks!




On Sat, Feb 14, 2009 at 8:09 AM, Duncan Murdoch murd...@stats.uwo.cawrote:

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


Re: [R] glm problem

2009-02-15 Thread Uwe Ligges



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 murd...@stats.uwo.cawrote:


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


__
R-help@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.


[R] glm problem

2009-02-14 Thread Roger
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), ]
 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@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.


Re: [R] glm problem

2009-02-14 Thread Duncan Murdoch

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


__
R-help@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.


[R] glm problem

2008-06-26 Thread david einhorn
Hi, 
this is my code:
model-glm(Risk ~ Status + Duration + Credit_History + Credit_amount + Savings 
+  
   Employment + Inst_rate + Residence + Property + Age + plans +
  
Housing + Credits + Job + Liable + Telephone + Foreign_worker + 
  
Purpose_A40 + Purpose_A41 + Purpose_A42 + Purpose_A43 + 
  
Purpose_A44 + Purpose_A45 + Purpose_A46 + Purpose_A48 + Purpose_A49 +   
  
P_Status_A91 + P_Status_A92 + P_Status_A93 + P_Status_A94 + 
  
Others_A101 + Others_A102 + Others_A103,data=Training_Set, 
family=binomial(logit)) 
   

  
### Plotting the ROC curve ###  
  


ROC-roc.plot(model$fitted.values,Training_Set[Risk],show.thres=FALSE,main=My
 ROC Plot,xlab=1-specifity,ylab=sensitivity) 

the glm works fine, but I need to do further analysis on it (roc.plot etc.), so 
I wrote  the last line (from above), and got this error: 
Error: subscript out of bounds
The original dataset is 800 by 34, and the glm was conducted on a training set 
of the 600 first rows.
Can someone help?
- 
Have a wonderful day. 
David Einhorn, Israel. 
972+525058538 
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

__
R-help@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.