moneydemand.RdMoney Demand Data.
data(moneydemand)A multivariate yearly time series from 1879 to 1974 with variables
logarithm of quantity of money,
logarithm of real permanent income,
short term interest rate,
rate of return on money,
not documented in the sources,
logarithm of an operational measure of the variability of the rate of price changes.
The data was originally studied by Allen (1982), the data set is given in Krämer and Sonnberger (1986). Below we replicate a few examples from the book. Some of these results differ more or less seriously and are sometimes parameterized differently.
S.D. Allen (1982), Klein's Price Variability Terms in the U.S. Demand for Money. Journal of Money, Credit and Banking 14, 525–530
W. Krämer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica
data(moneydemand)
moneydemand <- window(moneydemand, start=1880, end=1972)
## page 125, fit Allen OLS model (and Durbin-Watson test),
## last line in Table 6.1
modelAllen <- logM ~ logYp + Rs + Rl + logSpp
lm(modelAllen, data = moneydemand)
#>
#> Call:
#> lm(formula = modelAllen, data = moneydemand)
#>
#> Coefficients:
#> (Intercept) logYp Rs Rl logSpp
#> -15.48806 1.61700 -0.01885 -0.08354 0.08421
#>
dwtest(modelAllen, data = moneydemand)
#>
#> Durbin-Watson test
#>
#> data: modelAllen
#> DW = 0.18142, p-value < 2.2e-16
#> alternative hypothesis: true autocorrelation is greater than 0
#>
## page 127, fit test statistics in Table 6.1 c)
################################################
## Breusch-Pagan
bptest(modelAllen, studentize = FALSE, data = moneydemand)
#>
#> Breusch-Pagan test
#>
#> data: modelAllen
#> BP = 13.342, df = 4, p-value = 0.009719
#>
bptest(modelAllen, studentize = TRUE, data = moneydemand)
#>
#> studentized Breusch-Pagan test
#>
#> data: modelAllen
#> BP = 17.069, df = 4, p-value = 0.001874
#>
## RESET
reset(modelAllen, data = moneydemand)
#>
#> RESET test
#>
#> data: modelAllen
#> RESET = 92.749, df1 = 2, df2 = 86, p-value < 2.2e-16
#>
reset(modelAllen, power = 2, type = "regressor", data = moneydemand)
#>
#> RESET test
#>
#> data: modelAllen
#> RESET = 68.197, df1 = 4, df2 = 84, p-value < 2.2e-16
#>
reset(modelAllen, type = "princomp", data = moneydemand)
#>
#> RESET test
#>
#> data: modelAllen
#> RESET = 1.7024, df1 = 2, df2 = 86, p-value = 0.1883
#>
## Harvey-Collier tests (up to sign of the test statistic)
harvtest(modelAllen, order.by = ~logYp, data = moneydemand)
#>
#> Harvey-Collier test
#>
#> data: modelAllen
#> HC = 5.5579, df = 87, p-value = 2.943e-07
#>
harvtest(modelAllen, order.by = ~Rs, data = moneydemand)
#>
#> Harvey-Collier test
#>
#> data: modelAllen
#> HC = 1.4391, df = 87, p-value = 0.1537
#>
harvtest(modelAllen, order.by = ~Rl, data = moneydemand)
#>
#> Harvey-Collier test
#>
#> data: modelAllen
#> HC = 0.62177, df = 87, p-value = 0.5357
#>
harvtest(modelAllen, order.by = ~logSpp, data = moneydemand)
#>
#> Harvey-Collier test
#>
#> data: modelAllen
#> HC = 0.79431, df = 87, p-value = 0.4292
#>
## Rainbow test
raintest(modelAllen, order.by = "mahalanobis", data = moneydemand)
#>
#> Rainbow test
#>
#> data: modelAllen
#> Rain = 1.1387, df1 = 47, df2 = 41, p-value = 0.3374
#>
if(require(strucchange, quietly = TRUE)) {
## Chow (1913)
sctest(modelAllen, point=c(1913,1), data = moneydemand, type = "Chow") }
#>
#> Chow test
#>
#> data: modelAllen
#> F = 58.314, p-value < 2.2e-16
#>
if(require(strucchange, quietly = TRUE)) {
## Fluctuation
sctest(modelAllen, type = "fluctuation", rescale = FALSE, data = moneydemand)}
#>
#> RE test (recursive estimates test)
#>
#> data: modelAllen
#> RE = 9.5229, p-value < 2.2e-16
#>