Hello:
I've been replicating the time series examples from Stock and Watson's "Introduction to Econometrics textbook. In some case (as in this one) I have R code from a companion guide by Hanck et al.
My question is why do I get a (slightly) different result when I run the same data through EstimateProcess and LinearModelFit? [In my original full replication the difference occurs between TimeSeriesModelFit and LinearModelFit, but my understanding from the TimeSeriesProcess documentation is that TimeSeriesModelFit uses EstimateProcess, so I have gone directly to that function in the code snippet below.]
I've also replicated the examples in R, where the straight linear model approach and time series object approach yield identical answers -- though slightly different from the textbook's.
With Mathematica, the LinearModelFit answer (rounded) exactly matches the textbook. The EstimateProcess output, with a large (200+) sample is noticeably different, but the coefficients have the same p-values. Below, I use a small sample to highlight the difference.
I'm just curious whether the functions use different estimators/assumptions or whether I am unwittingly introducing the difference. Thanks!
(*10 obs of base quarterly series*)
basetestdata = {2845.453, 2873.169, 2843.718, 2770., 2788.278,
2852.741, 2919.47, 2973.782, 3046.096, 3040.235};
(*10 obs at Lag 1*)
lagtestdata = {2851.778, 2845.453, 2873.169, 2843.718, 2770.,
2788.278, 2852.741, 2919.47, 2973.782, 3046.096};
(*Calculate annualized percentage growth assuming quarterly data*)
tdgrowthpct = 400 Log[basetestdata/lagtestdata] (*10 obs*)
(*Method 1:Submit to Estimateprocess[]*)
tdgrowthpctEProc =
EstimatedProcess[tdgrowthpct,
ARProcess[1]] (*Lag will reduce to 9 obs*)
(*Output is:ARProcess[1.537332,{0.3994062},33.70502]*)
(*Method 2:form pairs and submit to LinearModelFit[] R*)
basetdgrowthpct = Take[tdgrowthpct, {2, 10}] (*Get down to 9 obs*)
lagtdgrowthpct = Take[tdgrowthpct, {1, 9}] (*Get down to 9 obs*)
data2 = MapThread[
List, {lagtdgrowthpct, basetdgrowthpct}] (*Create nine pairs*)
tdgrowthpctLM1 =
LinearModelFit[data2, x, x] // Normal (*Submit nine pairs*)
(*Output is 1.745164+0.408785 x*)