Page 1 of 1

add coefs of lags up

Posted: Thu Nov 05, 2015 9:20 am
by YK_Econ
Hi,

I have 12 regressions with 3 different dependent variables, where the independent variables change. So it is a 3x4 system. For example, I want to obtain for regression i1 the following: scalar1= 1st coef. then scalar2 = scalar1 + 2 coef; scalar3 = scalar2 + 3rd coef and so on.

this is how far i got. i think it is just a minor mistake in there. Would be nice if anybody could help me.

Code: Select all

matrix (70,70) lags_spec for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number for !h= 1 to 8 'for the lag scalar effect_{%dpv}{!eqnr}{!h} = 0 effect_{%dpv}{!eqnr}{!h} = effect_{%dpv}{!eqnr}{(!h-1)} + {%dpv}{!eqnr}.@coef(!h) 'i think i doesn't want to have the -1 in effect_{%dpv}{!eqnr}{!h-1} lags_spec({((!eqnr)+(!h))},1) = effect_c{!eqnr}{!h} 'this is the matrix where i would like to put the results into next next next
the thing with the matrix must also work differently. I would like to get all my results into a matrix.

Thanks
Best
YK

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 9:24 am
by EViews Gareth
Hard to spot anything wrong.

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 9:30 am
by YK_Econ
eviews says:

EFFECT_c11 is not defined or is an illegal command in
"EFFECT_{%DPV}{!EQNR}{!H} = EFFECT_{%DPV}{!EQNR}{(!H
-1)} + {%DPV}{!EQNR}.@COEF(!H)".

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 9:37 am
by EViews Gareth
Does it exist?

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 9:42 am
by YK_Econ
if you mean effect_c11then yes, and it must exist because of

Code: Select all

for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number for !h= 1 to 8 'for the lag scalar effect_{%dpv}{!eqnr}{!h} = 0 next next next

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 9:49 am
by EViews Gareth
But you're using h-1 not h

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 10:05 am
by YK_Econ
oh yes! this is true! is there any way how i can come around this problem, considering what i want to obtain in the end? as far as i think, the only problem is the first result (where it doesnt have to add up anything).

it is the following: scalar1 = coef1, scalar2= scalar1 + coef2 and so on.

i think this is quite tricky

thanks

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 10:10 am
by EViews Gareth
Perhaps start at 2 inside the loop and calculate the first one outside the loop.

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 11:00 am
by YK_Econ
hmmmm tried this, but got same error (EFFECT_c12 is not defined or is an illegal command in
"EFFECT_{%DPV}{!EQNR}{!H} = EFFECT_{%DPV}{!EQNR}{(!H
-1)} + {%DPV}{!EQNR}.@COEF(!H)".)

Code: Select all

matrix (70,70) lags_spec scalar effect_c11 = c1.@coef(1) for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number for !h= 2 to 8 'for the lag scalar effect_{%dpv}{!eqnr}{!h} = 0 effect_{%dpv}{!eqnr}{!h} = effect_{%dpv}{!eqnr}{(!h-1)} + {%dpv}{!eqnr}.@coef(!h) lags_spec({((!eqnr)+(!h))},1) = effect_c{!eqnr}{!h} next next next

Re: add coefs of lags up

Posted: Thu Nov 05, 2015 11:46 am
by EViews Gareth
You've gone too far out the loop. I think you probably want something like:

Code: Select all

matrix (70,70) lags_spec for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number scalar effect_{%dpv}{!eqnr}1 = {%dpv}{!eqnr}.@coef(1) for !h= 2 to 8 'for the lag scalar effect_{%dpv}{!eqnr}{!h} = 0 effect_{%dpv}{!eqnr}{!h} = effect_{%dpv}{!eqnr}{(!h-1)} + {%dpv}{!eqnr}.@coef(!h) lags_spec({((!eqnr)+(!h))},1) = effect_c{!eqnr}{!h} next next next

Re: add coefs of lags up

Posted: Mon Nov 09, 2015 4:16 am
by YK_Econ
it still doesnt work. it is again: "EFFECT_c12 is not defined or is an illegal command in
"EFFECT_{%DPV}{!EQNR}{!H} = EFFECT_{%DPV}{!EQNR}{(!H
-1)} + {%DPV}{!EQNR}.@COEF(!H)"

hmm.. i really need to make this guy work. any other suggestions?

thanks
best
YK

Re: add coefs of lags up

Posted: Mon Nov 09, 2015 10:40 am
by YK_Econ
this one worked finally!

Code: Select all

'calculate the sum of the WS-coefs continuisly for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number for !h=1 to 8 scalar effect_{%dpv}{!eqnr}{!h} = {%dpv}{!eqnr}.@coef(!h) next next next for %dpv c i y 'for dep var eq for !eqnr= 1 to 4 'for equation number for !h=2 to 8 !hm1 = !h-1 scalar effect_{%dpv}{!eqnr}{!h} = effect_{%dpv}{!eqnr}{!hm1} + {%dpv}{!eqnr}.@coef(!h) next next next
cheers for that!



best
YK