Putting limits on estimated coefficient values

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

neilblake
Posts: 17
Joined: Tue Sep 30, 2008 4:19 am

Putting limits on estimated coefficient values

Postby neilblake » Tue Sep 30, 2008 4:24 am

I want to use e-views to estimate an equation where one or more of the estimated coefficients is constrained to lie between two pre-determined values.

For example:

Estimate

X = beta.Y + C


Where beta has to lie somewhere between 0.1 and 0.3.

I know that some other programs do this (using a grid search technique) but I can’t figure out how to do it in EViews other than by using “if” statements. While “if” statements work fine if there is only one restriction, they get very messy if there are multiple restriction. Does anyone have any idea if it is possible to do a grid search when estimating equation coefficients or some equivalent solution in EViews?

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

Postby EViews Gareth » Tue Sep 30, 2008 8:13 am

There is currently no built-in procedure to impose inequality constraints on coefficients during estimation. A standard "hack" to impose simple inequality constraints is to apply a monotonic transformation to the coefficient so that the transformed expression takes on values only in the desired range. The commonly used transformations are the exponential (for one-sided restrictions) and the logit and arctan (for two-sided restrictions).

One-sided restrictions

Suppose in a regression of y on a constant and x you want to restrict the coefficient estimate on x to be no larger than 1. Then you can specify your equation as follows

Code: Select all

' restrict coef on x not to exceed 1
equation eq1.ls y = c(1) + (1-exp(c(2)))*x


Note that you have to explicitly specify your equation with an equals sign since the transformation introduces a nonlinear specification. Although EViews will report an estimate for c(2), the estimated coefficient on x is given by the expression 1-exp(c(2)) (which you can store as a named scalar or in a named coef vector).

Two-sided restrictions

Suppose in a regression of y on a constant and x you want to restrict the coefficient estimate on x to be between -1 and 1. You can use the following logit transformation if you want to restrict your coefficient, say c(2), to lie between L and H

Code: Select all

(H-L)*@logit(c(2)) + L


In our example, we have L = -1 and H = 1 so you would specify the equation as

Code: Select all

equation eq2.ls y = c(1) + (2*@logit(c(2))-1)*x

Again EViews will only report an estimate for c(2) and you will have to manually compute the expression 2*@logit(c(2))-1 to obtain the point estimate of the coefficient on x.

Mixed equality and inequality

A commonly encountered mixed type of restriction is to have all parameters non-negative and sum up to one

Code: Select all

ai > 0 and a1 + a2 + ... + ak = 1


A reparameterization that satisfies these constraints is

Code: Select all

ai = exp( bi ) / ( exp( b1 ) + exp( b2 ) + ... + exp( bk ) )


where the bi parameters are unconstrained.

neilblake
Posts: 17
Joined: Tue Sep 30, 2008 4:19 am

Postby neilblake » Wed Oct 01, 2008 4:51 am

Many thanks. It might be a "hack" but it works a treat.

Aqua
Posts: 14
Joined: Mon Aug 02, 2010 7:17 am

Re: Putting limits on estimated coefficient values

Postby Aqua » Mon Aug 02, 2010 3:39 pm

Very good 'hack'. One question: when a constraint is put on a parameter, say c(2), the standard errror Eviews returns is for c(2) or the restriction on c(2)?
Thanks a lot,
Aqua!

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

Re: Putting limits on estimated coefficient values

Postby EViews Gareth » Mon Aug 02, 2010 3:48 pm

The standard errors are for the re-parameterisation.
Follow us on Twitter @IHSEViews

Aqua
Posts: 14
Joined: Mon Aug 02, 2010 7:17 am

Re: Putting limits on estimated coefficient values

Postby Aqua » Tue Aug 03, 2010 6:04 am

Great! Thanks
A.

mrgharibnavaz
Posts: 2
Joined: Thu Nov 05, 2009 6:16 pm

Re: Putting limits on estimated coefficient values

Postby mrgharibnavaz » Wed Jun 01, 2011 2:51 am

Hi everyone,

I’m going to estimate a system of LES demand equations by applying Seemingly Unrelated Regression (SURE) method. For this purpose, one of the coefficients must be positive. To explain clearly, this is my demand function:

Pi*Xi = Pi*μi + αi(m-∑Pj*μj)
In which, μ>0 and ∑αi =1 must be imposed as coefficient restriction, I defined my system of equations for 16 commodities like:

p1*q1 = c(1)*p1+(1-(c(18)+c(19)+c(20)+c(21)+c(22)+c(23)+c(24)+c(25)+c(26)+c(27)+c(28)+c(29)+c(30)+c(31)+c(32)))*(m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p2*q2 = c(2)*p2+c(18)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p3*q3 = c(3)*p3+c(19)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p4*q4 = c(4)*p4+c(20)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p5*q5 = c(5)*p5+c(21)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p6*q6 = c(6)*p6+c(22)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p7*q7 = c(7)*p7+c(23)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p8*q8 = c(8)*p8+c(24)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p9*q9 = c(9)*p9+c(25)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p10*q10 = c(10)*p10+c(26)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p11*q11 = c(11)*p11+c(27)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p12*q12 = c(12)*p12+c(28)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p13*q13 = c(13)*p13+c(29)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p14*q14 = c(14)*p14+c(30)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p15*q15 = c(15)*p15+c(31)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)
p16*q16 = c(16)*p16+c(32)*( m- c(1)*p1-c(2)*p2-c(3)*p3-c(4)*p4-c(5)*p5-c(6)*p6-c(7)*p7-c(8)*p8-c(9)*p9-c(10)*p10-c(11)*p11-c(12)*p12-c(13)*p13-c(14)*p14-c(15)*p15-c(16)*p16)


Where c(1) , c(2), c(3),,,,,,,c(16) must be positive. However, I know Eviews does not let us to impose inequality constraints. Any thought?

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

Re: Putting limits on estimated coefficient values

Postby trubador » Wed Jun 01, 2011 4:04 am

Aqua wrote:Where c(1) , c(2), c(3),,,,,,,c(16) must be positive. However, I know Eviews does not let us to impose inequality constraints. Any thought?

I think you should first estimate the model without imposing any restrictions to see if the results actually violate these conditions. If they do, then you can use exponential transformation for your coefficients (e.g. exp(c(1)) instead of c(1))

mrgharibnavaz
Posts: 2
Joined: Thu Nov 05, 2009 6:16 pm

Re: Putting limits on estimated coefficient values

Postby mrgharibnavaz » Wed Jun 01, 2011 8:06 pm

Thanks for you comment,

this method does not work, I just added exp(c(.)) instead of c(.), but eviews gave me singularity error "near singular matrix" error, any thought?

Regards,
Reza

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

Re: Putting limits on estimated coefficient values

Postby EViews Glenn » Thu Jun 02, 2011 9:57 am

Probably that exp(c()) is really big for some starting values. You'll probably have to adjust those accordingly.

ffm
Posts: 2
Joined: Thu May 03, 2012 2:03 am

Re: Putting limits on estimated coefficient values

Postby ffm » Thu May 03, 2012 2:25 am

Hi

Regarding the "Mixed equality and inequality" constraint topic:

"A commonly encountered mixed type of restriction is to have all parameters non-negative and sum up to one
ai > 0 and a1 + a2 + ... + ak = 1
A reparameterization that satisfies these constraints is
ai = exp( bi ) / ( exp( b1 ) + exp( b2 ) + ... + exp( bk ) )
where the bi parameters are unconstrained."

Now, I would like to estimate y = a1 + a2*x + a3*z, with a2>0, a3>0 and a2+a3=1:

How does the equation look like in EViews?

Thanks

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

Putting limits on estimated coefficient values

Postby EViews Gareth » Thu May 03, 2012 2:26 am

Isn't that exactly the type of restriction outlined in your quote?
Follow us on Twitter @IHSEViews

ffm
Posts: 2
Joined: Thu May 03, 2012 2:03 am

Re: Putting limits on estimated coefficient values

Postby ffm » Thu May 03, 2012 2:47 am

Many thanks and yes.

Just not sure how to specify the equation in this case, similar to your example below for eq2.

"Suppose in a regression of y on a constant and x you want to restrict the coefficient estimate on x to be between -1 and 1. You can use the following logit transformation if you want to restrict your coefficient, say c(2), to lie between L and H

(H-L)*@logit(c(2)) + L

In our example, we have L = -1 and H = 1 so you would specify the equation as

equation eq2.ls y = c(1) + (2*@logit(c(2))-1)*x"


Thanks again for your help.

adamboyle88
Posts: 1
Joined: Thu Jul 26, 2012 7:03 am

Re: Putting limits on estimated coefficient values

Postby adamboyle88 » Thu Jul 26, 2012 7:13 am

Hi,

I have tried to use this "hack" on two parameter estimates, one parameter 4<w(1)<15, and a second 0.1<m(1)<0.9 by writing:

(0.8*@logit(m(1))+0.1) and(11*@logit(w(1))+4)

however when i run the regression the parameters do not conform to this restraint even when I give the parameters starting values. Can anyone suggest why this may be happening? I am trying to calibrate the model that I am using on a specific test period in which I know that the parameters should converge within the constraints so am unsure why the hack isnt working?

Thanks

Adam

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

Putting limits on estimated coefficient values

Postby EViews Gareth » Thu Jul 26, 2012 7:24 am

EViews Gareth wrote:Again EViews will only report an estimate for c(2) and you will have to manually compute the expression 2*@logit(c(2))-1 to obtain the point estimate of the coefficient on x.

Follow us on Twitter @IHSEViews


Return to “Estimation”

Who is online

Users browsing this forum: Google [Bot] and 22 guests