Dear all, I have a time series and I like to fit S(t) = T(t) + P(t) T(t) = Linear Trend = a + bt P(t) = Periodic Signal = sum(Ai*cos(wt) + Bi*sin(wt) ) for i=1,...,3. Thanks in advance, Best regards,
Use nls(). But you should also take the time to learn a bit about data fits in general. I'm far from expert, but it sure looks like that P(t) is overconstrained. Since cos(wt) = sin(wt+pi/2), why do you have all those different terms? <quote> Dear all, I have a time series and I like to fit S(t) = T(t) + P(t) T(t) = Linear Trend = a + bt P(t) = Periodic Signal = sum(Ai*cos(wt) + Bi*sin(wt) ) for i=1,...,3. </quote>