Dear all,
I was trying to fit a sine function to data, but I found some difficulties.
Ofcourse, estimating y = a + b * sin(x) gave no rise to any problem. However, I want to estimate any y = a + b*sin(cx + d). Hence I wrote a ML-program trying to do this:
series x = @trend
series y = 1 + 2*sin(3*x-4) + nrnd
logl ll1
ll1.append @logl q
ll1.append eps = y - c(1) - c(2)*sin(c(3)*x - c(4))
ll1.append q = -0.5*log(2*3.141592) - log(c(5)) - 0.5*(eps^2 / (2*c(3)^2))
ll1.ml(showstart)
However, I cannot get the right estimates here. What am I doing wrong?
Thanks in advance!
Estimating sine using ML
Moderators: EViews Gareth, EViews Moderator
Re: Estimating sine using ML
Be careful with your initial values for the coefficients (e.g. c(3)>0). And your likelihood function (q) is incorrect. Not to mention that the relationship is quite nonlinear and you may actually need a global optimization routine to find a feasible solution.
Who is online
Users browsing this forum: No registered users and 2 guests
