Putting limits on estimated coefficient values
Moderators: EViews Gareth, EViews Moderator
Putting limits on estimated coefficient values
I want to use eviews to estimate an equation where one or more of the estimated coefficients is constrained to lie between two predetermined 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?
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?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12908
 Joined: Tue Sep 16, 2008 5:38 pm
There is currently no builtin 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 onesided restrictions) and the logit and arctan (for twosided restrictions).
Onesided 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
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 1exp(c(2)) (which you can store as a named scalar or in a named coef vector).
Twosided 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
In our example, we have L = 1 and H = 1 so you would specify the equation as
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 nonnegative and sum up to one
A reparameterization that satisfies these constraints is
where the bi parameters are unconstrained.
Onesided 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) + (1exp(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 1exp(c(2)) (which you can store as a named scalar or in a named coef vector).
Twosided 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
(HL)*@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 nonnegative 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.
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!
Thanks a lot,
Aqua!

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12908
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Putting limits on estimated coefficient values
The standard errors are for the reparameterisation.
Follow us on Twitter @IHSEViews
Re: Putting limits on estimated coefficient values
Great! Thanks
A.
A.

 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)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p2*q2 = c(2)*p2+c(18)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p3*q3 = c(3)*p3+c(19)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p4*q4 = c(4)*p4+c(20)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p5*q5 = c(5)*p5+c(21)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p6*q6 = c(6)*p6+c(22)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p7*q7 = c(7)*p7+c(23)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p8*q8 = c(8)*p8+c(24)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p9*q9 = c(9)*p9+c(25)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p10*q10 = c(10)*p10+c(26)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p11*q11 = c(11)*p11+c(27)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p12*q12 = c(12)*p12+c(28)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p13*q13 = c(13)*p13+c(29)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p14*q14 = c(14)*p14+c(30)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p15*q15 = c(15)*p15+c(31)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p16*q16 = c(16)*p16+c(32)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(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?
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)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p2*q2 = c(2)*p2+c(18)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p3*q3 = c(3)*p3+c(19)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p4*q4 = c(4)*p4+c(20)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p5*q5 = c(5)*p5+c(21)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p6*q6 = c(6)*p6+c(22)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p7*q7 = c(7)*p7+c(23)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p8*q8 = c(8)*p8+c(24)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p9*q9 = c(9)*p9+c(25)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p10*q10 = c(10)*p10+c(26)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p11*q11 = c(11)*p11+c(27)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p12*q12 = c(12)*p12+c(28)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p13*q13 = c(13)*p13+c(29)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p14*q14 = c(14)*p14+c(30)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p15*q15 = c(15)*p15+c(31)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(16)*p16)
p16*q16 = c(16)*p16+c(32)*( m c(1)*p1c(2)*p2c(3)*p3c(4)*p4c(5)*p5c(6)*p6c(7)*p7c(8)*p8c(9)*p9c(10)*p10c(11)*p11c(12)*p12c(13)*p13c(14)*p14c(15)*p15c(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
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))

 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
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 Developer
 Posts: 2659
 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.
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 nonnegative 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
Regarding the "Mixed equality and inequality" constraint topic:
"A commonly encountered mixed type of restriction is to have all parameters nonnegative 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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12908
 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?
Follow us on Twitter @IHSEViews
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
(HL)*@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.
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
(HL)*@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.

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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12908
 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.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 10 guests