library (dynlm)
## Warning: package 'dynlm' was built under R version 3.5.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 3.5.3
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
Download Example6_3.csv datasets
Read Example6_3.csv data set into R Console
example6.3 <- read.csv (file.choose (), header = TRUE)
and choose Example6_3 data set in your downloaded folder.
Or, Copy and Paste the data set into your file directory and perform this code in R console.
example6.3 <- read.csv ("Example6_3.csv", header = TRUE)
example6.3 <- ts (example6.3, start = 1962, frequency = 1)
str (example6.3) # check the structure
## Time-Series [1:36, 1:9] from 1962 to 1997: 1962 1963 1964 1965 1966 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr [1:9] "Year" "Cars" "UnemplRa" "GDP" ...
head (example6.3) # check the first 6 observations
## Year Cars UnemplRa GDP Export PopSize AvCarLan PerCapIn CPI
## [1,] 1962 11.9 7.9 10426 2626 7.4 7.5 1409 31.3
## [2,] 1963 14.1 7.8 13077 2705 8.9 7.2 1469 32.2
## [3,] 1964 16.5 7.8 13932 2781 9.2 7.2 1514 32.1
## [4,] 1965 18.1 7.9 15400 3103 9.4 7.5 1638 32.9
## [5,] 1966 17.6 7.8 16376 3120 9.7 7.5 1688 33.4
## [6,] 1967 16.3 7.8 16612 3723 10.0 7.4 1661 34.8
List of all variables name
colnames (example6.3)
## [1] "Year" "Cars" "UnemplRa" "GDP" "Export" "PopSize" "AvCarLan"
## [8] "PerCapIn" "CPI"
plot (example6.3[,-1], main = "Plotting for All Variables over Times (1962-1997)")
Comment: (Answer 1)
We will demonstrate on how to perform Model Estimation Procedure (General-to-Specific Approach) by using R Programming
reg1 <- dynlm(Cars~UnemplRa+GDP+Export+PopSize+AvCarLan+PerCapIn+CPI+L(Cars), data = example6.3)
summary (reg1)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ UnemplRa + GDP + Export + PopSize + AvCarLan +
## PerCapIn + CPI + L(Cars), data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -44.487 -7.154 -0.404 8.736 42.431
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -68.490721 120.329724 -0.569 0.574111
## UnemplRa 6.041032 7.192849 0.840 0.408640
## GDP -0.005416 0.004463 -1.213 0.235877
## Export 0.001423 0.001180 1.206 0.238688
## PopSize -2.310819 16.809494 -0.137 0.891718
## AvCarLan -5.795693 5.671624 -1.022 0.316255
## PerCapIn 0.106478 0.057699 1.845 0.076396 .
## CPI -0.064020 1.438768 -0.044 0.964849
## L(Cars) 0.932328 0.215747 4.321 0.000201 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.83 on 26 degrees of freedom
## Multiple R-squared: 0.963, Adjusted R-squared: 0.9517
## F-statistic: 84.67 on 8 and 26 DF, p-value: < 2.2e-16
Comment: (Answer 2)
reg2 <- dynlm(Cars~UnemplRa+Export+PopSize+AvCarLan+PerCapIn+CPI+L(Cars), data = example6.3)
summary (reg2)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ UnemplRa + Export + PopSize + AvCarLan +
## PerCapIn + CPI + L(Cars), data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -40.352 -8.066 0.741 8.500 44.422
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.345e+01 5.198e+01 1.221 0.232760
## UnemplRa 6.086e+00 7.255e+00 0.839 0.408962
## Export 6.707e-05 3.822e-04 0.175 0.862023
## PopSize -1.615e+01 1.245e+01 -1.297 0.205589
## AvCarLan -6.531e+00 5.688e+00 -1.148 0.261001
## PerCapIn 7.724e-02 5.288e-02 1.461 0.155663
## CPI -7.812e-01 1.323e+00 -0.590 0.559821
## L(Cars) 8.779e-01 2.129e-01 4.124 0.000318 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.99 on 27 degrees of freedom
## Multiple R-squared: 0.9609, Adjusted R-squared: 0.9508
## F-statistic: 94.89 on 7 and 27 DF, p-value: < 2.2e-16
Comment: (Answer 3)
reg3 <- dynlm(Cars~UnemplRa+Export+AvCarLan+PerCapIn+CPI+L(Cars), data = example6.3)
summary (reg3)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ UnemplRa + Export + AvCarLan + PerCapIn +
## CPI + L(Cars), data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -41.216 -4.940 -0.819 8.499 53.431
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 47.5385857 51.1243344 0.930 0.360390
## UnemplRa 0.1373883 5.6903397 0.024 0.980909
## Export 0.0003430 0.0003214 1.067 0.294909
## AvCarLan -6.6973355 5.7557271 -1.164 0.254408
## PerCapIn 0.0230321 0.0327941 0.702 0.488275
## CPI -0.9711533 1.3309798 -0.730 0.471663
## L(Cars) 0.8708293 0.2153761 4.043 0.000374 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.22 on 28 degrees of freedom
## Multiple R-squared: 0.9585, Adjusted R-squared: 0.9496
## F-statistic: 107.8 on 6 and 28 DF, p-value: < 2.2e-16
Comment: (Answer 4)
reg4 <- dynlm(Cars~Export+AvCarLan+PerCapIn+CPI+L(Cars), data = example6.3)
summary (reg4)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ Export + AvCarLan + PerCapIn + CPI + L(Cars),
## data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -41.278 -4.893 -0.847 8.518 53.452
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 48.3930460 36.2537524 1.335 0.192
## Export 0.0003476 0.0002544 1.366 0.182
## AvCarLan -6.6159001 4.5828373 -1.444 0.160
## PerCapIn 0.0227653 0.0303402 0.750 0.459
## CPI -0.9679251 1.3012286 -0.744 0.463
## L(Cars) 0.8670720 0.1463046 5.926 1.95e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.89 on 29 degrees of freedom
## Multiple R-squared: 0.9585, Adjusted R-squared: 0.9514
## F-statistic: 134 on 5 and 29 DF, p-value: < 2.2e-16
Comment: (Answer 5)
reg5 <- dynlm(Cars~Export+AvCarLan+CPI+L(Cars), data = example6.3)
summary (reg5)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ Export + AvCarLan + CPI + L(Cars), data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -39.970 -6.370 0.206 7.429 56.067
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 66.0337831 27.3952319 2.410 0.02227 *
## Export 0.0004972 0.0001570 3.167 0.00353 **
## AvCarLan -8.0146917 4.1559314 -1.928 0.06330 .
## CPI -0.0268940 0.3443225 -0.078 0.93826
## L(Cars) 0.9015169 0.1379005 6.537 3.14e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.75 on 30 degrees of freedom
## Multiple R-squared: 0.9577, Adjusted R-squared: 0.9521
## F-statistic: 169.8 on 4 and 30 DF, p-value: < 2.2e-16
Comment: (Answer 6)
reg6 <- dynlm(Cars~Export+AvCarLan+L(Cars), data = example6.3)
summary (reg6)
##
## Time series regression with "ts" data:
## Start = 1963, End = 1997
##
## Call:
## dynlm(formula = Cars ~ Export + AvCarLan + L(Cars), data = example6.3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -40.084 -6.157 0.384 7.248 55.736
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 66.1549333 26.9092562 2.458 0.019741 *
## Export 0.0004911 0.0001340 3.663 0.000922 ***
## AvCarLan -8.1770225 3.5407782 -2.309 0.027751 *
## L(Cars) 0.8998982 0.1341310 6.709 1.66e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.45 on 31 degrees of freedom
## Multiple R-squared: 0.9577, Adjusted R-squared: 0.9536
## F-statistic: 233.9 on 3 and 31 DF, p-value: < 2.2e-16
Comment: (Answer 7)