restricting coef

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

restricting coef

Postby mjfl » Thu Aug 11, 2011 6:00 am

hi all,

i have read some methods to make all coeff add up to 1. eg c(1)+c(2)+c(3)=1 so rite c(3) in the least square as 1-c(1)-c(2).
1. what if i have lags that choose by themselves and i would like the lags to add up to 1 in all eqn? how can i do it?

Code: Select all

for !horizon= 59 to 82 smpl 1989q1 1989q1+!horizon equation eq{!horizon} for !i=0 to !maxlags for !j=0 to !maxlags eq{!horizon}.ls(cov=hac) y c x( to -!i) z( to -!j) if eq{!horizon}.@sc < !sc then !best2lag =!j !bestlag = !i !sc = eq{!horizon}.@sc endif next next eq{!horizon}.ls(cov=hac) y c x( to -!bestlag) z( to -!best2lag)

2. what if i would like the coefficient to remain 1? i.e. eq.ls y x z but coefficent of z is always 1?
3. is there anyway to restrict a cointreg such that coefficients add up to 1 too?

Code: Select all

equation eq4.cointreg y=c(1)*x+(1-c(1))*z

pls advice and thank u in advance. :)

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Re: restricting coef

Postby mjfl » Mon Aug 15, 2011 8:04 am

hi sorry could i get some phelp on this pls?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: restricting coef

Postby EViews Gareth » Mon Aug 15, 2011 8:43 am

1) Since you can only impose the adding up condition when specifying an equation by expression, you'll have to change your code so that it specifies your equation by expression

2) ls y-z x

3) No


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests