[R] How to do a trig regression
David Winsemius
dwinsemius at comcast.net
Mon Sep 13 05:42:40 CEST 2010
On Sep 12, 2010, at 10:23 PM, Aaditya Nanduri wrote:
> Hello All,
>
> I cant seem to do a trig regression in R.
>
> The equation is as follows : y = a+b*(sin((2*pi*x/360) - c))^2
>
> a, b, c are coefs that I want.
> y, x are input vectors.
>
> The equation I put into R: lm(y ~ sin(2*pi*x/360)^2)
> This equation is missing the c and I dont get the right answer.
Take a look at section 2.3 of:
http://www.statoek.wiso.uni-goettingen.de/veranstaltungen/zeitreihen/sommer03/ts_r_intro.pdf
Or consider using time series or nonlinear modeling.
> Also, I dont know how to plot the lm over the x values instead of the
> indices.
Without an example of your data and what you tried it is difficult to
intuit what problems you may be facing.
--
David.
>
> Any help is sincerely appreciated.
> Thank you all very much.
>
> --
> Aaditya Nanduri
> aaditya.nanduri at gmail.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list