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]]

