/* lynch.sas */ title 'Hovland and Sears Lynching data'; data lynch; /* Skipping the header */ infile '/home/u1407221/441s24/data/Lynch.data.txt' firstobs=6; input year ayres cotton1 cotton2 Blynch Totlynch; label ayres = 'Ayres'' composite economic index' cotton1 = 'Per-acre value of cotton' cotton2 = 'Farm value of cotton' blynch = 'Black lynchings' totlynch = 'Total lynchings'; olynch = totlynch-blynch; label olynch = 'Non-Black lynchings'; /* Created differenced variables */ dc1 = cotton1 - lag(cotton1); dc2 = cotton2 - lag(cotton2); dbl = blynch - lag(blynch); proc corr data=lynch; var year cotton1 -- olynch; proc reg data=lynch plots=none; title2 'Naive regression'; model blynch = cotton1; proc reg data=lynch plots=none; title2 'Naive regression, but request Durbin-Watson statistic'; model blynch = cotton1 cotton2 / dwprob; output out=lynch2 residual=e; proc sgplot data=lynch2; title2 'Residuals Against Time'; series X = year Y = e; proc autoreg data=lynch; title2 'Naive model with TS plots using proc autoreg'; model blynch = cotton1 cotton2 / dwprob; proc autoreg data=lynch; title2 'First-order autoregressive model with proc autoreg'; model blynch = cotton1 cotton2 / nlag=1 method=ml dwprob; both: test cotton1=cotton2=0; /* The signs of the estimated autoregressive parameters are reversed! Page 357 of the proc autoreg manual says "Note that in this parameterization, the signs of the autoregressive parameters are reversed from the parameterization documented in most of the literature." White noise probabilities are something like p-values. */ /* I don't think we need a higher order model, but let's try it and test. */ proc autoreg data=lynch plots=none; title2 'Sixth-order autoregressive model with cotton1 and cotton2'; model blynch = cotton1 cotton2 / nlag=6 method=ml; both: test cotton1=cotton2=0; proc autoreg data=lynch plots=none; title2 'First-order autoregressive model with just cotton1'; model blynch = cotton1 / nlag=1 method=ml; run; quit;