Estimating sine using ML

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

RedPepper
Posts: 1
Joined: Thu Mar 05, 2015 5:24 am

Estimating sine using ML

Postby RedPepper » Thu Mar 05, 2015 5:30 am

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!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Estimating sine using ML

Postby trubador » Thu Mar 05, 2015 7:51 am

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.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests