Variable Transformation

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Variable Transformation

Postby mricci » Wed Feb 17, 2016 12:22 pm

Dear all,
I am currently trying to simulate a perfect foresight model of fiscal policy with capital variable capacity utilization.
I have noticed that, even following a small initial perturbation, capacity utilization tends exceed 1 during the transitional dynamics: this is consistent with the structure of the model where the initial perturbation is typically associated with a temporary policy response of capital subsidy.
Nevertheless this needs to be fixed as theoretically meaningless: here’s where my problem comes.

I have tried to fix it by using several types of variable transformations: e.g. with ‘m’ being capacity utilization, I have tried f(m)=1/(1+exp(m)),
f(m)= exp(-m)/(1+exp(-m)), f(m)=max(1,m) ect..
(variable transformation has been implemented via local variables..).
However, following this procedure, I end up with the following issues (both not present in the no-transformed models):

1) Jacobian of the static model is singular.
2) I receive this error message:

One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is smaller than 1e-06!
If you believe that the model has a unique solution you can try to reduce the value of qz_zero_threshold.


Now, since capacity utilization also appears as a forward-looking variable in my dynamic model, I am wondering if that is the problem e.g. does Jensen inequality impede variable transformation?
If that is the case, how should I approach the problem of bounding this variable then? (I guess in this case using Dynare Pre-processor for this task would turn out useless for the same reasons).
If that is not the case, does anyone have any clue of what’s wrong?

I attach two .mod files: they are identical in any respects, except that the ‘_mTransf’ contains a variable transformation for ‘m’.

Many thanks in advance, and sorry for the long post.

M
Attachments
Ramsey_mTransf.mod
version with transformed variable
(18.01 KiB) Downloaded 57 times
Ramsey.mod
baseline version
(17.69 KiB) Downloaded 58 times
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Sat Feb 20, 2016 9:33 am

The RamseyInitial.m is missing.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Sat Feb 20, 2016 2:13 pm

Dear Professor Pfeifer,
Thank you very much for your answer.
However, I don't really understand what you mean when you say that "RamseyInitial.m' is missing..
Is that a file? If that is the case, I don't understand why should I need it. The .mod files posted already contain the FOCs of the Ramsey problem.

Best regards,

Mattia
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Sat Feb 20, 2016 3:08 pm

Your mod-file contains
Code: Select all
//Initial conditions:

[Endo0,fval] =fsolve(@RamseyInitial,0.5*ones(1,7),optimset('MaxFunEvals',1e10),W0,beta,chi0,chi1,sigma,eta,z,alpha,gamma,a,g);

Here, a file called RamseyInitial.m is called, which you did not upload.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Sat Feb 20, 2016 5:25 pm

Sure, sorry/
Please find attached the solvers for initial and terminal conditions which are called by my .mod file.

Best regards,

Mattia
Attachments
RamseySS.m
(6.37 KiB) Downloaded 50 times
RamseyInitial.m
(6.39 KiB) Downloaded 50 times
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Fri Feb 26, 2016 9:54 am

I may be missing something, but in initval, you have
Code: Select all
m        = log(1/m0-1);

Your m0 is slightly bigger than 1, leading this the element becoming complex.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Fri Feb 26, 2016 11:37 am

Dear Professor Pfeifer,

Thank you very much for your answer and your patience.

In my model 'm' represents capacity utilization and, therefore, it should be restricted such as: 0<=m<= 1.
Also in steady state, as it is standard, it holds that m=1.

Now, in order to impose 0<=m<= 1 in my model, I have adopted the following transformation: m_old=e(-m_new)/(1+e(-m_new)).
Given this variable transformation, mapping the original steady state/initval (m_old0=1) into the transformed one requires imposing: m_new0=log(1/m_old0-1)=-inf.

Since m_old0 is calculated numerically by a Matlab solver called by the Dynare code (e.g. RamseyInitial.m), it is the case that m_old0 is slighter bigger than one and, consequently, my initval for m_new is a complex number.
Nevertheless this is not the problem: in fact Dynare steady solver is able anyway to calculate correctly the steady state of my model.
And the error message I was mentioning in my first message, is still there even when changing my initval setting so as, say, m_new0=-30.
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Fri Feb 26, 2016 12:31 pm

This will be tricky. The steady state is thus a corner solution with a zero slope. This is potentially problematic during diagnostics, because the purely local properties are degenerate. However, perfect foresight simulation might still work.
Let me ask a more general question: why can capacity utilization not be bigger than 1, i.e. working overtime shifts?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Fri Feb 26, 2016 3:48 pm

Dear Professor Pfeifer,

Exactly! In fact, I was wondering if the error message I receive:

One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is smaller than 1e-06!
If you believe that the model has a unique solution you can try to reduce the value of qz_zero_threshold.


was precisely due to the "bad local properties" of the solution. Can you confirm this is the right interpretation?

Finally, I was wondering: what are the alternatives I have for bounding this variable?

In a deterministic setting, it seems that an inequality constraint can be implemented as well.
However, as I’m writing in this other post: viewtopic.php?f=1&t=7862&p=23031#p2301
this feature is not very well documented in Dynare and it is not clear to me how reliable that is.

PS The variable I am trying to bound, ‘m’, represents the amount of utilized capital which cannot excess the total amount of capital available in the economy.
Also, it is a defining feature of my Ramsey model that this constraint (e.g. m=<1) is occasionally binding.
Therefore I cannot leave it unrestricted.
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Fri Feb 26, 2016 4:39 pm

I cannot "confirm" it, but it looks that way.

Why can't you simply use a max-operator?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Fri Feb 26, 2016 5:40 pm

You mean to replace everywhere in my model 'm' (which is the variable I want to bound) with max(m,1)
(where 1, is in fact its upper bound)?

The problem is that, in my model, 'm' is a forward looking variable as well.
In this regard, I am afraid that replacing m(+1) with max(m(+1),1) will be illegal in light of the Jensen inequality.
On the other side, if I replace only the current period 'm' with max(m,1) (e.g and not its lead and lag), then it seems to me that expectations in this model won't incorporate the possibility of 'binding inequality constraint' in the future.

Does it make sense?

Again thank you very much for all your time and willingness.
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm

Re: Variable Transformation

Postby jpfeifer » Sat Feb 27, 2016 3:08 pm

You should step back for a second and think about what you are trying to do. You said
simulate a perfect foresight model

In a perfect foresight context, Jensen's Inequality does not play a role, because there is no stochastics and expectations are trivial.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Variable Transformation

Postby mricci » Tue Mar 01, 2016 4:27 pm

Dear Professor Pfeifer,

You are perfectly right, in the deterministic simulation the absence of uncertainty implies no role for Jensen inequality.
Then in must be that transformations involving forward looking variables are legal as well.

Thank you very much for your time and patience.

Mattia
mricci
 
Posts: 35
Joined: Sat Aug 16, 2014 3:31 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 14 guests