To do it from first principles using nonlinear optimization see: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/20100.html
On Jan 10, 2008 5:27 PM, Carson Farmer <[EMAIL PROTECTED]> wrote: > Hello R community, > > Does anyone know of a package that will perform cycle regression > analysis? I have searched the R-help archives etc. but have come up with > nothing so far. > If I am unable to find an existing R package to do so, is there anyone > familiar with fitting sine functions to data. My problem is this: > I have a long time-series of daily SWE estimates (SWE = snow water > equivalence, or the amount of water stored in a snowpack) which follows > a sinusoidal pattern, and I need to estimate the parameters of the sine > function that best fits this data. While there may be many contributing > sine functions and/or linear trends, I am only interested in a single > sine function that most closely fits the data (trends can be removed > separately if need be). Perhaps some sort of non-linear least squares > method would be best? > > Any help, or suggestions to get me on the right track are greatly > appreciated. > > Carson > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.