Question 7.
. import excel "H:\sem 8\economertics\data sets\[Link]", sheet("Sheet1")
firstrow
. describe
Contains data
obs: 30
vars: 4
size: 750
-----------------------------------------------------------------------------------
---------------------
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------
---------------------
obs byte %10.0g obs
I double %10.0g I
R double %10.0g R
Y double %10.0g Y
-----------------------------------------------------------------------------------
---------------------
Sorted by:
Note: dataset has changed since last saved
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
obs | 30 15.5 8.803408 1 30
I | 30 20.222 7.495569 9.32 32.51
R | 30 14.04667 4.903406 5.47 21.68
Y | 30 21.54067 8.634391 8.34 35.59
. regress I R Y
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 2, 27) = 59.98
Model | 1329.98704 2 664.993518 Prob > F = 0.0000
Residual | 299.335844 27 11.0865127 R-squared = 0.8163
-------------+------------------------------ Adj R-squared = 0.8027
Total | 1629.32288 29 56.1835476 Root MSE = 3.3296
------------------------------------------------------------------------------
I | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
R | -.1841962 .1264157 -1.46 0.157 -.4435798 .0751874
Y | .7699114 .0717905 10.72 0.000 .6226094 .9172134
_cons | 6.224938 2.510894 2.48 0.020 1.073009 11.37687
------------------------------------------------------------------------------
The model fits well: R-squared = 0.8163, meaning 82% of changes in Investment can
be explained by Income and Interest rate.
Income has a strong positive effect (coefficient = 0.77, p = 0.000) → when income
goes up, investment goes up.
Interest rate has a small negative effect (coefficient = -0.18, p = 0.157) → not
statistically significant.
. gen time=_n
. tsset time
time variable: time, 1 to 30
delta: 1 unit
. dwstat
Durbin-Watson d-statistic( 3, 30) = .852153
The Durbin-Watson statistic is 0.85, which is far below 2 → this means strong
positive autocorrelation in the errors (bad for a regression model).
Question 7.2
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
obs | 31 1975 9.092121 1960 1990
F | 31 109.529 5.352519 99.4 118
P | 31 104.7903 4.723301 94.8 116.4
Q | 30 34.22 3.647238 27.6 40.4
R | 31 103.571 50.18861 20.6 198.2
. tsset obs
time variable: obs, 1960 to 1990
delta: 1 unit
. regress Q F P R
Source | SS df MS Number of obs = 30
-------------+------------------------------ F( 3, 26) = 20.77
Model | 272.177333 3 90.7257777 Prob > F = 0.0000
Residual | 113.590667 26 4.36887181 R-squared = 0.7055
-------------+------------------------------ Adj R-squared = 0.6716
Total | 385.768 29 13.3023448 Root MSE = 2.0902
------------------------------------------------------------------------------
Q | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
F | .0615832 .0809901 0.76 0.454 -.1048944 .2280608
P | .3162285 .0876154 3.61 0.001 .1361326 .4963245
R | .0581384 .0080687 7.21 0.000 .041553 .0747239
_cons | -11.59809 14.96435 -0.78 0.445 -42.35776 19.16157
------------------------------------------------------------------------------
. estat hettest
Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
Ho: Constant variance
Variables: fitted values of Q
chi2(1) = 2.55
Prob > chi2 = 0.1101
. vif
Variable | VIF 1/VIF
-------------+----------------------
F | 1.15 0.869906
P | 1.13 0.881581
R | 1.03 0.974687
-------------+----------------------
Mean VIF | 1.10
gen time=_n
. tsset time
time variable: time, 1 to 31
delta: 1 unit
. dwstat
Durbin-Watson d-statistic( 4, 30) = 1.805563
Durbin-Watson = 1.81
Interpretation:
The Durbin-Watson (DW) value ranges from 0 to 4:
~2 = no autocorrelation
< 2 = positive autocorrelation
> 2 = negative autocorrelation
🚦 Your result: DW = 1.81
This is very close to 2, so there's no strong autocorrelation in your residuals.