| Date: | Fri, 24 Aug 2001 11:55:46 -0400 |
| Reply-To: | pierre.felx@STATCAN.CA |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Pierre Felx <pierre.felx@STATCAN.CA> |
| Subject: | floating point overflow error |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
I am trying to calculate the coefficients of a logistic regression algorithm
(PROC IML - see below). It works for most datasets I use, but sometimes it
encounters a floating point overflow error which kills the rest of the
program. I wish to be able to continue subsequent steps and output missing
values for the coefficients if this condition occurs. The question is, is
there a way to determine if this condition will occur and to interrupt the
process if it does, so it does not kill the program. Or is there a way to
stop SAS from killing the program even if it does encounter this error.
DO WHILE(diff > 0.000001 & iteration <= 10);
v = exp(x*beta_old) / (1 + exp(x*beta_old)) / (1 + exp(x*beta_old));
mu = exp(x*beta_old)/(1+exp(x*beta_old));
IF ALL(v) = 1 THEN DO;
v2 = x*beta_old + (1/v)#(y - mu);
probmat = t(x#v#wt) * x;
rank = ROUND(TRACE(GINV(probmat)*probmat));
IF rank < NROW(beta) THEN DO;
diff = 0;
beta = REPEAT(.,NCOL(x),1);
END;
ELSE DO;
beta = inv(t(x#v#wt)*(x)) * t(x) * (v2#v#wt);
diff = SUM(abs(beta_old - beta));
beta_old = beta;
END;
END;
ELSE DO;
diff = 0;
beta = REPEAT(.,NCOL(x),1);
END;
iteration = iteration + 1;
END;
Thanks
> Pierre Felx
> Methodologist
> pierre.felx@statcan.ca <mailto:pierre.felx@statcan.ca>
> 11I - R.H. Coats
> Tunney's Pasture
> Ottawa, Ontario
> K1A 0T6
>
> Phone: (613) 951 0075
> Fax: (613) 951 1462
>
|