Case
R-code voor case econometrie ()
Dit document omvat de r-code die wordt gebruikt in het programma R-studio. Behaald cijfer: 17/20.
[Show more]
Uploaded on
February 15, 2024
Number of pages
7
Written in
2023/2024
Type
Case
Professor(s)
Ruben schoonackers
Grade
8-9
Institution
Vrije Universiteit Brussel (VUB)
Education
Toegepaste Economische Wetenschappen
Course
Econometrie
All documents for this subject (16)
$6.97
100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached
# Haal de database loonverschillen_2023.xlsx op Canvas #
setwd("/Users/loick/Documents/School/VUB/3e bachelor/Semester 1/Econometrie/CASE")
library('readxl')
loonverschillen_2023<-read_excel("loonverschillen_2023.xlsx",col_names=TRUE)
# Dummy variabelen maken #
loonverschillen_2023$Femaledum_i <- ifelse(loonverschillen_2023$Female_i == "vrouw",
1, 0)
loonverschillen_2023$Nonwhitedum_i <- ifelse(loonverschillen_2023$Nonwhite_i ==
"niet-blank", 1, 0)
loonverschillen_2023$Uniondum_i <- ifelse(loonverschillen_2023$Union_i == "lid", 1, 0)
loonverschillen_2023$E2_i <- loonverschillen_2023$E_i^2
# Regressies #
## Basisvergelijking ##
Wage_regression <- lm(log(loonverschillen_2023$W_i) ~ loonverschillen_2023$S_i +
loonverschillen_2023$E_i + loonverschillen_2023$E2_i +
loonverschillen_2023$Femaledum_i + loonverschillen_2023$Nonwhitedum_i +
loonverschillen_2023$Uniondum_i +
loonverschillen_2023$S_i*loonverschillen_2023$Femaledum_i)
summary(Wage_regression)
## Onderzoeker A ##
Wage_regressionA <- lm(loonverschillen_2023$W_i ~ loonverschillen_2023$S_i +
loonverschillen_2023$E_i + loonverschillen_2023$E2_i +
loonverschillen_2023$Femaledum_i + loonverschillen_2023$Nonwhitedum_i +
loonverschillen_2023$Uniondum_i + loonverschillen_2023$S_i *
loonverschillen_2023$Femaledum_i)
summary(Wage_regressionA)
## Onderzoeker B ##
Wage_regressionB <- lm(log(loonverschillen_2023$W_i) ~ loonverschillen_2023$S_i +
loonverschillen_2023$E_i + loonverschillen_2023$E2_i +
loonverschillen_2023$Femaledum_i + loonverschillen_2023$Nonwhitedum_i +
loonverschillen_2023$Uniondum_i + loonverschillen_2023$S_i *
loonverschillen_2023$Femaledum_i + loonverschillen_2023$Femaledum_i *
loonverschillen_2023$Nonwhitedum_i)
summary(Wage_regressionB)
# Jarque Bera test voor normaliteit #
install.packages('tseries')
library('tseries')
jarque.bera.test(Wage_regression$residuals)
jarque.bera.test(Wage_regressionA$residuals)
jarque.bera.test(Wage_regressionB$residuals)
, # Multicollineariteit meten #
hulpregressieS_i <- lm(loonverschillen_2023$S_i ~ loonverschillen_2023$E_i +
loonverschillen_2023$E2_i + loonverschillen_2023$Femaledum_i +
loonverschillen_2023$Nonwhitedum_i + loonverschillen_2023$Uniondum_i +
loonverschillen_2023$S_i:loonverschillen_2023$Femaledum_i)
summary(hulpregressieS_i)
VIF_S_i<-1/(1-summary(hulpregressieS_i)$r.squared)
var_beta_S_i<-(VIF_S_i*(0.347)^2)/(500*var(loonverschillen_2023$S_i))
std_beta_S_i<-sqrt(var_beta_S_i)
hulpregressieE_i <- lm(loonverschillen_2023$E_i ~ loonverschillen_2023$S_i +
loonverschillen_2023$E2_i + loonverschillen_2023$Femaledum_i +
loonverschillen_2023$Nonwhitedum_i + loonverschillen_2023$Uniondum_i +
loonverschillen_2023$S_i*loonverschillen_2023$Femaledum_i)
summary(hulpregressieE_i)
VIF_E_i<-1/(1-summary(hulpregressieE_i)$r.squared)
var_beta_E_i<-(VIF_E_i*(0.347)^2)/(500*var(loonverschillen_2023$E_i))
std_beta_E_i<-sqrt(var_beta_E_i)
hulpregressieE2_i <- lm(loonverschillen_2023$E2_i ~ loonverschillen_2023$S_i +
loonverschillen_2023$E_i + loonverschillen_2023$Femaledum_i +
loonverschillen_2023$Nonwhitedum_i + loonverschillen_2023$Uniondum_i +
loonverschillen_2023$S_i*loonverschillen_2023$Femaledum_i)
summary(hulpregressieE2_i)
VIF_E2_i<-1/(1-summary(hulpregressieE2_i)$r.squared)
var_beta_E2_i<-(VIF_E2_i*(0.347)^2)/(500*var(loonverschillen_2023$E2_i))
std_beta_E2_i<-sqrt(var_beta_E2_i)
hulpregressieFemaledum_i <- lm(loonverschillen_2023$Femaledum_i ~
loonverschillen_2023$S_i + loonverschillen_2023$E_i + loonverschillen_2023$E2_i +
loonverschillen_2023$Nonwhitedum_i + loonverschillen_2023$Uniondum_i +
loonverschillen_2023$Femaledum_i:loonverschillen_2023$S_i)
summary(hulpregressieFemaledum_i)
VIF_Femaledum_i<-1/(1-summary(hulpregressieFemaledum_i)$r.squared)
var_beta_Femaledum_i<-(VIF_Femaledum_i*(0.347)^2)/
(500*var(loonverschillen_2023$Femaledum_i))
std_beta_Femaledum_i<-sqrt(var_beta_Femaledum_i)
hulpregressieUniondum_i <- lm(loonverschillen_2023$Uniondum_i ~
loonverschillen_2023$S_i + loonverschillen_2023$E_i + loonverschillen_2023$E2_i +
loonverschillen_2023$Nonwhitedum_i + loonverschillen_2023$Femaledum_i +
loonverschillen_2023$S_i*loonverschillen_2023$Femaledum_i)
summary(hulpregressieUniondum_i)
VIF_Uniondum_i<-1/(1-summary(hulpregressieUniondum_i)$r.squared)
var_beta_Uniondum_i<-(VIF_Uniondum_i*(0.347)^2)/
(500*var(loonverschillen_2023$Uniondum_i))
std_beta_Uniondum_i<-sqrt(var_beta_Uniondum_i)
hulpregressieNonwhitedum_i <- lm(loonverschillen_2023$Nonwhitedum_i ~
loonverschillen_2023$S_i + loonverschillen_2023$E_i + loonverschillen_2023$E2_i +