Investment             package:sandwich             R Documentation

_U_S _I_n_v_e_s_t_m_e_n_t _D_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     US data for fitting an investment equation.

_U_s_a_g_e:

     data(Investment)

_F_o_r_m_a_t:

     An annual time series from 1963 to 1982 with 7 variables.

     _G_N_P nominal gross national product (in billion USD),

     _I_n_v_e_s_t_m_e_n_t nominal gross private domestic investment (in billion
          USD),

     _P_r_i_c_e price index, implicit price deflator for GNP,

     _I_n_t_e_r_e_s_t interest rate, average yearly discount rate charged by
          the New York Federal Reserve Bank,

     _R_e_a_l_G_N_P real GNP (= GNP/Price),

     _R_e_a_l_I_n_v real investment (= Investment/Price),

     _R_e_a_l_I_n_t approximation to the real interest rate (= Interest - 100
          * diff(Price)/Price).

_S_o_u_r_c_e:

     Table 15.1 in Greene (1993)

_R_e_f_e_r_e_n_c_e_s:

     Greene W.H. (1993), _Econometric Analysis_, 2nd edition. Macmillan
     Publishing Company, New York.

     Executive Office of the President (1984), _Economic Report of the
     President_. US Government Printing Office, Washington, DC.

_E_x_a_m_p_l_e_s:

     ## Willam H. Greene, Econometric Analysis, 2nd Ed.
     ## Chapter 15
     ## load data set, p. 411, Table 15.1
     data(Investment)

     ## fit linear model, p. 412, Table 15.2
     fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment)
     summary(fm)

     ## visualize residuals, p. 412, Figure 15.1
     plot(ts(residuals(fm), start = 1964),
       type = "b", pch = 19, ylim = c(-35, 35), ylab = "Residuals")
     sigma <- sqrt(sum(residuals(fm)^2)/fm$df.residual) ## maybe used df = 26 instead of 16 ??
     abline(h = c(-2, 0, 2) * sigma, lty = 2)

     if(require(lmtest)) {
     ## Newey-West covariances, Example 15.3
     coeftest(fm, vcov = NeweyWest(fm, lag = 4))
     ## Note, that the following is equivalent:
     coeftest(fm, vcov = kernHAC(fm, kernel = "Bartlett", bw = 5, prewhite = FALSE, adjust = FALSE))

     ## Durbin-Watson test, p. 424, Example 15.4
     dwtest(fm)

     ## Breusch-Godfrey test, p. 427, Example 15.6
     bgtest(fm, order = 4)
     }

     ## visualize fitted series
     plot(Investment[, "RealInv"], type = "b", pch = 19, ylab = "Real investment")
     lines(ts(fitted(fm), start = 1964), col = 4)

     ## 3-d visualization of fitted model
     if(require(scatterplot3d)) {
     s3d <- scatterplot3d(Investment[,c(5,7,6)],
       type = "b", angle = 65, scale.y = 1, pch = 16)
     s3d$plane3d(fm, lty.box = "solid", col = 4)
     }

