Koyck Model MLE

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

BiXiC
Posts: 15
Joined: Wed Jan 29, 2014 3:20 am

Koyck Model MLE

Postby BiXiC » Mon May 12, 2014 3:40 am

Hi, I want to estimate Koyck model with ML in Eviews
https://www.google.ru/url?sa=t&rct=j&q= ... GE&cad=rjt
S = mu + beta*A + lambda*S(-1) + e - lambda*e(-1)

But i don't get how to make BFGS algorithm or the Newton-Raphson algorithm in Eviews. Can smb help me?

P.S. I use Eviews 8

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Koyck Model MLE

Postby EViews Glenn » Thu May 15, 2014 11:20 am

Code: Select all

optimize
Chapter 10 - User Defined Optimization
EViews 8 Command and Programming Reference

BiXiC
Posts: 15
Joined: Wed Jan 29, 2014 3:20 am

Re: Koyck Model MLE

Postby BiXiC » Fri May 16, 2014 7:10 am

I got it. But is it possible to estimate that kind of models in equation object?
If I try: S = c(1) + c(2)*A + c(3)*S(-1)+[ma(1) = c(3)], i get error message: MA and SMA terms are only allowed in equations specified by a list of regressors.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Koyck Model MLE

Postby EViews Glenn » Fri May 16, 2014 8:48 am

You can, but you'll have to build the likelihood evaluation yourself. There is nothing in the optimize that handles those terms directly.

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

Re: Koyck Model MLE

Postby trubador » Fri May 16, 2014 2:01 pm

I got it. But is it possible to estimate that kind of models in equation object?
If I try: S = c(1) + c(2)*A + c(3)*S(-1)+[ma(1) = c(3)], i get error message: MA and SMA terms are only allowed in equations specified by a list of regressors.
Franses and van Oest (2004) draw attention to two things:

1) Importance of parameter restriction. Correct specification would be S = c(1) + c(2)*A + c(3)*S(-1) + [ar(1) = c(3)]. EViews utilizes nonlinear least squares in estimating ARMA models by default. This seems to be fine with the paper as imposing the restriction results in a much more material difference than the choice of estimation algorithm. Please see the following if you need further information on ARMA estimation in EViews: http://forums.eviews.com/viewtopic.php?f=7&t=465

2) Necessity of a new t-statistic for hypothesis testing on the coefficient of advertising, c(2), as the asymptotic distribution would not be standard normal. You can either use the critical values in Table 2, or run a similar monte carlo simulation after you estimate the model and obtain the value of c(2).

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Koyck Model MLE

Postby startz » Fri May 16, 2014 2:25 pm

I got it. But is it possible to estimate that kind of models in equation object?
If I try: S = c(1) + c(2)*A + c(3)*S(-1)+[ma(1) = c(3)], i get error message: MA and SMA terms are only allowed in equations specified by a list of regressors.
Franses and van Oest (2004) draw attention to two things:

1) Importance of parameter restriction. Correct specification would be S = c(1) + c(2)*A + c(3)*S(-1) + [ar(1) = c(3)]. EViews utilizes nonlinear least squares in estimating ARMA models by default. This seems to be fine with the paper as imposing the restriction results in a much more material difference than the choice of estimation algorithm. Please see the following if you need further information on ARMA estimation in EViews: http://forums.eviews.com/viewtopic.php?f=7&t=465

2) Necessity of a new t-statistic for hypothesis testing on the coefficient of advertising, c(2), as the asymptotic distribution would not be standard normal. You can either use the critical values in Table 2, or run a similar monte carlo simulation after you estimate the model and obtain the value of c(2).
Trubador,
I think the paper does give a (problematic for EViews) MA rather than AR specification.

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

Re: Koyck Model MLE

Postby trubador » Fri May 16, 2014 3:53 pm

Ah yes, Startz you are right. Then the only way to estimate this model, as Glenn pointed out, would be the use of optimize along the following lines:

Code: Select all

subroutine loglikelihood(series logl,coef beta,series y,series x) smpl @first @first series res = 0 smpl @first+1 @last series res = y - beta(1)*x - beta(2)*y(-1) - beta(3)*@seas(1) - beta(4)*@seas(2) - beta(5)*@seas(3) - beta(6)*@seas(4) - beta(7)*@seas(5) - beta(8)*@seas(6) - beta(9)*@seas(7) - beta(10)*@seas(8) - beta(11)*@seas(9) - beta(12)*@seas(10) - beta(13)*@seas(11) - beta(14)*@seas(12) + beta(2)*res(-1) logl = @log((1/beta(15))*@dnorm(res/beta(15))) endsub 'Initialize coefficients and series series logl = 0 coef(15) beta = .5 beta(15) = 100 'standard error of regression smpl @first+2 @last optimize(ml=1, finalh=hessmat, hess=bfgs) loglikelihood(logl,beta,sales,advertising) vector semat = @sqrt(@getmaindiagonal(-@inverse(hessmat))) 'standard errors of estimated parameters scalar loglik = @sum(logl) 'log likelihood smpl @all

BiXiC
Posts: 15
Joined: Wed Jan 29, 2014 3:20 am

Re: Koyck Model MLE

Postby BiXiC » Mon May 19, 2014 2:20 am

I constructed similar code but I have an error: Objective function evalueates to NA for one or more observations in "OPTIMIZE..."
My Sales and tvrs seriesd don't have any NA values. What is wrong?

Code: Select all

' Koyck model: ' S = c(1) + c(2) * S(-1) + c(3) * TVR + e - c(2) * e(-1) ' e = S - c(1) - c(2) * S(-1) - c(3) * TVR + c(2) * e(-1) subroutine loglike(series logl, vector beta, series S, series TVR) smpl @first @first series r = 0 smpl @first+1 @last series r = S - beta(1) - beta(2) * S(-1) - beta(3) * TVR + beta(2) * r(-1) logl = @log((1 / beta(4)) * @dnorm(r / beta(4))) endsub ' create series LL which holds the likelihood contribution series LL = 0 ' create the coefficient vector BETA vector(4) coefs_Koyck_model_ML coefs_Koyck_model_ML = 0.5 coefs_Koyck_model_ML(4) = 10 smpl @first+1 @last optimize(ml=1, finalh=mlhess, hess=bfgs) loglike(LL, coefs_Koyck_model_ML, sales, tvrs) smpl @all ' MLSE - The coefficient standard errors for the maximum likelihood estimates vector MLSE = @sqrt(@getmaindiagonal(-@inverse(mlhess))) ' Calculating unbiased estimate of sigma scalar ubsig = mlcoefs(2)*@sqrt(@obs(LL)/(@obs(LL) - @rows(coefs_Koyck_model_ML)+ 1)) %status = @optmessage statusline {%status}

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

Re: Koyck Model MLE

Postby trubador » Mon May 19, 2014 5:40 am

Try adjusting the sample period before Optimize as follows:

Code: Select all

smpl @first+2 @last

BiXiC
Posts: 15
Joined: Wed Jan 29, 2014 3:20 am

Re: Koyck Model MLE

Postby BiXiC » Mon May 19, 2014 11:42 pm

I tried. Still do not working. Same problem :(


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests