* * Example 8.1 from pp 343-345 * open data m-ibmspln.dat calendar(m) 1926 data(format=free,org=columns) 1926:1 1999:12 ibm sp500 * * Graph the time series * spgraph(vfields=2,footer="Figure 8.1. Time plots of monthly log returns") graph(header="(a) Log Monthly Returns, IBM") # ibm graph(header="(b) Log Monthly Returns, SP500") # sp500 spgraph(done) * * To use the lag series in a SCATTER, you need to create it as * a separate series. * set ibm_1 = ibm{1} set sp500_1 = sp500{1} * * Do a scatter plot matrix * spgraph(vfields=2,hfields=2,footer="Figure 8.2. Some scatterplots for monthly log returns of IBM and S&P 500") scatter(hlabel="SP500",vlabel="IBM") # sp500 ibm scatter(hlabel="IBM{1}",vlabel="SP500") # ibm_1 sp500 scatter(hlabel="SP500{1}",vlabel="IBM") # sp500_1 ibm scatter(hlabel="SP500{1}",vlabel="SP500") # sp500_1 sp500 spgraph(done) * * The "TABLE" instuction will do most of the summary statistics shown in table * 8.1. However, it doesn't include the higher moments (skewness and kurtosis). * Those can be computed with the STATISTICS instruction. STATISTICS with FRACTILES * also computes the maximum and minimum (as well as median and several other * standard fractiles). * report(action=define) report(atrow=1,atcol=1) "Ticker" "Mean" "Standard Error" "Skewness" "Excess Kurtosis" "Minimum" "Maximum" statistics(noprint,fractiles) ibm_1 report(atrow=2,atcol=1) "IBM" %mean sqrt(%variance) %skewness %kurtosis %minimum %maximum statistics(noprint,fractiles) sp500 report(atrow=3,atcol=1) "SP500" %mean sqrt(%variance) %skewness %kurtosis %minimum %maximum report(action=format,picture="*.###") report(action=show) * @MVIdent(lags=5) # ibm sp500 * * This does a slightly different graph format for the correlations. It creates * a 2x2 matrix of graphs with the autocorrelations on the main diagonals and the * cross correlations for non-negative and non-positive lags in separate graphs * in the two corners. * @crosscorr(number=12) ibm sp500 * * Multivariate Q-statistics (from page 348) * display display "MV Q Statistic on IBM and SP500" @mvqstat(lags=1) # ibm sp500 @mvqstat(lags=5) # ibm sp500 @mvqstat(lags=10) # ibm sp500