Dofor function for Q tests
-
lsal0106
Dofor function for Q tests
Hi everyone,
I was wondering if someone could assist me with the code to develop a dofor function in order to find the Q stats on the series in the file attached? I want to find the Q stats on each of the 19 series in the file, but I am lost as to how to do it. Apologies if this question seems ridiculously simple.
Thanks in advance.
I was wondering if someone could assist me with the code to develop a dofor function in order to find the Q stats on the series in the file attached? I want to find the Q stats on each of the 19 series in the file, but I am lost as to how to do it. Apologies if this question seems ridiculously simple.
Thanks in advance.
- Attachments
-
- ONEYR.xls
- (380 KiB) Downloaded 833 times
Re: Dofor function for Q tests
This would do it:
cal(d) 2007:12:14
data(format=xls,org=columns) 2007:12:14 2012:3:30 c1 c2 ... c17
dofor s = c1 to c17
corr(noprint,qstat,number=numberofcorrelations) s
disp %l(s) %qstat
end dofor s
cal(d) 2007:12:14
data(format=xls,org=columns) 2007:12:14 2012:3:30 c1 c2 ... c17
dofor s = c1 to c17
corr(noprint,qstat,number=numberofcorrelations) s
disp %l(s) %qstat
end dofor s
-
lsal0106
Re: Dofor function for Q tests
As we say in Australia, you are a legend mate! Thank You!
-
lsal0106
Re: Dofor function for Q tests
Also I was just wondering, is there a way of finding the second moment Q-stat also? Would I have to use two doloop functions in order to find this? I have the following code supplementary to the above at the moment
dofor s = C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19
set s2 = (s**2)
corr(noprint,qstat,number=20) s2
disp 'Second moment Q(20) = ' %l(s2) %qstat 'p-value = ' #.######### %signif
end dofor
But the output prints the following;
The Error Occurred At Location 325, Line 3 of loop/block
## REG7. Variance is Zero
## REG7. Variance is Zero
The Error Occurred At Location 325, Line 3 of loop/block
dofor s = C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19
set s2 = (s**2)
corr(noprint,qstat,number=20) s2
disp 'Second moment Q(20) = ' %l(s2) %qstat 'p-value = ' #.######### %signif
end dofor
But the output prints the following;
The Error Occurred At Location 325, Line 3 of loop/block
## REG7. Variance is Zero
## REG7. Variance is Zero
The Error Occurred At Location 325, Line 3 of loop/block
Re: Dofor function for Q tests
You need to dolsal0106 wrote:Also I was just wondering, is there a way of finding the second moment Q-stat also? Would I have to use two doloop functions in order to find this? I have the following code supplementary to the above at the moment
dofor s = C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19
set s2 = (s**2)
corr(noprint,qstat,number=20) s2
disp 'Second moment Q(20) = ' %l(s2) %qstat 'p-value = ' #.######### %signif
end dofor
But the output prints the following;
The Error Occurred At Location 325, Line 3 of loop/block
## REG7. Variance is Zero
## REG7. Variance is Zero
The Error Occurred At Location 325, Line 3 of loop/block
set s2 = s{0}**2
to get S treated as a reference to a series in the SET.