0% found this document useful (0 votes)
10 views10 pages

Econometrics

The document presents an analysis of autocorrelations for a time series 'vector1', testing for autocorrelation and serial correlation in regression models. It includes results from the Breusch-Godfrey test and Durbin-Watson test, indicating weak evidence against the null hypothesis of no serial correlation. Additionally, it discusses heteroskedasticity tests and provides regression analysis results, highlighting significant coefficients and the use of Generalized Least Squares for improved estimates.

Uploaded by

Lakshman Gawhade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views10 pages

Econometrics

The document presents an analysis of autocorrelations for a time series 'vector1', testing for autocorrelation and serial correlation in regression models. It includes results from the Breusch-Godfrey test and Durbin-Watson test, indicating weak evidence against the null hypothesis of no serial correlation. Additionally, it discusses heteroskedasticity tests and provides regression analysis results, highlighting significant coefficients and the use of Generalized Least Squares for improved estimates.

Uploaded by

Lakshman Gawhade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1) Autocorrelations of series ‘vector1’, by lag

Purpose: To identify if there is any autocorrelation in the time series data.


Null Hypothesis (H0): There is no autocorrelation at lag kkk.
Alternative Hypothesis (H1): There is autocorrelation at lag kkk.
Results:

0 1 2 3 4 5 6 7
1.000 0.257 0.208 -0.389 -0.093 -0.268 -0.064 -0.151
Interpretation: Varying levels of correlation indicate potential autocorrelation.

Autocorrelations of series ‘vector1’, by lag

0
1

Autocorrelations of series ‘vector1’, by lag

0 1 2
1.000 0.257 0.208

Autocorrelations of series ‘vector1’, by lag

0 1 2 3 4 5 6
1.000 0.257 0.208 -0.389 -0.093 -0.268 -0.064

2) Autocorrelations of series ‘vector1’, by lag

0 1 2 3 4 5 6 7
1.0 0.257 0.208 -0.389 -0.093 -0.268 -0.064 -0.151
Autocorrelations of series ‘vector1’, by lag

0
1

Autocorrelations of series ‘vector1’, by lag

0 1 2
1.0 0.257 0.208

Autocorrelations of series ‘vector1’, by lag


0 1 2 3 4 5 6
1.0 0.257 0.208 -0.389 -0.093 -0.268 -0.064

3) 1st ggplot

2nd ggplot
// head(autocorr1)

# A tibble: 6 × 6
year Y X t diff_Y diff_X
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1960 59.9 48 2 1.40 0.800
2 1961 61.7 49.8 3 1.80 1.80
3 1962 63.9 52.1 4 2.20 2.30
4 1963 65.3 54.1 5 1.40 2
5 1964 67.8 54.6 6 2.5 0.5
6 1965 69.3 58.6 7 1.5 4

//corr_mat

year Y X t diff_Y diff_X


year 1.00 0.97 1.00 1.00 -0.30 0.02
Y 0.97 1.00 0.98 0.97 -0.29 -0.01
X 1.00 0.98 1.00 1.00 -0.26 0.05
t 1.00 0.97 1.00 1.00 -0.30 0.02
diff_Y -0.30 -0.29 -0.26 -0.30 1.00 0.52
diff_X 0.02 -0.01 0.05 0.02 0.52 1.00

// head(melted_corr_mat)
Var1 Var2 value
1 year year 1.00
2 Y year 0.97
3 X year 1.00
4 t year 1.00
5 diff_Y year -0.30
6 diff_X year 0.02

4)
Autocorrelations of series ‘autocorr1$Y’, by lag

0 1 2 3 4 5 6 7 8 9 10 11 12
1.0 0.900 0.811 0.729 0.649 0.570 0.488 0.407 0.337 0.277 0.219 0.155 0.096

5)Breusch-Godfrey Test for Serial Correlation


Purpose: To test for serial correlation in the residuals of a regression model.
Null Hypothesis (H0): No serial correlation.
Alternative Hypothesis (H1): Presence of serial correlation.
Test Statistic: LM test = 3.4718, df = 1
P-Value: 0.06242
Interpretation: Weak evidence against the null hypothesis. Do not reject H0 at 5% significance.

data: y1 ~ x
LM test = 3.4718, df = 1, p-value = 0.06242

// coeftest(bg4)

z test of coefficients:

Estimate Std. Error z value Pr(>|z|)


(Intercept) 0.0021470 0.0853765 0.0251 0.97994
x -0.0014444 0.0853835 -0.0169 0.98650
lag(resid)_1 -0.2064688 0.1032185 -2.0003 0.04547 *
lag(resid)_2 -0.0943385 0.1045675 -0.9022 0.36696
lag(resid)_3 -0.1725857 0.1045324 -1.6510 0.09873 .
lag(resid)_4 0.0099251 0.1040774 0.0954 0.92403
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Durbin-Watson Test
Purpose: To test for the presence of autocorrelation at lag 1 in the residuals.
Null Hypothesis (H0): No first-order autocorrelation.
Alternative Hypothesis (H1): Positive first-order autocorrelation.
Test Statistic: DW = 2.366
P-Value: 0.9744
Interpretation: No evidence of positive first-order autocorrelation.

data: y1 ~ x
DW = 2.366, p-value = 0.9744
alternative hypothesis: true autocorrelation is greater than 0

6)

//head(hetero)

# A tibble: 6 × 6
obs ind sales rd prof group
<dbl> <chr> <dbl> <dbl> <dbl> <chr>
1 1 Containers and Packing 6375. 62.5 185. low
2 2 Nonbank financial 11626. 92.5 1570. low
3 3 Service industries 14655. 178. 277. low
4 4 Metals and mining 21869. 258. 2828. low
5 8 Paper and forest products 40295. 422. 4646. low
6 5 Housing and construction 26408. 495. 226. low

//summay(hetero)

obs ind sales rd prof


Min. : 1.00 Length:18 Min. : 6375 Min. : 62.5 Min. : 185.1
1st Qu.: 5.25 Class :character 1st Qu.: 27908 1st Qu.: 439.9 1st Qu.: 2842.1
Median : 9.50 Mode :character Median : 75657 Median : 1608.0 Median : 4841.1
Mean : 9.50 Mean : 89775 Mean : 3056.8 Mean : 8102.4
3rd Qu.:13.75 3rd Qu.:120772 3rd Qu.: 4320.2 3rd Qu.:12972.1
Max. :18.00 Max. :293543 Max. :13210.8 Max. :22626.2
group
Length:18
Class :character
Mode :character

//ggplot(data = hetero, aes(y = hetero_resi, x = rd)) + geom_point(col = 'blue') + geom_abline(slope = 0)


// ggplot(data = hetero, aes(y = hetero_resi, x = prof)) + geom_point(col = 'blue') + geom_abline(slope = 0)

//summary(varfunc)

Call:
lm(formula = hetero_resi ~ rd + prof, data = hetero)

Residuals:
Min 1Q Median 3Q Max
-69529 -13381 -4386 14317 95682

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.121e-12 1.377e+04 0 1
rd -6.062e-17 3.588e+00 0 1
prof 4.324e-17 1.826e+00 0 1
Residual standard error: 38410 on 15 degrees of freedom
Multiple R-squared: 3.343e-34, Adjusted R-squared: -0.1333
F-statistic: 2.507e-33 on 2 and 15 DF, p-value: 1

//bptest(hetero.ols)

[1] 3.841459

Heteroskedasticity Tests (Breusch-Pagan Test)

Purpose: To test for the presence of heteroskedasticity in the regression model.


Null Hypothesis (H0): Homoskedasticity (constant variance).
Alternative Hypothesis (H1): Heteroskedasticity (non-constant variance).
Test Statistic: BP = 8.2046, df = 2
P-Value: 0.01653
Interpretation: Evidence against H0. Heteroskedasticity is present.

data: hetero.ols
BP = 8.2046, df = 2, p-value = 0.01653

//coeftest(hetero.ols)

t test of coefficients:

Estimate Std. Error t value Pr(>|t|)


(Intercept) 9933.0446 13769.3233 0.7214 0.4817638
rd 2.5034 3.5878 0.6978 0.4960018
prof 8.9096 1.8261 4.8791 0.0002004 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

//coeftest(hetero.ols, vcov = vcovHC(hetero.ols, "HC1"))

Coefficient Tests with Heteroskedasticity Consistent Standard Errors

Purpose: To check the significance of coefficients in the presence of heteroskedasticity.


Null Hypothesis (H0): The coefficient is zero.
Alternative Hypothesis (H1): The coefficient is not zero.
Results: Estimate Std. Error t value Pr(>|t|)

(Intercept) 9933.0446 7448.8482 1.3335 0.2023


rd 2.5034 3.9456 0.6345 0.5353
prof 8.9096 1.1421 7.8009 1.173e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Interpretation: Significant coefficients are identified (e.g., prof with p < 0.001).

Call:
lm(formula = sales ~ rd + prof, data = hetero, weights = 1/sqrt(wls_varfunc))

// summary(hetero.gls)

Weighted Residuals:
Min 1Q Median 3Q Max
-417.68 -124.83 -30.47 150.93 363.27

Generalized Least Squares (GLS) Estimation

Purpose: To address heteroskedasticity by using a GLS estimator.


Results:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8464.107 7775.279 1.089 0.294
rd 4.274 3.653 1.170 0.260
prof 8.553 1.423 6.012 2.38e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Interpretation: Provides more efficient estimates by considering the variance structure.

Residual standard error: 216.1 on 15 degrees of freedom


Multiple R-squared: 0.8497, Adjusted R-squared: 0.8296
F-statistic: 42.38 on 2 and 15 DF, p-value: 6.733e-07

# A tibble: 18 × 6
# Groups: group [2]
obs ind sales rd prof group
<dbl> <chr> <dbl> <dbl> <dbl> <chr>
1 1 Containers and Packing 6375. 62.5 185. low
2 2 Nonbank financial 11626. 92.5 1570. low
3 3 Service industries 14655. 178. 277. low
4 4 Metals and mining 21869. 258. 2828. low
5 8 Paper and forest products 40295. 422. 4646. low
6 5 Housing and construction 26408. 495. 226. low
7 9 Food 70762. 509. 5036. low
8 6 General manufacturing 32406. 1083 3752. low
9 12 Consumer products 101314. 1595. 10279. low
10 7 Leisure time industries 35108. 1621. 2884. low
11 17 Fuel 230614. 1704. 22626. low
12 15 Conglomerates 141650. 3164. 9761. high
13 11 Aerospace 95294 3919. 4488. high
14 14 Chemicals 122316. 4454. 16439. high
15 13 Electrical and electronics 116141. 6108. 8787. high
16 10 Health care 80553. 6620. 13870. high
17 18 Automative 293543 9528. 18415. high
18 16 Office equipment and computers 175026. 13211. 19774. high

# A tibble: 1 × 5
mean_sales sum_sales count max_sales min_sales
<dbl> <dbl> <int> <dbl> <dbl>
1 89775. 1615956. 18 293543 6375.
# A tibble: 2 × 2
group mean_sales
<chr> <dbl>
1 high 146360.
2 low 53767.

You might also like