syntax error

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

maoqi
Posts: 17
Joined: Sun Feb 16, 2014 10:49 pm

syntax error

Postby maoqi » Sat Mar 22, 2014 12:29 am

hi, can anyone tell me how to correctly input the following function. It is "syntax error"

log(cs/(cs+ls)) - log(cs(-1)/(cs(-1) + ls(-1))) = c(3)*(c(4) - 1) + (c(4) - 1)/(1-c(2))*(log((cs+ls)/1) - log(cs(-1)+ls(-1))/1)) + (1- c (4))*(log(pk) - log(pk(-1)) - log(py)+log(py(-1)))

Thank you very much.

NicolasR
Posts: 90
Joined: Mon Nov 04, 2013 6:22 pm
Location: Here

Re: syntax error

Postby NicolasR » Sat Mar 22, 2014 6:46 am

Hi,

you miss some brackets or put some more, I estimate it like this:

ls log(cs/(cs+ls)) - log(cs(-1)/(cs(-1) + ls(-1)))=c(3)*(c(4) - 1) + (c(4) - 1)/(1-c(2))*(log(cs+ls)/1)- (log(cs(-1)+ls(-1)))/1+ (1- c (4))*(log(pk) - log(pk(-1)))- log(py)+log(py(-1))

I think that a simpler way to estimate the model would be to generate a depent variable

genr depent=log(cs/(cs+ls)) - log(cs(-1)/(cs(-1) + ls(-1)))+(log(cs(-1)+ls(-1)))/1+log(py)-log(py(-1))

and run

ls depent=c(3)*(c(4) - 1) + (c(4) - 1)/(1-c(2))*(log(cs+ls)/1)+ (1- c (4))*(log(pk) - log(pk(-1)))

Regards.
Last edited by NicolasR on Sat Mar 22, 2014 10:24 am, edited 2 times in total.

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

Re: syntax error

Postby EViews Glenn » Sat Mar 22, 2014 8:15 am

One possible issue with generating a new dependent variable is that EViews forecasting won't be able to generate a forecast of the series inside the expression (this may or may not be an problem for the original poster). A slight variation on NicolasR's approach would be to take better advantage of EViews built-in functions and to generate temps selectively. It's a bit hard to parse the original expression as it's messy and I think there are parentheses errors, so this may not be what was originally desired, but I think something like

Code: Select all

frml cssum = cs + ls frml csratio = cs / cssum equation eq1.ls dlog(csratio) = c(3)*(c(4)-1) + (c(4)-1)/(1-c(2))*dlog(cssum)+ (1-c(4))*(dlog(pk) - dlog(py))
Now I may not be interpreting the original specification correctly in particular the division by 1 in the terms involving log(cs+ls) on the original right hand side and the grouping for the log differences in the final term are a bit puzzling. But I think you'll get the idea. In the above, forecasting would allow you to forecast dlog(csratio) or cs. If you want to forecast cssum, then you can replace the first frml with a series or genr keyword.

NicolasR
Posts: 90
Joined: Mon Nov 04, 2013 6:22 pm
Location: Here

Re: syntax error

Postby NicolasR » Sat Mar 22, 2014 11:16 am

I did not know of the existence of the formula object, thanks Glenn.

maoqi
Posts: 17
Joined: Sun Feb 16, 2014 10:49 pm

Re: syntax error

Postby maoqi » Sat Mar 22, 2014 3:32 pm

there are 3 transformations of my system, why the first function system reflected by eviews as "near singular matrix", but the other two which are similar can be calculated by eviews. Thank you very much.
1st:

log(es)-log(es(-1)) - log(y) +log(y(-1)) = c(1)*(c(2) - 1) + c(2)*( log(py) - log (py(-1)) - log(pe) + log(pe(-1)))

log(cs/(cs+ls)) - log(cs(-1)/(cs(-1) + ls(-1))) = c(3)*(c(4) - 1) + (c(4) - 1)/(1-c(2))*(log((cs+ls)/1) - log((cs(-1)+ls(-1))/1)) + (1- c (4))*(log(pk) - log(pk(-1)) - log(py)+log(py(-1)))

log(ls/(cs+ls)) - log(ls(-1)/(cs(-1) + ls(-1))) = c(5)*(c(4) - 1) + (c(4) - 1)/(1-c(2))*(log((cs+ls)/1) - log((cs(-1)+ls(-1))/1)) + (1- c (4))*(log(pl) - log(pl(-1)) -log(py)+log(py(-1)))


2nd and 3rd are calculated by eviews:

2nd:
log(cs)-log(cs(-1)) - log(y) +log(y(-1)) = c(6)*(c(7) - 1) + c(7)*( log(py) - log (py(-1)) - log(pk) + log(pk(-1)))

log(es/(es+ls)) - log(es(-1)/(es(-1) + ls(-1))) = c(8)*(c(9) - 1) + (c(9) - 1)/(1-c(7))*(log((es+ls)/1) - log((es(-1)+ls(-1))/1)) + (1- c (9))*(log(pe) - log(pe(-1)) - log(py)+log(py(-1)))

log(ls/(es+ls)) - log(ls(-1)/(es(-1) + ls(-1))) = c(10)*(c(9) - 1) + (c(9) - 1)/(1-c(7))*(log((es+ls)/1) - log((es(-1)+ls(-1))/1)) + (1- c (9))*(log(pl) - log(pl(-1)) -log(py)+log(py(-1)))


3rd:
log(ls)-log(ls(-1)) - log(y) +log(y(-1)) = c(11)*(c(12) - 1) + c(12)*( log(py) - log (py(-1)) - log(pl) + log(pl(-1)))

log(cs/(cs+es)) - log(cs(-1)/(cs(-1) + es(-1))) = c(13)*(c(14) - 1) + (c(14) - 1)/(1-c(12))*(log((cs+es)/1) - log((cs(-1)+es(-1))/1)) + (1- c (14))*(log(pk) - log(pk(-1)) - log(py)+log(py(-1)))

log(es/(cs+es)) - log(es(-1)/(cs(-1) + es(-1))) = c(15)*(c(14) - 1) + (c(14) - 1)/(1-c(12))*(log((cs+es)/1) - log((cs(-1)+es(-1))/1)) + (1- c (14))*(log(pe) - log(pe(-1)) -log(py)+log(py(-1)))


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests