# Example 10.11, Effects of Antidumping Filings # Data set: barium # Function for result reporting source("_report.R") # Load the data and estimate the model in the background load("barium.Rdata") data=ts(data,start=c(1978,2),frequency=12) model=lm(lchnimp~lchempi+lgas+lrtwex+befile6+affile6+afdec6,data=data) model0=lm(lchnimp~lchempi+lgas+lrtwex+befile6+affile6+afdec6+feb+mar+apr+may+jun+jul+aug+sep+oct+nov+dec,data=data) dig=c(2,2,3,3,3,3,3,3) # Recap model { cat("This example closely follows Example 10.5. The estimation results in the previous example were") reportreg(model,dig,suffix=".hat",adj=T) } # Test for the significance of seasonality dummies Fstat=(summary(model0)$r.squared-summary(model)$r.squared)/(1-summary(model0)$r.squared)*(nrow(model0$model)-nrow(summary(model0)$coef))/11 p=pf(Fstat,11,nrow(model0$model)-nrow(summary(model0)$coef),lower.tail=F) cat("To make sure that our conclusion is not affected by seasonality, we add 11 monthly dummy variables (feb through dec) to the regression. Testing for their joint significance gives a p-value of ", round(p,2), ", so the seasonal dummies are jointly insignificant, and the conclusion essentially stays the same", sep="")