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

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: 12508
Joined: Tue Sep 16, 2008 5:38 pm
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 1equation 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
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

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: 12508
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Putting limits on estimated coefficient values

The standard errors are for the re-parameterisation.

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

### Re: Putting limits on estimated coefficient values

Great! Thanks
A.

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

### Re: Putting limits on estimated coefficient values

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?

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

### Re: Putting limits on estimated coefficient values

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

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: 2642
Joined: Wed Oct 15, 2008 9:17 am

### Re: Putting limits on estimated coefficient values

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

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: 12508
Joined: Tue Sep 16, 2008 5:38 pm

### Putting limits on estimated coefficient values

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

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

### Re: Putting limits on estimated coefficient values

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"

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

### Re: Putting limits on estimated coefficient values

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

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

### Putting limits on estimated coefficient values

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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.72283155,"math_prob":0.99246055,"size":17169,"snap":"2020-24-2020-29","text_gpt3_token_len":6736,"char_repetition_ratio":0.13568307,"word_repetition_ratio":0.79000926,"special_character_ratio":0.4329897,"punctuation_ratio":0.063454196,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9971389,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-07-11T12:23:10Z\",\"WARC-Record-ID\":\"<urn:uuid:c2cf0172-a519-4585-b710-8c115aafb6c5>\",\"Content-Length\":\"56259\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:77822345-e7a2-4534-b9f2-bdfcce7db89b>\",\"WARC-Concurrent-To\":\"<urn:uuid:1f567b66-91a5-480a-b9a0-ac1f815e1f9a>\",\"WARC-IP-Address\":\"69.80.216.186\",\"WARC-Target-URI\":\"http://forums.eviews.com/viewtopic.php?p=22716\",\"WARC-Payload-Digest\":\"sha1:YV7IZE4I6BKXGI2IND27UN26DPSRQ6UO\",\"WARC-Block-Digest\":\"sha1:QUVYSKDEARNKMJXXZLHART5VIV5HWDLV\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-29/CC-MAIN-2020-29_segments_1593655929376.49_warc_CC-MAIN-20200711095334-20200711125334-00492.warc.gz\"}"}