If you know the period of the sine that you want to fit (just fitting the 
amplitude, phase shift, and offset) and are willing to assume normal errors (or 
at least normal enough for the CLT) then you can just use the lm function.  If 
you need to find the period as well (but still willing to assume normal enough 
errors) then you can use the nls function.  You can approximate with splines 
and lm for another approach. 

No packages (other than the automatic ones) needed.

If you are not willing to assume normal enough errors, then we will need more 
data to be able to help.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of ashz
> Sent: Monday, October 18, 2010 6:46 AM
> To: r-help@r-project.org
> Subject: [R] Sine function fitting
> 
> 
> Hi,
> 
> Is there a package to perform a sine function fitting to XY data?
> 
> Thx,
> Ashz
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Sine-
> function-fitting-tp3000156p3000156.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

Reply via email to