s-news
[Top] [All Lists]

Re: Trapping loess errors in a loop

To: s-news@wubios.wustl.edu
Subject: Re: Trapping loess errors in a loop
From: Madeline Bauer <mbauer@usc.edu>
Date: Sat, 30 May 2009 19:27:37 -0700
Cc: swofsy@seas.harvard.edu,Samer Mouksassi <smouksassi@Pharsight.com>
References: <7j13io$32c4um@msg-ironport2.usc.edu>
Thanks to Samer Mouksassi who suggested using try (loess (... )) and Steve Wofsy who suggested on.error.

Adding "try" in the function works ...
If loess can fit the model, the function returns the model, otherwise, the loess error message is returned. Wonderful!

It looks like on.error (which calls on.exit) will also solve the problem, but I haven't pursued that yet.

Cheers!
Madeline
===========
Here is the modified function ...
fitCommand.tryLoess <- Quote ({
        my.model <- try (loess ( Log10CFU ~ AmB,
                 subset=Subset,
                 span=Span,
                 degree=Degree,
                 normalize=F,
                  family="symmetric" ))
})

===
Madeline Bauer, Ph.D.        University of Southern California
Keck School of Medicine (Infectious Diseases)
IRD Room 620 (MC9520), 2020 Zonal Ave, Los Angeles 90033
(323) 226-2775 [Voice] (FAX by appointment ;-)
mbauer@usc.edu  [Fastest communication method]


<Prev in Thread] Current Thread [Next in Thread>