Page 1 of 1

syntax error

Posted: Sat Mar 22, 2014 12:29 am
by maoqi
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.

Re: syntax error

Posted: Sat Mar 22, 2014 6:46 am
by NicolasR
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.

Re: syntax error

Posted: Sat Mar 22, 2014 8:15 am
by EViews Glenn
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.

Re: syntax error

Posted: Sat Mar 22, 2014 11:16 am
by NicolasR
I did not know of the existence of the formula object, thanks Glenn.

Re: syntax error

Posted: Sat Mar 22, 2014 3:32 pm
by maoqi
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)))