/* lynch.sas */ title 'Hovland and Sears Lynching data'; data lynch; infile '/home/brunner0/441s20/Lynch.data.txt' firstobs=6; /* Skipping the header */ 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 = 'Negro 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; var year cotton1 -- olynch; proc reg plot=none; title2 'Naive regression'; model blynch = cotton1; proc reg plot=none; title2 'Naive regression, but request Durbin-Watson statistic'; model blynch = cotton1 cotton2 / dw; output out=lynch2 residual=e; proc sgplot; title2 'Residuals Against Time'; series X = year Y = e; proc autoreg; title2 'Durbin-Watson test with proc autoreg'; model blynch = cotton1 cotton2 / dwprob; proc autoreg; title2 'First-order autoregressive model with proc autoreg'; model blynch = cotton1 cotton2 / nlag=1 method=ml; both: test cotton1=cotton2=0; /* I don't think we need a higher order model, but let's try it and test. */ proc autoreg plot=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; title2 'First-order autoregressive model with just cotton1'; model blynch = cotton1 / nlag=1 method=ml;