Page 3 of 3

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 4:46 am
by acemi
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

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 7:38 am
by EViews Gareth

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 7:45 am
by acemi
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 ?

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 8:04 am
by startz
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))))

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 1:54 pm
by acemi
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

Re: Putting limits on estimated coefficient values

Posted: Thu May 04, 2017 2:38 pm
by startz
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)).

Re: Putting limits on estimated coefficient values

Posted: Fri May 12, 2017 2:06 pm
by acemi
Hello,

Is there a way to restrict the parameter c(2) in eviews9 ?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)).

Re: Putting limits on estimated coefficient values

Posted: Fri May 12, 2017 2:09 pm
by startz
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)).

Re: Putting limits on estimated coefficient values

Posted: Tue Jul 02, 2019 1:46 pm
by rmoralesaramburu
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!

Re: Putting limits on estimated coefficient values

Posted: Thu Oct 27, 2022 2:40 am
by tvonbrasch
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

Re: Putting limits on estimated coefficient values

Posted: Mon Dec 12, 2022 7:26 am
by EViews Glenn
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.

Re: Putting limits on estimated coefficient values

Posted: Thu Jan 12, 2023 7:35 am
by tvonbrasch
Thanks for looking into this, Glenn. I will take a second look at the data.
t