Solutions to Problem Set 7

ECN 301E - Fall 2023

Author

Name Surname: İsmail Kaya, Student ID: 070200413

Published

This is rendered at: 11 December 2023, 12:40 AM

Question 1

(a) A joint hypothesis is essentially a single hypothesis that places multiple restrictions or conditions on the regression coefficients in a statistical model. Instead of testing each restriction separately, they are tested together as a group.

(b) The F-statistic is a statistical tool used to assess the validity of a joint null hypothesis concerning the regression coefficients in a model. It allows us to determine if the group of restrictions placed on these coefficients is statistically significant.

(c) The F-statistic is used to test the joint null hypothesis about regression coefficients when we assume that the variance of the regression errors (u) is consistent across different values of the independent variables (homoskedastic). It calculates the likelihood that the restrictions on the coefficients are significant, considering the differences in the R-squared values between the restricted and unrestricted regression models, the number of restrictions (q), and the number of independent variables .

(d) A 95% two-sided confidence interval for a coefficient (e.g., βj) is an interval that, when computed from a sample, has a 95% probability of containing the true value of βj. In other words, if we were to draw many random samples and calculate such intervals for each, approximately 95% of these intervals would encompass the actual value of βj.

(e) A control variable, denoted as W, is a variable used in regression analysis that is correlated with both the dependent variable (Y) and the independent variables (X) in order to account for and mitigate the influence of any unobserved or omitted factors that could affect the relationship between Y and X. However, the control variable itself is not assumed to have a direct causal effect on Y.

(f) Conditional mean independence implies that when we consider the control variable, the average value of the error term (ui) does not rely on the specific values of the variable of interest. In simpler terms, the control variable ensures that the average error remains constant regardless of changes in the variable of interest.

(g) Homoskedasticity means that the variability or variance of the error term in a regression model is consistent and does not change with different values of the independent variables (X). On the other hand, heteroskedasticity indicates that the variance of the error term does vary with different values of X, suggesting that the level of uncertainty in the model’s predictions is not constant across all levels of the independent variables.

Question 2

(a)

library(stargazer)

Please cite as: 
 Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
 R package version 5.2.3. https://CRAN.R-project.org/package=stargazer 
library(readxl)
Warning: package 'readxl' was built under R version 4.2.3
library(lmtest)
Warning: package 'lmtest' was built under R version 4.2.3
Zorunlu paket yükleniyor: zoo
Warning: package 'zoo' was built under R version 4.2.3

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
library(sandwich)
Warning: package 'sandwich' was built under R version 4.2.3
library(car)
Warning: package 'car' was built under R version 4.2.3
Zorunlu paket yükleniyor: carData
Warning: package 'carData' was built under R version 4.2.3
setwd("C:/Users/ismail/Desktop/itü 23-24/ekonometri/ProblemSet07")
mydata=read_excel("ch8_cps.xlsx",col_names=T,skip=0)
stargazer(as.data.frame(mydata),type="text",title="Estimation Results for Part (a)")

Estimation Results for Part (a)
==============================================
Statistic   N     Mean  St. Dev.  Min    Max  
----------------------------------------------
ahe       59,668 25.214  17.289  2.000 228.365
yrseduc   59,668 14.094  2.598     6     20   
female    59,668 0.439   0.496     0      1   
age       59,668 42.885  12.584   15     85   
northeast 59,668 0.157   0.364     0      1   
midwest   59,668 0.195   0.396     0      1   
south     59,668 0.370   0.483     0      1   
west      59,668 0.278   0.448     0      1   
----------------------------------------------

(b)

r1=lm(ahe~yrseduc+female,data=mydata)
r1_vcov=vcovHC(r1,type = "HC1") 
r1_se = sqrt(diag(r1_vcov))
stargazer(r1,type="text",se=list(r1_se),title="Estimation Results for Part (b)")

Estimation Results for Part (b)
================================================
                        Dependent variable:     
                    ----------------------------
                                ahe             
------------------------------------------------
yrseduc                       2.994***          
                              (0.028)           
                                                
female                       -6.385***          
                              (0.124)           
                                                
Constant                     -14.186***         
                              (0.366)           
                                                
------------------------------------------------
Observations                   59,668           
R2                             0.223            
Adjusted R2                    0.223            
Residual Std. Error     15.239 (df = 59665)     
F Statistic         8,569.339*** (df = 2; 59665)
================================================
Note:                *p<0.1; **p<0.05; ***p<0.01

(c)

r2=lm(ahe~yrseduc+female+age,data=mydata)
r2_vcov=vcovHC(r2,type = "HC1")
r2_se = sqrt(diag(r2_vcov))
stargazer(r2,type="text",se=list(r2_se),title="Estimation Results for Part (c)")

Estimation Results for Part (c)
================================================
                        Dependent variable:     
                    ----------------------------
                                ahe             
------------------------------------------------
yrseduc                       2.948***          
                              (0.028)           
                                                
female                       -6.410***          
                              (0.122)           
                                                
age                           0.224***          
                              (0.005)           
                                                
Constant                     -23.134***         
                              (0.419)           
                                                
------------------------------------------------
Observations                   59,668           
R2                             0.250            
Adjusted R2                    0.250            
Residual Std. Error     14.976 (df = 59664)     
F Statistic         6,618.240*** (df = 3; 59664)
================================================
Note:                *p<0.1; **p<0.05; ***p<0.01

(d)

r3 <- lm(ahe ~ yrseduc + female + age + northeast + midwest + south, data = mydata)
r3_vcov <- vcovHC(r3, type = "HC1")
r3_se <- sqrt(diag(r3_vcov))

stargazer(r3,
          type = "text",
          se = list(r3_se),
          title = "Estimation Results for Part (d)")

Estimation Results for Part (d)
================================================
                        Dependent variable:     
                    ----------------------------
                                ahe             
------------------------------------------------
yrseduc                       2.939***          
                              (0.028)           
                                                
female                       -6.390***          
                              (0.122)           
                                                
age                           0.222***          
                              (0.005)           
                                                
northeast                     0.711***          
                              (0.205)           
                                                
midwest                      -1.448***          
                              (0.179)           
                                                
south                        -1.185***          
                              (0.154)           
                                                
Constant                     -22.335***         
                              (0.424)           
                                                
------------------------------------------------
Observations                   59,668           
R2                             0.252            
Adjusted R2                    0.252            
Residual Std. Error     14.955 (df = 59661)     
F Statistic         3,346.654*** (df = 6; 59661)
================================================
Note:                *p<0.1; **p<0.05; ***p<0.01
# Adjust the hypothesis test as per your actual variable names
linearHypothesis(r3, c("northeast = 0", "midwest = 0", "south = 0"), white.adjust = "hc1")
Linear hypothesis test

Hypothesis:
northeast = 0
midwest = 0
south = 0

Model 1: restricted model
Model 2: ahe ~ yrseduc + female + age + northeast + midwest + south

Note: Coefficient covariance matrix supplied.

  Res.Df Df      F    Pr(>F)    
1  59664                        
2  59661  3 54.323 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(e)

linearHypothesis(r3,
                 c("yrseduc=age"),
                 white.adjust = "hc1")
Linear hypothesis test

Hypothesis:
yrseduc - age = 0

Model 1: restricted model
Model 2: ahe ~ yrseduc + female + age + northeast + midwest + south

Note: Coefficient covariance matrix supplied.

  Res.Df Df      F    Pr(>F)    
1  59662                        
2  59661  1 9682.2 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1