Warren
2006-Oct-11 03:32 UTC
[R] during fitting of successive datasets, stall crashes iterations
Hi all, I am trying to do fitting of large sets of timeseries data, and error messages derail the process when I encounter a dataset that doesn't fit. I'd like to ignore those "misfits" and try another equation or move to the next dataset. Any ideas? (piece of code below) Thanks, --Warren ##The code looks something like this: attach(zf) x <- hours n<-length(zf[,2]) for (i in 2:n) {y <- zf[,i] plot(y ~ x, xlab = "Time (h)", ylab = Lumi, pch = 15) # fitting algorithm looks like this: sine<- nls (y ~ baseline + trend*x + amplitude*(sin(2*pi*(x+phase)/period)), start=list(baseline=4000, amplitude=4000, phase=0, period=24, trend=0), trace=TRUE) ... } -- Warren G. Lewis geelewis@gmail.com [[alternative HTML version deleted]]
Gabor Grothendieck
2006-Oct-11 03:48 UTC
[R] during fitting of successive datasets, stall crashes iterations
See ?try or ?tryCatch. The basic idiom is given here: https://stat.ethz.ch/pipermail/r-help/2005-May/072035.html On 10/10/06, Warren <geelewis at gmail.com> wrote:> Hi all, > I am trying to do fitting of large sets of timeseries data, and error > messages derail the process when I encounter a dataset that doesn't fit. I'd > like to ignore those "misfits" and try another equation or move to the next > dataset. Any ideas? (piece of code below) > > Thanks, --Warren > > ##The code looks something like this: > attach(zf) > x <- hours > n<-length(zf[,2]) > for (i in 2:n) > {y <- zf[,i] > plot(y ~ x, xlab = "Time (h)", ylab = Lumi, pch = 15) > # fitting algorithm looks like this: > sine<- nls (y ~ baseline + trend*x + amplitude*(sin(2*pi*(x+phase)/period)), > start=list(baseline=4000, amplitude=4000, phase=0, period=24, trend=0), > trace=TRUE) > ... > } > > > > > -- > Warren G. Lewis > geelewis at gmail.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >