Hi everyone,
I would like you to help me find a way to generate a series subject to a restriction, let me tell you how's the situation:
I have an initial series called z, which is defined as the product of the percentage changes within a period (expressed in decimals) of two series, x and y. That is, z=(delta% x)*(delta% y). The syntax of my program in eviews 7 is as follows:
series z=(@pch(x))*(@pch(y)) 'This is the definition of my new series, which feeds on x and y percentage changes (expressed in decimals).
if z>0 then 'This is an evaluation for the i-th element of z, I am not sure if it is done this way (may be I am wrong).
genr w=1 'This is the generation of the series for true values in the if command.
else 'The else command, self-explanatory.
if z<0 then 'The second condition of the generation of w.
w=0 'This is the true value of the second if command, which actually works like a false value function.
else ' ...
endif
endif
series w 'I declared series w in orde to...
scalar tp=@sum(w)/@regobs '...get the summation of all w elements divided by the number of observations derived from the econometric regression
What I intended to do with these commands, was to generate a series (namely, w) that for the i-th element of the series z, the if command would evaluate the sign (+/-) of the product i-th element of z, and if it resulted positive sign, it would generate a series that would contain a 1 in the i-th element of z, otherwise (else) z would contain a 0 in the i-th element evaluated. For example, for my time series evaluated in t = 13, that would be evaluating the 13th product of the percentage change in x (namely, +0.1) and y (namely, +0.5), they could have been this way:
z13th = (0.1) * (0.5) = 0.05 POSITIVE,
hence, the 13th element of w would be 1. This results hold for two negative percentage changes, namely, d%x = -0.1 and d%y = -0.5, in the end, the product would resulted POSITIVE, and the 13th element of w would be 1.
In contrast, when the sign of the 13th percentage change on x is different from that of y, then the 13th element of w would amount 0, that implies that the product resulted NEGATIVE.
I hope you guys can help me with this problem, since I need to generate that kind of series in order to go on with my tasks.
Best regards!
Generating series subject to conditioning
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
bernardonamek
- Posts: 1
- Joined: Sun Jun 03, 2012 6:10 pm
Who is online
Users browsing this forum: No registered users and 2 guests
