[R] glm output format

From: Bojuan Zhao <bojuanzhao_at_yahoo.com>
Date: Fri, 04 Jun 2010 20:21:09 -0700 (PDT)


Hello,
 

I am running a loop to compare some residual deviances obtained from glm, with codes: ........
 

OUT<-NULL
for (i in 1:10){ 
myglm<-glm(mat ~X1+X2+X3,family = binomial, data =myDATA) OUT<-c(OUT,myglm$deviance) }
 

.......
 

In the loop, X1, X2, and X3 chage with i. If X1, X2 and X3 are not highly correlated, OUT is a vector of 10 values.
 

The problem is:  if there there is one set of X1,X2,X3 that are highly correlated, the program stopped, with error message: "qr.solve(qr.R(object$qr)[p1, p1]) : singular matrix 'a' in solve."  
 

I wonder if there is a way I can skip the highly correlated case and get a NA as the response, instead of letting the whole loop stop with no OUT output at all.  That is, I want to get the OUT vector with 9 values and one NA. 
 

Is there a way I can do so?
 

Many Thanks,
Barbara
 
 
 

      
	[[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. Received on Sat 05 Jun 2010 - 05:42:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 05 Jun 2010 - 07:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive