Help in changing my codes from series to matrix
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Re: Help in changing my codes from series to matrix
Hi Matt,
I think that the code is working only for generating the signal but not for keeping them until the exit.
As you can see, I keep the position until -0.5 >zsc < 0.5
Here !a_100 = 1.50 and s0 = 0.50
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) < 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j-1)
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) >= 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = 0
For example, I'm expecting the following signal
Date zsc_rel_cad_mod10_cn Signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
From the code, the trade is being exit
Date zsc_rel_cad_mod10_cn Signal
5/03/1974 -1.567330541 0.5
5/10/1974 -1.433595135 0
5/17/1974 -0.7890138 0
5/24/1974 -0.951573176 0
5/31/1974 -0.477163705 0
Can you please help me out to change the code in order to exit at 0.5.
Thanks
I think that the code is working only for generating the signal but not for keeping them until the exit.
As you can see, I keep the position until -0.5 >zsc < 0.5
Here !a_100 = 1.50 and s0 = 0.50
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) < 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j-1)
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) >= 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = 0
For example, I'm expecting the following signal
Date zsc_rel_cad_mod10_cn Signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
From the code, the trade is being exit
Date zsc_rel_cad_mod10_cn Signal
5/03/1974 -1.567330541 0.5
5/10/1974 -1.433595135 0
5/17/1974 -0.7890138 0
5/24/1974 -0.951573176 0
5/31/1974 -0.477163705 0
Can you please help me out to change the code in order to exit at 0.5.
Thanks
Re: Help in changing my codes from series to matrix
Hi Matt,
I think that the code is generating only the entry signal , however it's not keeping it until the exit rules.
I'm expecting the follwing signals.
Date zsc signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
As you can see, I keep the trade until casenum 9 is met.
Here !a_100 = 1.5 and s0 = 0.5
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) < 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j-1)
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) >= 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = 0
For the time being, the follwing signal is being generated.
Date zsc_rel_cad_mod10_cn Signal
5/03/1974 -1.567330541 0.5
5/10/1974 -1.433595135 0
5/17/1974 -0.7890138 0
5/24/1974 -0.951573176 0
5/31/1974 -0.477163705 0
Can you please help me out to complete the code.
Thanks
I think that the code is generating only the entry signal , however it's not keeping it until the exit rules.
I'm expecting the follwing signals.
Date zsc signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
As you can see, I keep the trade until casenum 9 is met.
Here !a_100 = 1.5 and s0 = 0.5
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) < 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j-1)
else if (zsc_{%c}_{%u}_{%x}_{%i}(!j) < !a_100 and zsc_{%c}_{%u}_{%x}_{%i}(!j) >= s0 and signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j - 1) >= 0) then signal_{%a}_{%c}_{%u}_{%x}_{%i}(!j) = 0
For the time being, the follwing signal is being generated.
Date zsc_rel_cad_mod10_cn Signal
5/03/1974 -1.567330541 0.5
5/10/1974 -1.433595135 0
5/17/1974 -0.7890138 0
5/24/1974 -0.951573176 0
5/31/1974 -0.477163705 0
Can you please help me out to complete the code.
Thanks
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
mtos(tmp,tmp2, all) copys the 17 values (14 non-NA values) from vector tmp to series tmp2. The use of the third argument specifying a sample is to ensure that those 17 values are copied to observations 1 through 17 regardless of the current workfile sample. That last point is important for creating the threshold series.
The genr threshold line fills in the threshold series with values from the tmp2 series. However, it's doing so in an unusual way. The idea is to take a case number (1-17) and look up the corresponding threshold value stored in tmp2 (in observations 1-17). This is where the semantic difference between genr and non-genr expressions becomes important. If I were to write,
That's a non-genr expression (doesn't create or "fill-in" a series), and in that context threshold(4) refers to the observation 4 of the threshold series. However, if I were to write,
That's a genr expression, and in that context series x would copy the data in series threshold but shifted upwards by 4 observations. The point is that in a genr expression the () syntax specifies an observation shift (a lag or lead), not an absolute observation. However, we can calculate the shift necessary to access a specific observation just by subtracting off @obsid. That's how the genr threshold line is able to copy values from the only first 17 observations of tmp2. In effect, it lets us use the series tmp2 like a lookup table.
The genr threshold line fills in the threshold series with values from the tmp2 series. However, it's doing so in an unusual way. The idea is to take a case number (1-17) and look up the corresponding threshold value stored in tmp2 (in observations 1-17). This is where the semantic difference between genr and non-genr expressions becomes important. If I were to write,
Code: Select all
scalar x = threshold(4)
That's a non-genr expression (doesn't create or "fill-in" a series), and in that context threshold(4) refers to the observation 4 of the threshold series. However, if I were to write,
Code: Select all
series x = threshold(4)
That's a genr expression, and in that context series x would copy the data in series threshold but shifted upwards by 4 observations. The point is that in a genr expression the () syntax specifies an observation shift (a lag or lead), not an absolute observation. However, we can calculate the shift necessary to access a specific observation just by subtracting off @obsid. That's how the genr threshold line is able to copy values from the only first 17 observations of tmp2. In effect, it lets us use the series tmp2 like a lookup table.
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
The @recode(@recode(casenum < 9, {%sig} < threshold, {%sig} > threshold) , {%sig}(-1), threshold) selects how to compare the signal value against the threshold (the inner @recode). In the low numbered cases you check that the signal is below the threshold, while in the high numbered cases you check that the signal is above the threshold. If that condition is true, then you copy the previous value of the signal, otherwise you set the signal to the threshold value (the outer @recode).
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
Have the values separating the cases changed since your initial posting? For the following dates and zsc values I'd expect the cases to be:
5/03/1974 -1.567330541 Case 15
5/10/1974 -1.433595135 Case 14
5/17/1974 -0.7890138 Case 10
5/24/1974 -0.951573176 Case 10
5/31/1974 -0.477163705 Case 9
5/03/1974 -1.567330541 Case 15
5/10/1974 -1.433595135 Case 14
5/17/1974 -0.7890138 Case 10
5/24/1974 -0.951573176 Case 10
5/31/1974 -0.477163705 Case 9
Re: Help in changing my codes from series to matrix
Hi Matt,
The values did not changes, however !a_xxx are variables and therefore they can change values.
My original code are enclosed which I would like to change.
As you can see in my orignal code, there is a entry and an exit rule.
How I can change the code in order to have the following signals.
Date zsc signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
The new version of the codes.
'delete signal_time
tic
string scenario = "B50"
string clist = "rel"
%curlist = "CAD"
string list_eq = "MOD10"
string certain = "CN"
for %a {scenario}
for %c {clist}
for %u {curlist}
for %x {list_eq}
for %i {certain}
scalar s0
Scalar a_100
Scalar a_125
Scalar a_130
Scalar a_140
Scalar a_150
Scalar a_175
Scalar a_200
IF %a ="BB00" or %a ="CC00" or %a ="DD00" or %a ="EE00" or %a ="FF00" or %a ="B00" THEN s0 = 0
else if %a ="BB25" or %a ="CC25" or %a ="DD25" or %a ="EE25" or %a ="FF25" or %a ="B25" THEN s0 = 0.25
else if %a ="BB50" or %a ="CC50" or %a ="DD50" or %a ="EE50" or %a ="FF50" or %a ="B50" THEN s0= 0.50
else if %a ="BB75" or %a ="CC75" or %a ="DD75" or %a ="EE75" or %a ="FF75" or %a ="B75" THEN s0 = 0.75
else if %a ="BB_75" or %a ="CC_75" or %a ="DD_75" or %a ="EE_75" or %a ="FF_75" THEN s0 = -0.75
else if %a ="BB_50" or %a ="CC_50" or %a ="DD_50" or %a ="EE_50" or %a ="FF_50" THEN s0= -0.50
else if %a ="BB_25" or %a ="CC_25" or %a ="DD_25" or %a ="EE_25" or %a ="FF_25" THEN s0 = -0.25
else if %a ="L00" or %a ="NN00" or %a ="PP00" or %a ="QQ00" or %a ="RR00" or %a ="SS00" THEN s0 = 0
else if %a ="L25" or %a ="NN25" or %a ="PP25" or %a ="QQ25" or %a ="RR25" or %a ="SS25" THEN s0 = 0.025
else if %a ="L50" or %a ="NN50" or %a ="PP50" or %a ="QQ50" or %a ="RR50" or %a ="SS50" THEN s0 = 0.05
else if %a ="L75" or %a ="NN75" or %a ="PP75" or %a ="QQ75" or %a ="RR75" or %a ="SS75" THEN s0 = 0.075
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
if %a ="B00" or %a ="B25" or %a ="B50" or %a ="B75" THEN a_100 = 1.50
a_125 =1.50
a_130 =1.50
a_140 =1.50
a_150 =1.50
a_175 =2.00
a_200 =2.00
else if %a ="C00" or %a ="C25" or %a ="C50" or %a ="C75" THEN a_100 = 1.25
a_125 =1.25
a_130 =2.00
a_140 =2.00
a_150 =2.00
a_175 =2.00
a_200 =2.00
endif
endif
Scalar e_200
Scalar e_175
Scalar e_150
Scalar e_140
Scalar e_130
Scalar e_125
Scalar e_100
if %a ="B00" or %a ="B25" or %a ="B50" or %a ="B75" THEN e_200 =1
e_175 =1
e_150 =0.50
e_140 =0.50
e_130=0.50
e_125 =0.50
e_100 =0.50
else if %a ="C00" or %a ="C25" or %a ="C50" or %a ="C75" THEN e_200 =1
e_175 =1
e_150 =1
e_140 =1
e_130=1
e_125 =0.50
e_100 =0.50
endif
endif
!a_0 = 0
!a_25 = 0.25
!a_50 = 0.5
!a_75 = 0.75
!a_100 = a_100
!a_125 = a_125
!a_130 = a_130
!a_140 = a_140
!a_150 = a_150
!a_175 = a_175
!a_200 = a_200
!e_100 =e_200
!e_75 =e_175
!e_50 = e_150
!e_40 = e_140
!e_30 = e_130
!e_25 =e_125
!e_00 =e_100
delete tmp
delete tmp2
delete casenum
delete threshold
vector(17) tmp
tmp.fill NA, -!e_75, -!e_50, -!e_40, -!e_30, -!e_25, -!e_00, 0, NA, 0, !e_00, !e_25, !e_30, !e_40, !e_50, !e_75, NA
smpl all @all
mtos(tmp, tmp2,all)
%zsc = "zsc_" + %c + "_" + %u + "_" + %x + "_" + %i 'Create a shorter name for the series
genr casenum= @recode({%zsc} >= !a_200, 1,@recode({%zsc} >= !a_175 , 2,@recode({%zsc} >= !a_150, 3,@recode({%zsc} >= !a_140, 4,@recode({%zsc} >= !a_130, 5,@recode({%zsc} >= !a_125, 6,@recode({%zsc} >= !a_100, 7,@recode({%zsc} >= s0 , 8,@recode({%zsc} <= -!a_200, 17,@recode({%zsc} <= -!a_175, 16,@recode({%zsc} <= -!a_150, 15,@recode({%zsc} <= -!a_140, 14,@recode({%zsc} <= -!a_130, 13,@recode({%zsc} <= -!a_125, 12,@recode({%zsc} <= -!a_100, 11,@recode({%zsc} <= -s0 , 10,@recode({%zsc} > -s0 and {%zsc} < s0 , 9,0)))))))))))))))))
genr threshold = tmp2(casenum- @obsid)
series signal_{%a}_{%c}_{%u}_{%x}_{%i} = 0
%sig = "signal_" + %a + "_" + %c + "_" + %u + "_" + %x + "_" + %i ' Shorter name for signal
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100, @recode(@recode(casenum < 9, {%sig} < threshold, {%sig} > threshold) , {%sig}(-1), threshold))))
next
next
next
next
next
scalar signal_time = @toc
The values did not changes, however !a_xxx are variables and therefore they can change values.
My original code are enclosed which I would like to change.
As you can see in my orignal code, there is a entry and an exit rule.
How I can change the code in order to have the following signals.
Date zsc signal Comments
5/03/1974 -1.567330541 0.5 Entry per casenum 15
5/10/1974 -1.433595135 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/17/1974 -0.7890138 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/24/1974 -0.951573176 0.5 Check casenum 9 and check sig(-1), already in a position, stay in that position
5/31/1974 -0.477163705 0 Per casenum 9 exit the trade
The new version of the codes.
'delete signal_time
tic
string scenario = "B50"
string clist = "rel"
%curlist = "CAD"
string list_eq = "MOD10"
string certain = "CN"
for %a {scenario}
for %c {clist}
for %u {curlist}
for %x {list_eq}
for %i {certain}
scalar s0
Scalar a_100
Scalar a_125
Scalar a_130
Scalar a_140
Scalar a_150
Scalar a_175
Scalar a_200
IF %a ="BB00" or %a ="CC00" or %a ="DD00" or %a ="EE00" or %a ="FF00" or %a ="B00" THEN s0 = 0
else if %a ="BB25" or %a ="CC25" or %a ="DD25" or %a ="EE25" or %a ="FF25" or %a ="B25" THEN s0 = 0.25
else if %a ="BB50" or %a ="CC50" or %a ="DD50" or %a ="EE50" or %a ="FF50" or %a ="B50" THEN s0= 0.50
else if %a ="BB75" or %a ="CC75" or %a ="DD75" or %a ="EE75" or %a ="FF75" or %a ="B75" THEN s0 = 0.75
else if %a ="BB_75" or %a ="CC_75" or %a ="DD_75" or %a ="EE_75" or %a ="FF_75" THEN s0 = -0.75
else if %a ="BB_50" or %a ="CC_50" or %a ="DD_50" or %a ="EE_50" or %a ="FF_50" THEN s0= -0.50
else if %a ="BB_25" or %a ="CC_25" or %a ="DD_25" or %a ="EE_25" or %a ="FF_25" THEN s0 = -0.25
else if %a ="L00" or %a ="NN00" or %a ="PP00" or %a ="QQ00" or %a ="RR00" or %a ="SS00" THEN s0 = 0
else if %a ="L25" or %a ="NN25" or %a ="PP25" or %a ="QQ25" or %a ="RR25" or %a ="SS25" THEN s0 = 0.025
else if %a ="L50" or %a ="NN50" or %a ="PP50" or %a ="QQ50" or %a ="RR50" or %a ="SS50" THEN s0 = 0.05
else if %a ="L75" or %a ="NN75" or %a ="PP75" or %a ="QQ75" or %a ="RR75" or %a ="SS75" THEN s0 = 0.075
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
if %a ="B00" or %a ="B25" or %a ="B50" or %a ="B75" THEN a_100 = 1.50
a_125 =1.50
a_130 =1.50
a_140 =1.50
a_150 =1.50
a_175 =2.00
a_200 =2.00
else if %a ="C00" or %a ="C25" or %a ="C50" or %a ="C75" THEN a_100 = 1.25
a_125 =1.25
a_130 =2.00
a_140 =2.00
a_150 =2.00
a_175 =2.00
a_200 =2.00
endif
endif
Scalar e_200
Scalar e_175
Scalar e_150
Scalar e_140
Scalar e_130
Scalar e_125
Scalar e_100
if %a ="B00" or %a ="B25" or %a ="B50" or %a ="B75" THEN e_200 =1
e_175 =1
e_150 =0.50
e_140 =0.50
e_130=0.50
e_125 =0.50
e_100 =0.50
else if %a ="C00" or %a ="C25" or %a ="C50" or %a ="C75" THEN e_200 =1
e_175 =1
e_150 =1
e_140 =1
e_130=1
e_125 =0.50
e_100 =0.50
endif
endif
!a_0 = 0
!a_25 = 0.25
!a_50 = 0.5
!a_75 = 0.75
!a_100 = a_100
!a_125 = a_125
!a_130 = a_130
!a_140 = a_140
!a_150 = a_150
!a_175 = a_175
!a_200 = a_200
!e_100 =e_200
!e_75 =e_175
!e_50 = e_150
!e_40 = e_140
!e_30 = e_130
!e_25 =e_125
!e_00 =e_100
delete tmp
delete tmp2
delete casenum
delete threshold
vector(17) tmp
tmp.fill NA, -!e_75, -!e_50, -!e_40, -!e_30, -!e_25, -!e_00, 0, NA, 0, !e_00, !e_25, !e_30, !e_40, !e_50, !e_75, NA
smpl all @all
mtos(tmp, tmp2,all)
%zsc = "zsc_" + %c + "_" + %u + "_" + %x + "_" + %i 'Create a shorter name for the series
genr casenum= @recode({%zsc} >= !a_200, 1,@recode({%zsc} >= !a_175 , 2,@recode({%zsc} >= !a_150, 3,@recode({%zsc} >= !a_140, 4,@recode({%zsc} >= !a_130, 5,@recode({%zsc} >= !a_125, 6,@recode({%zsc} >= !a_100, 7,@recode({%zsc} >= s0 , 8,@recode({%zsc} <= -!a_200, 17,@recode({%zsc} <= -!a_175, 16,@recode({%zsc} <= -!a_150, 15,@recode({%zsc} <= -!a_140, 14,@recode({%zsc} <= -!a_130, 13,@recode({%zsc} <= -!a_125, 12,@recode({%zsc} <= -!a_100, 11,@recode({%zsc} <= -s0 , 10,@recode({%zsc} > -s0 and {%zsc} < s0 , 9,0)))))))))))))))))
genr threshold = tmp2(casenum- @obsid)
series signal_{%a}_{%c}_{%u}_{%x}_{%i} = 0
%sig = "signal_" + %a + "_" + %c + "_" + %u + "_" + %x + "_" + %i ' Shorter name for signal
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100, @recode(@recode(casenum < 9, {%sig} < threshold, {%sig} > threshold) , {%sig}(-1), threshold))))
next
next
next
next
next
scalar signal_time = @toc
- Attachments
-
- signal.prg
- (11.64 KiB) Downloaded 246 times
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
Changes to those values should be fine so long as they remain logically consistent. For the example data you've shown, what are the case numbers the program now generates?
Re: Help in changing my codes from series to matrix
Hi Matt,
I have enclosed the case numbers of the program and the expected signal.
Once again, thanks for your help.
Sudesh
I have enclosed the case numbers of the program and the expected signal.
Once again, thanks for your help.
Sudesh
- Attachments
-
- Expected Signal vs Genr Signal.xlsx
- (186.21 KiB) Downloaded 243 times
Re: Help in changing my codes from series to matrix
Hi Matt,
Can you help me out to finish the code.
I need to delivery them today.
Thanks for your help.
Sudesh
Can you help me out to finish the code.
I need to delivery them today.
Thanks for your help.
Sudesh
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
For the B50 scenario, it looks like the correct case numbers and thresholds are being calculated. Are you sure the !a*, !e*, and s0 variables are set to produce the behavior you want?
Re: Help in changing my codes from series to matrix
HI Matt,
I'm able to generate 80% of the expected signal, however there is two conditions that I can't figure out why the signal are not correct.
when casenum = 3 & casenum(-1) = 1 and casenum =8 and casenum(-1)=3
It will be greatly appreciated if you could help me. I have attached the expected signal and the signal generated by this code.
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100, @recode(casenum > 9 ,@recode(casenum(-1) >=@recode(casenum = 9, casenum = 9, casenum = 9) and {%sig}(-1) <>0, {%sig}(-1) ,threshold),@recode(casenum(-1) <= @recode(casenum = 9, casenum = 9, casenum = 9) and {%sig}(-1) <>0, {%sig}(-1) ,threshold)))))
Thanks.
I'm able to generate 80% of the expected signal, however there is two conditions that I can't figure out why the signal are not correct.
when casenum = 3 & casenum(-1) = 1 and casenum =8 and casenum(-1)=3
It will be greatly appreciated if you could help me. I have attached the expected signal and the signal generated by this code.
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100, @recode(casenum > 9 ,@recode(casenum(-1) >=@recode(casenum = 9, casenum = 9, casenum = 9) and {%sig}(-1) <>0, {%sig}(-1) ,threshold),@recode(casenum(-1) <= @recode(casenum = 9, casenum = 9, casenum = 9) and {%sig}(-1) <>0, {%sig}(-1) ,threshold)))))
Thanks.
- Attachments
-
- Expected Signal vs Genr Signal for B50.xlsx
- (131.95 KiB) Downloaded 244 times
Re: Help in changing my codes from series to matrix
Hi Matt,
Final step and it's working...
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100,@recode(casenum <9,@recode({%sig}(-1) <0,{%sig}(-1) ,threshold) ,@recode({%sig}(-1) >0,{%sig}(-1) ,threshold)))))
Thanks you very much, you are a life saver....
It's has reduced the time of processing time by at least 35 times
Thanks to you, I will be able to deliver my projet on Monday.
Ciao Sudesh
Final step and it's working...
{%sig} = @recode(casenum = 1, -!e_100, @recode(casenum = 9, 0, @recode(casenum= 17, !e_100,@recode(casenum <9,@recode({%sig}(-1) <0,{%sig}(-1) ,threshold) ,@recode({%sig}(-1) >0,{%sig}(-1) ,threshold)))))
Thanks you very much, you are a life saver....
It's has reduced the time of processing time by at least 35 times
Thanks to you, I will be able to deliver my projet on Monday.
Ciao Sudesh
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Help in changing my codes from series to matrix
You can send beer money coupons to support@eviews.com.
Follow us on Twitter @IHSEViews
Re: Help in changing my codes from series to matrix
For sure, give me the address and I will send the coupons
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Help in changing my codes from series to matrix
I'm glad you got it working; 35x speedup is better than I expected. Sorry I wasn't able to respond more promptly these last couple of days.
Who is online
Users browsing this forum: No registered users and 61 guests