表5-3显示了1970-1994年25年间,日本工薪家庭实际消费支出Y与实际可支配收入X的变化。
(1)对下面的回归模型进行OLS检验,并计算t值和决定系数\(R^2\)。 \[Y_t = \beta_1+\beta_2X_t+\varepsilon_t\] (2)用(1)的估计结果,计算OLS的残差 ,并求杜宾-沃特森统计量DW。
(3)利用(2)的DW值,进行 ,显著性水平为5%的单侧检验。
##
## Call:
## lm(formula = y ~ x, data = dat1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.527 -2.615 -1.352 1.724 8.350
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 50.87454 8.29106 6.136 2.93e-06 ***
## x 0.63744 0.02124 30.008 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.509 on 23 degrees of freedom
## Multiple R-squared: 0.9751, Adjusted R-squared: 0.974
## F-statistic: 900.5 on 1 and 23 DF, p-value: < 2.2e-16
## % latex table generated in R 3.3.3 by xtable 1.8-2 package
## % Wed Jun 27 22:33:00 2018
## \begin{table}[ht]
## \centering
## \begin{tabular}{rrrrr}
## \hline
## & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\
## \hline
## (Intercept) & 50.8745 & 8.2911 & 6.14 & 0.0000 \\
## x & 0.6374 & 0.0212 & 30.01 & 0.0000 \\
## \hline
## \end{tabular}
## \end{table}
##
## Durbin-Watson test
##
## data: lm1
## DW = 0.35276, p-value = 4.517e-09
## alternative hypothesis: true autocorrelation is greater than 0
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.