data julyco2; infile 'julyCO2.txt' firstobs=2; input year co2; year = year - 1970; year2 = year*year; /* regression with independent normal errors */ proc reg; model co2=year; /* linear */ model co2=year year2; title 'OLS estimation'; /* regression with autocorrelated errors */ /* linear with AR(1) doesn't work */ proc mixed; model co2 = year year2 /solution ddfm=kr; repeated / subject=intercept type =ar(1); title 'AR(1) model, REML, KR adjustment'; /* quadratic with ar(1) model */ run; proc mixed data=julyco2; model co2 = year year2 /solution; repeated / subject=intercept type =ar(1); title 'AR(1) model, REML, no adjustment to df'; /* quadratic with ar(1) model */ run; proc autoreg; model co2=year year2 /nlag=1 method=ml; title 'AR(1) using autoreg, ml'; run; proc mixed; model co2=year year2 / solution ddfm=kr; repeated / subject = intercept type = toep(3) rcorr; title 'Toeplitz with 2 non-zero correlations'; proc mixed; model co2=year year2 / solution ddfm=kr; repeated / subject = intercept type = toep(4) rcorr; title 'Toeplitz with 3 non-zero correlations'; proc autoreg; model co2 = year year2 /nlag=2 method=ml; title 'AR(2) using autoreg'; run; proc loess data= julyco2; model co2 = year / smooth=0.2 0.75 1 5 degree = 2 clm std; /* also iterations = 2 (or more, to robustify the fit */ title 'Loess smoothing'; ods output outputstatistics=preds; run; proc print data=preds(obs=5); run; proc loess data= julyco2; model co2 = year / degree = 1 select=gcv; run;