Investment(sandwich)
Investment()所属R语言包:sandwich
US Investment Data
美国投资数据
译者:生物统计家园网 机器人LoveR
描述----------Description----------
US data for fitting an investment equation.
美国投资方程拟合数据。
用法----------Usage----------
data(Investment)
格式----------Format----------
An annual time series from 1963 to 1982 with 7 variables.
1963年至1982年7变量的年度时间序列。
GNP nominal gross national product (in billion USD),
国民生产总值名义国民生产总值(亿美元),
Investment nominal gross private domestic investment (in billion USD),
投资名义国内私人投资总额(亿美元),
Price price index, implicit price deflator for GNP,
价格物价指数,国民生产总值的隐含平减物价指数,
Interest interest rate, average yearly discount rate
利息的利率,年平均折扣率
RealGNP real GNP (= GNP/Price),
RealGNP实际国民生产总值(GNP /价格),
RealInv real investment (= Investment/Price),
RealInv真正的投资(投资/价格),
RealInt approximation to the real interest rate
RealInt近似的实际利率
源----------Source----------
Table 15.1 in Greene (1993)
表15.1格林(1993)
参考文献----------References----------
Macmillan Publishing Company, New York.
President. US Government Printing Office, Washington, DC.
实例----------Examples----------
## Willam H. Greene, Econometric Analysis, 2nd Ed.[#威廉姆H.格林,计量分析,第二版。]
## Chapter 15[#第15章]
## load data set, p. 411, Table 15.1[#负载数据组检测号码。 411表15.1]
data(Investment)
## fit linear model, p. 412, Table 15.2[符合线性模型,P。 412表15.2]
fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment)
summary(fm)
## visualize residuals, p. 412, Figure 15.1[#可视化的残差,P。 412,图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 ??[#也许DF = 26,而不是16吗?]
abline(h = c(-2, 0, 2) * sigma, lty = 2)
if(require(lmtest)) {
## Newey-West covariances, Example 15.3[#纽维西协方差,例如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[#德宾 - 沃森检验,p。 424例15.4]
dwtest(fm)
## Breusch-Godfrey test, p. 427, Example 15.6[#Breusch-戈弗雷检验,p。 427例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[#3-D可视化拟合模型]
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)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|