CCF and Q-stats
CCF and Q-stats
I am a new user trying to do a bivariate time series analysis, but my commands must be wrong because I keep getting an error message. I am trying to produce a cross-correlation function (with 5 lags) and Q-statistics for the residuals of two pre-whitened series. Any help would be greatly appreciated.
calendar 1960
allocate 2006:1
open data C:\Marie\Research\RAT_30 years later\DATA\RAT Data_nomiss.xls
data(format=xls, org=columns)
log actratio / lact
boxjenk(vcv, diffs=1, ma=2) lact / lactres
boxjenk(vcv, diffs=1, ma=1) robbery / robres
cross(qstats,corrs=rescorrs) robres lactres / 0 5
graph(style=bargraph,qstats, nodates,number=0,key=upright, $ header='cross-correlation - robres and lactres, $
hlabel='lag',max=1.0,min=-1.0) 1
# rescorrs
end
calendar 1960
allocate 2006:1
open data C:\Marie\Research\RAT_30 years later\DATA\RAT Data_nomiss.xls
data(format=xls, org=columns)
log actratio / lact
boxjenk(vcv, diffs=1, ma=2) lact / lactres
boxjenk(vcv, diffs=1, ma=1) robbery / robres
cross(qstats,corrs=rescorrs) robres lactres / 0 5
graph(style=bargraph,qstats, nodates,number=0,key=upright, $ header='cross-correlation - robres and lactres, $
hlabel='lag',max=1.0,min=-1.0) 1
# rescorrs
end
Re: CCF and Q-stats
The $'s on the GRAPH instruction are supposed to be at the end of a line to signal a continuation to the next. So you needMST wrote:I am a new user trying to do a bivariate time series analysis, but my commands must be wrong because I keep getting an error message. I am trying to produce a cross-correlation function (with 5 lags) and Q-statistics for the residuals of two pre-whitened series. Any help would be greatly appreciated.
Code: Select all
calendar 1960 allocate 2006:1 open data C:\Marie\Research\RAT_30 years later\DATA\RAT Data_nomiss.xls data(format=xls, org=columns) log actratio / lact boxjenk(vcv, diffs=1, ma=2) lact / lactres boxjenk(vcv, diffs=1, ma=1) robbery / robres cross(qstats,corrs=rescorrs) robres lactres / 0 5 graph(style=bargraph,qstats, nodates,number=0,key=upright, $ header='cross-correlation - robres and lactres, $ hlabel='lag',max=1.0,min=-1.0) 1 # rescorrs end
Code: Select all
graph(style=bargraph,qstats, nodates,number=0,key=upright, $
header='cross-correlation - robres and lactres', $
hlabel='lag',max=1.0,min=-1.0) 1Also, there's no need for the END at the end.
Re: CCF and Q-stats
Can someone please provide me with the code to get the standard errors of the cross correlation functions?
Thanks!
Thanks!
Re: CCF and Q-stats
MST wrote:Can someone please provide me with the code to get the standard errors of the cross correlation functions?
Thanks!
Code: Select all
open data gas-furnace.txt
data(format=free,org=columns) 1 296 input output
cross(from=-10,to=10,results=cross) input output
*
compute cxynobs=%nobs
corr(number=10,results=xcorrs) input
corr(number=10,results=ycorrs) output
sstats 1 10 %if(t==1,1.0,2.0)*xcorrs*ycorrs>>sumcxy
compute stderr=sqrt(sumcxy/cxynobs)Re: CCF and Q-stats
Tom,
Thanks for your response. I am trying to get the CCF for two prewhitened series, as well as the standard errors, so that I can determine if the cross correlations are statistically significant. Here is what I have:
calendar 1960
allocate 2006:1
open data C:\Marie\Research\RAT_30 years later\DATA\RAT Data_nomiss.xls
data(format=xls, org=columns)
log actratio / lact
boxjenk(vcv, diffs=1, ma=2) lact / lactres
boxjenk(vcv, diffs=1, ma=1) robbery / robres
cross(qstats,corrs=rescorrs) robres lactres / 0 6
graph(style=bargraph,nodates,number=0,key=upright, $
header='cross-correlation - robres and lactres', $
hlabel='lag',max=1.0,min=-1.0) 1
# rescorrs
compute cxynobs=%nobs
corr(number=10,results=xcorrs) lactres
corr(number=10,results=ycorrs) robres
sstats 1 10 %if(t==1,1.0,2.0)*xcorrs*ycorrs>>sumcxy
compute stderr=sqrt(sumcxy/cxynobs)
Here is the error I am getting:
## OP3. This Instruction Does Not Have An Option RES
>>>>(number=10,results=<<<<
I can't seem to figure out how to get this to run. Thank you so much for your help with this.
MST
Thanks for your response. I am trying to get the CCF for two prewhitened series, as well as the standard errors, so that I can determine if the cross correlations are statistically significant. Here is what I have:
calendar 1960
allocate 2006:1
open data C:\Marie\Research\RAT_30 years later\DATA\RAT Data_nomiss.xls
data(format=xls, org=columns)
log actratio / lact
boxjenk(vcv, diffs=1, ma=2) lact / lactres
boxjenk(vcv, diffs=1, ma=1) robbery / robres
cross(qstats,corrs=rescorrs) robres lactres / 0 6
graph(style=bargraph,nodates,number=0,key=upright, $
header='cross-correlation - robres and lactres', $
hlabel='lag',max=1.0,min=-1.0) 1
# rescorrs
compute cxynobs=%nobs
corr(number=10,results=xcorrs) lactres
corr(number=10,results=ycorrs) robres
sstats 1 10 %if(t==1,1.0,2.0)*xcorrs*ycorrs>>sumcxy
compute stderr=sqrt(sumcxy/cxynobs)
Here is the error I am getting:
## OP3. This Instruction Does Not Have An Option RES
>>>>(number=10,results=<<<<
I can't seem to figure out how to get this to run. Thank you so much for your help with this.
MST
Re: CCF and Q-stats
Change "results" to "corrs". We changed quite a few option names with version 7 to make instructions more standard, but the old syntax will work as well.MST wrote: Here is the error I am getting:
## OP3. This Instruction Does Not Have An Option RES
>>>>(number=10,results=<<<<
I can't seem to figure out how to get this to run. Thank you so much for your help with this.
MST