AFRICAN ECONOMIC RESEARCH CONSORTIUM
COLLABORATIVE MASTERS PROGRAM
JOINT FACILITY FOR ELECTIVES
ECON 561: ECONOMETRICS THEORY AND PRACTICE
LECTURER: PROF. ARCADE NDORICIMPA
ASSIGNMENT TWO
BEN YAO AGBEYESRO
QUESTION ONE
Given Y = 4 + 0.4x1 + 0.9x2
29 0 0
X′X = [ 0 50 10]
0 10 80
e′e = 520
n = 29
R2 =
Null hypthesis (H0): β1 + β2 = 1
Alternative hypothesis (H1) ∶ β1 + β2 ≠ 1
The t-test:
β̂1 = 0.4 β̂2
= 0.9
(β1 + β2) = 1
Cov( β1, β2) = S2(X′X)−1
e′ e
S2 = n
−k
S2 = = 20
29 0 0
X′X = [ 0 50 10]
0 10 80
10
|X′X| = 29
50 ] = 113100
[ 10 80
(X
′
X)−1 = |X1′X| Adj(X′X)
3900 0 0
(X′X)−1 = [ 0 2320 −290]
0 −290 1450
20
3900 0 0
2 ′ −1
0 2320 −29 S (X X) = [ ]
0 −290 0
113100
145
0
Var( β1) = (2320) = 0.410
Var( β2) = (1450) = 0.256
Cov( β1, β2) = (−290) = − 0.051
t0.05(29−3) = t0.025(26) =
2.056 2
Decision and conclusion: since the calculated t value (0.399) is lower than the t critical (2.056),
we fail to reject H0 and hence it can be concluded that that the slope parameters sum up 1.
Also, using the F- stat:
(Rβ − q)′{R[S2(X′X)−1]R′}−1(Rβ − q)
F=
J
HO ∶ Rβ − q = 0
H1 : Rβ − q ≠ 0
Also, given
(β1 + β2) = 1
q=1
R= [0 1 1]
J = Number of restrictions = 1
β0 4
β = [β1] = [0.4]
β2 0.9
4
Rβ − q = [0 1 1] [0.4] − 1 = 0.3
0.9
(Rβ − q)′ = 0.3
20 3900 0 0
R[S2(X′X)−1]R′ = [0 1 1] [ 0 0 −290] [1] = 0.
113100 2320 560
0 −290 1450 1
F= = 0.161
since the calculated F (0.161) is lower than the F critical (4.23), we fail to reject H 0 and hence
conclude we that the slope parameters sum up 1.
QUESTION TWO
I. The dataset contains our variables, “obs”, “PIB”, “Labour” and “capital,”. To conduct the anal
ysis, the natural log of these variables was found.
The Results:
Call: lm(formula = lnY ~ lnL + lnK + I(lnL_sq) + I(lnK_sq) + I(lnLlnK), data
= data)
Residuals:
Min 1Q Median 3Q Max
-0.33990 -0.10106 -0.01238 0.04605 0.39281
Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) 0.94420
2.91075 0.324 0.7489 lnL 3.61364 1.54807 2.334
0.0296 * lnK -1.89311 1.01626 -1.863 0.0765 . I(lnL_sq)
-0.96405 0.70738 -1.363 0.1874
I(lnK_sq) 0.08529 0.29261 0.291 0.7735
I(lnLlnK) 0.31239 0.43893 0.712 0.4845
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.1799 on 21 degrees of freedom
Multiple R-squared: 0.9549, Adjusted R-squared: 0.9441
F-statistic: 88.85 on 5 and 21 DF, p-value: 2.121e-13
The model is expressed as,
i. 𝐼𝑛𝑦 = 0.944 + 3.61364 𝐼𝑛𝐿 − 1.8931 𝐼𝑛𝐾 − 0.96405𝑙𝑛𝐿𝑠𝑞 + 0.0852𝐼𝑛𝐾𝑠𝑞 +
0.31239𝐼𝑛𝐿𝐼𝑛𝐾 + 0.1799
From the model, estimated intercept of the model is 0.94420, which is not statistically significant
(p-value = 0.7489), indicating that the intercept does not have a meaningful impact on the model.
The regression results indicate that the log of labour (lnL) is a significant predictor of output,
with a coefficient of 3.61364 (p-value = 0.0296), suggesting that a 1% increase in labour leads to
approximately a 3.61% increase in output. The log of capital (lnK) has a coefficient of -1.89311,
which is significant (p-value = 0.0765) at 0.1% alpha level, implying a potential 1.89% decrease
in output for a 1% increase in capital. However, the non-linear effects of labour and capital, as
well as their interaction, are not statistically significant, as indicated by the p-values for lnL_sq
(0.1874), lnK_sq (0.7735), and lnLlnK (0.4845).
The residual standard error is 0.1799, indicating the average distance that the observed values fall
from the regression line. The multiple R-squared value is 0.9549, suggesting that approximately
95.49% of the variance in the dependent variable (lnY) is explained by the independent variables
in the model. The adjusted R-squared value is 0.9441 provides a more accurate measure of the
model's explanatory power. The F-statistic is 88.85, with a p-value of
2.121e-13, indicating that the model is statistically significant overall.
2ii. Given a restriction 𝛽3 = 𝛽4 = 𝛽5 = 0, a linear hypothesis test was conducted to compare
both the restricted and unrestricted model.
Null hypothesis
𝐻0: 𝛽3 = 𝛽4 = 𝛽5 = 0, this indicates that 𝛽3, 𝛽4, 𝑜𝑟 𝛽5 𝑑𝑜 𝑛𝑜𝑡significantly contribute to the
model.
𝐻1: 𝛽3 ≠ 𝛽4 ≠ 𝛽5 ≠ 0, implying 𝛽3, 𝛽4, 𝑜𝑟 𝛽5 significantly affect the model.
Results:
Linear hypothesis test
Hypothesis:
I(lnL_sq) = 0
I(lnK_sq) = 0
I(lnLlnK) = 0
Model 1: restricted model
Model 2: lnY ~ lnL + lnK + I(lnL_sq) + I(lnK_sq) + I(lnLlnK)
[Link] RSS Df Sum of Sq F Pr(>F)
1 24 0.85163
2 21 0.67993 3 0.17171 1.7678 0.1841
From the results of the analysis, the restricted model has residual degrees of freedom of 24, and a
residual sum of square value of 0.85163. The unrestricted model has residual degrees of freedom
of 21, and a residual sum square of 0.67993. The difference in the degrees of freedom for the two
models is 3, corresponding to the three terms included in the restricted model. The difference in
the sum of squares between the two models is 0.17171.
Using the F-test to test the significant difference,
(𝑠𝑢𝑚 𝑜𝑓𝑑𝑖𝑓𝑓𝑒𝑟𝑟𝑒𝑛𝑐𝑒)/𝐷𝐹 𝑑𝑖𝑓𝑒𝑟𝑒𝑛𝑐𝑒
𝐹(𝑚, 𝑛−𝑘) = 𝑅𝑆𝑆(𝑢𝑛𝑟𝑒𝑠𝑡𝑟𝑖𝑐𝑡𝑒𝑑)
𝑅𝑒𝑠. 𝐷𝑓(𝑢𝑛𝑟𝑒𝑠𝑡𝑟𝑖𝑐𝑡𝑒𝑑)
𝐹(3, 27−6) =
𝐹(3, 21) = 1.7678
The f-test from the results is 1.7678 with a p-value of 0.1841 which is greater than an alpha level
of 0.05, we fail to reject the null hypothesis. Hence, we conclude that the restriction does not
significantly improve the model. Therefore, the approapriate function of the model is the linear
regression which includes only lnL and Lnk.
2iii. Testing for constant returns to scale:
𝐻0: 𝛽1 + 𝛽2 = 1, meaning the production function has a constant return to scale.
𝐻1 ∶ 𝛽1 + 𝛽2 ≠ 1, meaning the production function do not have a constant return to scale.
Results, using the linear hypothesis,
CONSTANT RETURNS TO SCALE##
> #Ho: lnL + lnK = 1
> linearHypothesis(model1, "lnL + lnK = 1")
Linear hypothesis test
Hypothesis: lnL
+ lnK = 1
Model 1: restricted model
Model 2: lnY ~ lnL + lnK + I(lnL_sq) + I(lnK_sq) + I(lnLlnK)
[Link] RSS Df Sum of Sq F Pr(>F)
1 22 0.69730
2 21 0.67993 1 0.017378 0.5367 0.4719
Comparing a restricted model (enforcing constant returns to scale) with an unrestricted model, w
e found the following: the F-statistic was 0.5367 with a p-value of 0.4719. Since the p-value is gr
eater than conventional significance level (0.050), we fail reject the null hypothesis. Therefore, t
he assumption of constant returns to scale holds for the labour and capital. This implies, a propor
tional increase in laour and capital inputs results in a proportional increase in output.
2iv. 𝐻0: 𝛽3 = 𝛽4 = 𝛽5 = 0 𝑎𝑛𝑑 𝛽1 + 𝛽2 = 1
𝐻1: 𝛽3 ≠ 𝛽4 ≠ 𝛽5 ≠ 0 𝑎𝑛𝑑 𝛽1 + 𝛽2 ≠ 1
The results:
#Testing Joint Restricction#
>
> linearHypothesis(model1, c("I(lnL_sq) = 0", "I(lnK_sq) = 0", "I(lnLlnK) = 0", "lnL + lnK
Linear hypothesis test
Hypothesis:
I(lnL_sq) = 0
I(lnK_sq) = 0
I(lnLlnK) = 0 lnL +
lnK = 1
Model 1: restricted model
Model 2: lnY ~ lnL + lnK + I(lnL_sq) + I(lnK_sq) + I(lnLlnK)
[Link] RSS Df Sum of Sq F Pr(>F)
1 25 0.85574 2 21 0.67993 4
0.17581 1.3575 0.2822
From the analysis, the result has and F-test of 1.3575 and a p-value 0.2822, which is greater than
0.05 significance level. Therefore, we fail to reject the null hypothesis. Hence, we do not have s
ufficient evidence to conclude that the quadratic and interaction terms𝛽3, 𝛽4, 𝛽5 are different
fro m zero or that the sum of β1+β2 is not equal one. Suggesting that the production model is
adequa te without a quadratic interaction, and also, assumes a constant returns to scale.
QUESTION THREE
Interpretation of the summary of the regression results
# Estimate the wage equation
>
> Wage_eq <- lm(log(wage) ~ experience + I(experience^2) + education + ethnic ity, data =
CPS1988)
>
> # Show the summary of the regression results
> summary(Wage_eq) Call: lm(formula = log(wage) ~ experience +
I(experience^2) + education + ethnicity, data = CPS1988)
Residuals:
Min 1Q Median 3Q Max
-2.9428 -0.3162 0.0580 0.3756 4.3830
Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept)
4.321e+00 1.917e-02 225.38 <2e-16 *** experience 7.747e-
02 8.800e-04 88.03 <2e-16 *** I(experience^2) -1.316e-03
1.899e-05 -69.31 <2e-16 *** education 8.567e-02 1.272e-03
67.34 <2e-16 *** ethnicityafam -2.434e-01 1.292e-02 -18.84
<2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.5839 on 28150 degrees of freedom
Multiple R-squared: 0.3347, Adjusted R-squared: 0.3346
F-statistic: 3541 on 4 and 28150 DF, p-value: < 2.2e-16
The intercept of the regression function is 4.321, with p-value (0.0000). Experience positively
impacts wages, with each additional year increasing the log of wage by approximately 0.07747,
though with diminishing returns as indicated by the negative coefficient for the square of
experience. Also, education significantly boosts wages, with each additional year increasing the
log of wage by about 0.08567. Conversely, ethinicityafam is associated with a significant
decrease in the log of wage by approximately 0.2434. the overall model is significant (p-value =
0.00), with an R-square of 33.46%, implying the 33.46% variation in the dependent variable
explained by the independent variables.
Test for heteroscedasticity
The Breusch-Pagan test was used in testing foe the heteroscedasticity in the wage equation.
𝐻0: 𝑅𝑒𝑠𝑖𝑑𝑢𝑎𝑙𝑠 ℎ𝑎𝑣𝑒 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 𝑣𝑎𝑟𝑖𝑎𝑛𝑐𝑒
𝐻1 ∶ 𝑅𝑒𝑠𝑖𝑑𝑢𝑎𝑙𝑠 𝑑𝑜 𝑛𝑜𝑡 ℎ𝑎𝑣𝑒 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 𝑣𝑎𝑟𝑖𝑎𝑛𝑐𝑒
#TEST FOR HETEROSCEDASTICITY##
> library(lmtest)
> bptest(Wage_eq)
studentized Breusch-Pagan test
data: Wage_eq
BP = 615.86, df = 4, p-value < 2.2e-16
From the analysis, the bp test has a value of 615.84, with degrees of freedom of 4 and a p-value o
f 0.000, which is less than 0.05 alpha level. Therefore, we reject the null hypothesis that there exi
sts constant variance. Hence, there is the presence of heteroscedasticity. So, we have to ensure c
orrection is made.
To correct heteroscedasticity, the heteroscedasticity test with robust standard error was use.
#correction of hetroscedasticity#
>
> # Load necessary libraries
> library(sandwich)
> library(lmtest)
>
> # Test for heteroscedasticity with robust standard errors
>
> coeftest(Wage_eq, vcov = vcovHC(Wage_eq, type = "HC1"))
t test of coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept)
4.3214e+00 2.0608e-02 209.699 < 2.2e-16 *** experience 7.7473e-
02 1.0183e-03 76.078 < 2.2e-16 *** I(experience^2) -1.3161e-03
2.3474e-05 -56.066 < 2.2e-16 *** education 8.5673e-02 1.3751e-
03 62.301 < 2.2e-16 *** ethnicityafam -2.4336e-01 1.3113e-02 -
18.559 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The results from the test were the same, but the robust standard errors were slightly different
from the original ones. Therefore, the results are consistent and reliable after adjusting for
heteroscedasticity, providing robust estimates of the effects of experience, education, and
ethnicity on wages.
R SCRIPT
[Link]("readxl") [Link]("dplyr")
library(readxl)
library(dplyr)
#Loading data#
data <- read_excel("[Link]")
#TRANSFORMIND THE DATA#
1.#Viewing heads of data# head(data)
2. # check if columns exist in data frames#
#creating the lof transformed variables using the dplyr & Mutate the data
frame to add the new columns
if(all(c("PIB", "Labour", "Capital") %in% colnames(data))) {
# Creating log-transformed variables using dplyr data <-
data %>% mutate(lnY = log(PIB), lnL =
log(Labour), lnK = log(Capital), lnL_sq =
0.5 * (log(Labour))^2, lnK_sq = 0.5 *
(log(Capital))^2, lnLlnK = log(Labour) *
log(Capital))
} else {stop("The data frame does not contain the required columns: PIB,
Labour, Capital ")}
#reading data# head(data)
#ANSWERING QUESTION 2i #estimating the model#
model1 <- lm(lnY ~ lnL + lnK + I(lnL_sq) + I(lnK_sq) + I(lnLlnK), data =
data)
# Display the summary of the estimated model
summary(model1)
#QUESTION 2II#
#H0: B3=B4=B5=0
[Link]("car")
# Load necessary library library(car)
# Test the null hypothesis
linearHypothesis(model1, c("I(lnL_sq) = 0", "I(lnK_sq) = 0", "I(lnLlnK) =
0"))
#QUESTION 2III #
#CONSTANT RETURNS TO SCALE##
#Ho: lnL + lnK = 1
linearHypothesis(model1, "lnL + lnK = 1")
#QUESTION 2 IV##
#Testing Joint Restricction#
linearHypothesis(model1, c("I(lnL_sq) = 0", "I(lnK_sq) = 0", "I(lnLlnK) =
0", "lnL + lnK = 1"))
#QUESTION THREE#
library("AER")
data("CPS1988")
summary(CPS1988)
# Estimate the wage equation
Wage_eq <- lm(log(wage) ~ experience + I(experience^2) + education +
ethnicity, data = CPS1988)
# Show the summary of the regression results summary(Wage_eq)
#TEST FOR HETEROSCEDASTICITY##
library(lmtest) bptest(Wage_eq)
#correction of hetroscedasticity#
# Load necessary libraries
library(sandwich) library(lmtest)
# Test for heteroscedasticity with robust standard errors
coeftest(Wage_eq, vcov = vcovHC(Wage_eq, type = "HC1"))