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

acemi
Posts: 46
Joined: Thu Jun 23, 2016 10:28 pm

Re: Putting limits on estimated coefficient values

Postby acemi » Thu May 04, 2017 4:46 am

Hello,
I did a logit transformation and want to manually calculate untransformed coefficient value.
I want to verify does @logit(c(2)) = LN(c(2)/(1-c(2))) ?
Thank you.
acemi

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

Re: Putting limits on estimated coefficient values

Postby EViews Gareth » Thu May 04, 2017 7:38 am

Follow us on Twitter @IHSEViews

acemi
Posts: 46
Joined: Thu Jun 23, 2016 10:28 pm

Re: Putting limits on estimated coefficient values

Postby acemi » Thu May 04, 2017 7:45 am

I had looked at the explanation of special functions>logit transformation explanation but cannot map it to how it transforms my c(2).

1/(1+exp(-x))) = exp(x)/(1+exp(x))

c(2) has no relation whatsoever with the expression on LHS..

can elaborate please ?

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Putting limits on estimated coefficient values

Postby startz » Thu May 04, 2017 8:04 am

acemi wrote:I had looked at the explanation of special functions>logit transformation explanation but cannot map it to how it transforms my c(2).

1/(1+exp(-x))) = exp(x)/(1+exp(x))

c(2) has no relation whatsoever with the expression on LHS..

can elaborate please ?

You get 1/(1+exp(-c(2))))

acemi
Posts: 46
Joined: Thu Jun 23, 2016 10:28 pm

Re: Putting limits on estimated coefficient values

Postby acemi » Thu May 04, 2017 1:54 pm

Thank you!

The whole purpose for @logit transformation is to impose/force limits for c(2). For the @logit(c(2)) conversion, the NLS estimation of c(2) is 3,475962 which is clearly not within intended range limits of 0<c(2)<1. So in order to obtain value for @logit(c(2)), substitute this value in 1/(1+exp(-3,475962)) = 0,969996 which is between intended limits. But is it OK to conclude that I have constrained c(2) in this case ?

acemi

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Putting limits on estimated coefficient values

Postby startz » Thu May 04, 2017 2:38 pm

acemi wrote:Thank you!

The whole purpose for @logit transformation is to impose/force limits for c(2). For the @logit(c(2)) conversion, the NLS estimation of c(2) is 3,475962 which is clearly not within intended range limits of 0<c(2)<1. So in order to obtain value for @logit(c(2)), substitute this value in 1/(1+exp(-3,475962)) = 0,969996 which is between intended limits. But is it OK to conclude that I have constrained c(2) in this case ?

acemi


In most cases like this people want the coefficient to between 0 and 1, not specifically the parameter c(2). As you say, using @logit does this. So think of the coefficient as being the value of @logit(c(2)).

acemi
Posts: 46
Joined: Thu Jun 23, 2016 10:28 pm

Re: Putting limits on estimated coefficient values

Postby acemi » Fri May 12, 2017 2:06 pm

Hello,

Is there a way to restrict the parameter c(2) in eviews9 ?Thank you!

startz wrote:
acemi wrote:The whole purpose for @logit transformation is to impose/force limits for c(2). For the @logit(c(2)) conversion, the NLS estimation of c(2) is 3,475962 which is clearly not within intended range limits of 0<c(2)<1. So in order to obtain value for @logit(c(2)), substitute this value in 1/(1+exp(-3,475962)) = 0,969996 which is between intended limits. But is it OK to conclude that I have constrained c(2) in this case ?

acemi


In most cases like this people want the coefficient to between 0 and 1, not specifically the parameter c(2). As you say, using @logit does this. So think of the coefficient as being the value of @logit(c(2)).

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Putting limits on estimated coefficient values

Postby startz » Fri May 12, 2017 2:09 pm

The answer is that same as for earlier versions. You cannot restrict c(2) per se, but generally that's not what's desired. Instead, replace every appearance of c(2) with @logit(c(2)).

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Putting limits on estimated coefficient values

Postby rmoralesaramburu » Tue Jul 02, 2019 1:46 pm

Hi,

I am doing the reparameterization shown in this forum to coinstraint my coefficients.

CODE: SELECT ALL

Code: Select all

[list]ai > 0 and a1 + a2 + ... + ak = 1[/list]


A reparameterization that satisfies these constraints is

CODE: SELECT ALL

Code: Select all

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



I am having an error with my code and I don´t know why. The error is:

Maximum number of iterations exceeded in "OPTIMIZE(MIN)
OPTIVOL(Z1,VDUM,MCOV)" on line 1.

My code is

Code: Select all

subroutine optivol(scalar !scmvol, vector vdum, matrix mmcov)
   scalar sc1=@csum(vdum)
   vector(6) wmvol

      wmvol(1)=exp(vdum(1))/exp(sc1)
      wmvol(2)=exp(vdum(2))/exp(sc1)
      wmvol(3)=exp(vdum(3))/exp(sc1)
      wmvol(4)=exp(vdum(4))/exp(sc1)
      wmvol(5)=exp(vdum(5))/exp(sc1)
      wmvol(6)=exp(vdum(6))/exp(sc1)

   !scmvol=@transpose(wmvol)*mmcov*wmvol
endsub


vector(6) vdum
vdum=1
scalar z1
optimize(min) optivol(z1,vdum,mcov)



Please help!

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: Putting limits on estimated coefficient values

Postby tvonbrasch » Thu Oct 27, 2022 2:40 am

Hi,

I want to estimate this equation:

Code: Select all

YK=C(1)*XK1+C(2)*XK2+C(1)*C(2)*XK3


in a way that ensures that the coefficients are positive. However, I get a "near singular matrix" message when using the @exp function to estimate the equation:

Code: Select all

   equation _test2.ls YK=EXP(C(1))*XK1+EXP(C(2))*XK2+EXP(C(1))*EXP(C(2))*XK3


If I instead use the function @abs, there is no singularity issue:

Code: Select all

   equation _test1.ls YK=abs(C(1))*XK1+abs(C(2))*XK2+abs(C(1))*abs(C(2))*XK3
   show _test1


That said, I am wondering if the @abs function is not in general suitable as the derivative is not always defined.

Attached is the workfile with the data.

Can you please take a look and suggest ways to ensure that the coefficients are positive?
t

Code: Select all

close @all
wfopen .\exp2.wf1


'first equation - no singularity
   equation _test1.ls YK=abs(C(1))*XK1+abs(C(2))*XK2+abs(C(1))*abs(C(2))*XK3
   show _test1

'second equation - singularity ...?
   equation _test2.ls YK=EXP(C(1))*XK1+EXP(C(2))*XK2+EXP(C(1))*EXP(C(2))*XK3
   show _test2s
Attachments
exp2.wf1
(131 KiB) Downloaded 91 times

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

Re: Putting limits on estimated coefficient values

Postby EViews Glenn » Mon Dec 12, 2022 7:26 am

You are correct on the issue of differentiability of abs. I always use the exp function but you have to make sure starting values are appropriate. What are the values when you have issues?

[edit:]

I spent a little more time looking at this. I downloaded the workfile and ran the example at various starting values. I get singularity in all cases because the estimation is driving the coefficients on XK2 to zero (e.g., C(2) is a very large negative number after a few iterations) which I am pretty certain is giving you zero gradients for C(2) and hence, singularity.

As a sanity check, I did a quick simulation of the model and then estimated the coefficients for the simulated data

Code: Select all

c(1) = .5
c(2) = -1
series z = exp(c(1))*xk1 + exp(c(2))*xk2 + exp(c(1)+c(2))*xk3 + 10*nrnd
nrnd(c)
equation eqtest.ls z = exp(c(1))*xk1 + exp(c(2))*xk2 + exp(c(1)+c(2))*xk3

and the estimation produces sensible results.

At this point, I'd say that it looks to be a data issue, not a specification issue. Along these lines, note that the unrestricted linear regression produces estimated coefficients on XK2 and XK3 that are both negative values.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: Putting limits on estimated coefficient values

Postby tvonbrasch » Thu Jan 12, 2023 7:35 am

Thanks for looking into this, Glenn. I will take a second look at the data.
t


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 15 guests