Page 1 of 1

FLIPTYPE

Posted: Fri Feb 23, 2024 2:28 am
by tvonbrasch
Hi,

For a given data set, how can one ensure that FLIPTYPE rewrites the model in a meaningful way?

Example, consider the equation z+x*h=5*h, where x=0 in the data for one or more time periods. If we want to flip this equation and make h the endogenous variable, it may be rewritten as:

h=(z+x*h)/5

or

h = (5*h - z)/x

The FLIPTYPE command uses the latter specification, which results in a model that will not solve if x=0, see example below.

Is there a clever way to use FLIPTYPE in such a way that it will rewrite the model in an appropriate manner, given the underlying data?


Example:

Code: Select all

'read_model_example_fliptype close @all wfcreate u 1 100 'data genr x=0 genr h=1 genr z=5*h-x*h 'model solves model n n.append h=(z+x*h)/5 n.msg show n n.solve 'model will not solve model m m.append z+x*h=5*h m.fliptype z h m.msg show m m.solve

Re: FLIPTYPE

Posted: Wed Mar 27, 2024 2:30 pm
by EViews Matt
Hello,

The algebra performed by the fliptype procedure doesn't consider special cases when inverting functions, e.g., introducing a potential for division by zero where none existing previously. In general, the procedure will just attempt to "solve for" the leftmost instance of the new endogenous variable. The original form of the equation will therefore influence how the equation is rewritten, e.g., originally specifying Z as "Z-5*H+X*H=0" would cause fliptype to produce the specification for H you desire, but it's still a matter of manually examining and tweaking the model rather than something fully automatic.