1\name{Investment} 2\alias{Investment} 3\title{US Investment Data} 4\description{ 5US data for fitting an investment equation. 6} 7\usage{data(Investment)} 8\format{ 9An annual time series from 1963 to 1982 with 7 variables. 10 \describe{ 11 \item{GNP}{nominal gross national product (in billion USD),} 12 \item{Investment}{nominal gross private domestic investment (in billion USD),} 13 \item{Price}{price index, implicit price deflator for GNP,} 14 \item{Interest}{interest rate, average yearly discount rate 15 charged by the New York Federal Reserve Bank,} 16 \item{RealGNP}{real GNP (= GNP/Price),} 17 \item{RealInv}{real investment (= Investment/Price),} 18 \item{RealInt}{approximation to the real interest rate 19 (= Interest - 100 * diff(Price)/Price).} 20 } 21} 22 23\source{Table 15.1 in Greene (1993)} 24 25\references{ 26Greene W.H. (1993). \emph{Econometric Analysis}, 2nd edition. 27 Macmillan Publishing Company, New York. 28 29Executive Office of the President (1984). \emph{Economic Report of the 30 President}. US Government Printing Office, Washington, DC. 31} 32 33\examples{ 34## Willam H. Greene, Econometric Analysis, 2nd Ed. 35## Chapter 15 36## load data set, p. 411, Table 15.1 37data(Investment) 38 39## fit linear model, p. 412, Table 15.2 40fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment) 41summary(fm) 42 43## visualize residuals, p. 412, Figure 15.1 44plot(ts(residuals(fm), start = 1964), 45 type = "b", pch = 19, ylim = c(-35, 35), ylab = "Residuals") 46sigma <- sqrt(sum(residuals(fm)^2)/fm$df.residual) ## maybe used df = 26 instead of 16 ?? 47abline(h = c(-2, 0, 2) * sigma, lty = 2) 48 49if(require(lmtest)) { 50## Newey-West covariances, Example 15.3 51coeftest(fm, vcov = NeweyWest(fm, lag = 4)) 52## Note, that the following is equivalent: 53coeftest(fm, vcov = kernHAC(fm, kernel = "Bartlett", bw = 5, prewhite = FALSE, adjust = FALSE)) 54 55## Durbin-Watson test, p. 424, Example 15.4 56dwtest(fm) 57 58## Breusch-Godfrey test, p. 427, Example 15.6 59bgtest(fm, order = 4) 60} 61 62## visualize fitted series 63plot(Investment[, "RealInv"], type = "b", pch = 19, ylab = "Real investment") 64lines(ts(fitted(fm), start = 1964), col = 4) 65 66 67## 3-d visualization of fitted model 68if(require(scatterplot3d)) { 69s3d <- scatterplot3d(Investment[,c(5,7,6)], 70 type = "b", angle = 65, scale.y = 1, pch = 16) 71s3d$plane3d(fm, lty.box = "solid", col = 4) 72} 73} 74 75\keyword{datasets} 76