Page **1** of **3**

### Putting limits on estimated coefficient values

Posted: **Tue Sep 30, 2008 4:24 am**

by **neilblake**

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?

Posted: **Tue Sep 30, 2008 8:13 am**

by **EViews Gareth**

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 restrictionsSuppose 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

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 inequalityA commonly encountered mixed type of restriction is to have all parameters non-negative and sum up to one

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.

Posted: **Wed Oct 01, 2008 4:51 am**

by **neilblake**

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

### Re: Putting limits on estimated coefficient values

Posted: **Mon Aug 02, 2010 3:39 pm**

by **Aqua**

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!

### Re: Putting limits on estimated coefficient values

Posted: **Mon Aug 02, 2010 3:48 pm**

by **EViews Gareth**

The standard errors are for the re-parameterisation.

### Re: Putting limits on estimated coefficient values

Posted: **Tue Aug 03, 2010 6:04 am**

by **Aqua**

Great! Thanks

A.

### Re: Putting limits on estimated coefficient values

Posted: **Wed Jun 01, 2011 2:51 am**

by **mrgharibnavaz**

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?

### Re: Putting limits on estimated coefficient values

Posted: **Wed Jun 01, 2011 4:04 am**

by **trubador**

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))

### Re: Putting limits on estimated coefficient values

Posted: **Wed Jun 01, 2011 8:06 pm**

by **mrgharibnavaz**

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

### Re: Putting limits on estimated coefficient values

Posted: **Thu Jun 02, 2011 9:57 am**

by **EViews Glenn**

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

### Re: Putting limits on estimated coefficient values

Posted: **Thu May 03, 2012 2:25 am**

by **ffm**

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

### Putting limits on estimated coefficient values

Posted: **Thu May 03, 2012 2:26 am**

by **EViews Gareth**

Isn't that exactly the type of restriction outlined in your quote?

### Re: Putting limits on estimated coefficient values

Posted: **Thu May 03, 2012 2:47 am**

by **ffm**

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.

### Re: Putting limits on estimated coefficient values

Posted: **Thu Jul 26, 2012 7:13 am**

by **adamboyle88**

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

### Putting limits on estimated coefficient values

Posted: **Thu Jul 26, 2012 7:24 am**

by **EViews Gareth**

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.