Execution and computation properties (EV 6)

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

nadja123
Posts: 72
Joined: Thu Aug 06, 2009 10:43 am

Execution and computation properties (EV 6)

Postby nadja123 » Sun Apr 25, 2010 11:22 am

Hi there,

sorry I don't quite know under which theme I should best post these questions.

I have just been thinking whether in EViews 6 it is possible:
1. to run more code lines in the interactive mode by one 'enter' click (equivalent to e.g. "Evaluate Selection" in Matlab)? I suppose not.
2. to solve something I would call loosely a 'a system of matrix equation'?
B, Q, C - known matrices, Q is symmetric
A - unknown matrix, but some elements are restricted to be known numbers

Solve for A:
(1) A * B = C
(2) A A ' = Q
I am not acquainted to matrix computations in EViews, but in case yes, a hint to commands or chapters in the documentation would be very helpful.

Thanks for helping and as I am increasingly using EViews, especially many thanks for this Forum!!!

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Execution and computation properties (EV 6)

Postby EViews Chris » Mon Apr 26, 2010 11:12 am

I'm not quite sure I follow what you're trying to do as far as the matrix equations go. You would probably need to specify some sort of objective to make the problems meaningful since the restrictions on A are typically going to imply that the problems don't have exact answers.

Here's some ideas that might help (although I haven't necessarily thought through the details).

As far as solving (1) goes, what you're really doing is solving a set of equations of the form:

B' a = c

where a is a *row* of A and c is the matching *row* of C.

If some elements of a are fixed, you could rewrite this as:

B0' a0 = c - B1' a1

where a and B have been partitioned so that a0 contains the unconstrained parts of a and a1 contains the constrained parts of A.

If you now say that your objective is to choose A to minimize the frobenius norm of (A B - C) then each of these row equations becomes a least squares problem, much the same as the normal case of X beta = y where B0' is the X matrix, a0 is beta and c - B1' a1 is y. You can solve for a0 using the standard least squares formula: beta = inverse(X'X) * (X'y).

I'm assuming that (2) is a separate problem from (1). Note that A is not identified in the unconstrained case in (2), and you would normally need to impose extra conditions to identify A (eg. A is lower triangular, in which case the cholesky factorization of Q is the answer, or A is symmetric, in which case the matrix square root of Q is the answer).

I don't have any ideas off the top of my head for determining A in this case, but the broad approach would be similar: define some objective on (A A' - Q) and then work out how to choose A to optimize that objective.

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Execution and computation properties (EV 6)

Postby EViews Chris » Mon Apr 26, 2010 11:24 am

Thought about this some more, and in case (2) if you say that A must be lower triangular and your goal is to choose the unconstrained elements of A to minimize the frobenius norm of (A A' - Q), then I believe the problem will also reduce to a set of sequential least squares problems.

nadja123
Posts: 72
Joined: Thu Aug 06, 2009 10:43 am

Re: Execution and computation properties (EV 6)

Postby nadja123 » Mon Apr 26, 2010 1:21 pm

Thanks QMS Chris,

I am going to think about your hints. Based on a published empirical paper (for which they used other software than EViews I suspect), the A matrix is full and not a triangle, but some positions are assumed known. So I fancy your remarks apply that this should be viewed as a system of equations to solve. I have to think about the criteria to optimize... In case I come up with a solution I will post it here around. A guy told me that e.g. for Mathematica this is a few-seconds problem, but I am not using it...

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Execution and computation properties (EV 6)

Postby EViews Chris » Mon Apr 26, 2010 3:03 pm

Just to be clear, no software is going to be able to solve your problem until you provide more details as to what you're trying to acheive.

The system

A B = C

with A, B and C square and B and C known is a set of n^2 equations in n^2 unknowns. Under certain conditions (eg. when B has full rank) you can choose A such that every elements of (A B - C) is zero.

If you start imposing restrictions on A, you now have n^2 equations in less than n^2 unknowns. No matter what choice you make for the remaining elements of A, you can't choose them such that every element of (A B - C) is zero.

In order for your problem to have an answer, you need to say how to compare different non-zero values of (A B - C). Until you specify this, you can't compare different possible solutions for A, so there is no 'right' answer.

It's up to you to decide this. EViews or Mathematica can't make this choice for you.

nadja123
Posts: 72
Joined: Thu Aug 06, 2009 10:43 am

Re: Execution and computation properties (EV 6)

Postby nadja123 » Wed Apr 28, 2010 2:39 pm

I need to say a sorry to QMS Chris & forum users for my questions under this post. In the meantime I fetched a guy with whom we are trying to figure out what precisely is happening in the paper. As QMS Chris rightly supposed, there are many more things involved in that problem. As soon we get that far, I will try to translate the problem in EViews programming language.
In the end, we may come up with a pretty nice example that involves a combination of short and long run restrictions in a structural VAR. In EV 6 combination of these patterns is not possible, I don't know how about in EV 7. Until then, thanks for your efforts, QMS Chris.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests