#Install packages
capture which outreg2
if _rc ssc install outreg2
capture which estout
if _rc ssc install estou

#Import Raw Data
import excel "/Users/timoheroth/Library/CloudStorage/OneDrive-HochschuleLuzern/Publications/Cell Press/Draft Cell Press/Quantitative Analysis/W10_final.xlsx", sheet("Tabelle1") firstrow clear

#Build EEG_index
egen EEG_index = rowmean(Shortterm_Median Longterm_Median)
egen z_EEG_index = std(EEG_index)

#Build average of Scope1 emissions (Scope1_avg) and calculate ln
egen Scope1_avg = rowmean(GHGScope1 GHGScope12024 GHGScope12023 GHGScope12022 GHGScope12021)
gen ln_Scope1 = ln(Scope1_avg)

#Build average of Scope 2 emissions (Scope2_avg) and calculate ln
egen Scope2_avg = rowmean (GHGScope2LocBased GHGScope2LocBased2024 GHGScope2LocBased2023 GHGScope2LocBased2022 GHGScope2LocBased2021)
gen ln_Scope2 = ln(Scope2_avg)

#Buid average of CapEx and generate ln
egen Capex_Int = rowmean (CAPEXSales2025 CAPEXSales2024 CAPEXSales2023 CAPEXSales2022 CAPEXSales2021)
gen ln_Capex_Int = ln(Capex_Int)

#Buid average of Debt to Equity ratio
egen D_E = rowmean (DebtEquity2024 DebtEquity DebtEquity2023 DebtEquity2022 DebtEquity2021)

#Buid average of Return on Assets
egen ROA_average = rowmean (ROA2025 ROA2024 ROA2023 ROA2022 ROA2021)

#Regression with vce(hc3)
reg ln_Capex_Int EEG_index ln_Scope1 ln_Scope2 D_E ROA_avg, vce(hc3)

#Bootstrap regression
bootstrap, reps(5000): reg ln_Capex_Int EEG_index ln_Scope1 ln_Scope2 D_E ROA_avg

#Jackknife Test
jackknife, nodots: reg ln_Capex_Int EEG_index ln_Scope1 ln_Scope2 D_E ROA_avg

#VIF Test
reg ln_Capex_Int EEG_index ln_Scope1 ln_Scope2 D_E ROA_avg
vif

#Shapiro Wilk Test
reg ln_Capex_Int EEG_index ln_Scope1 ln_Scope2 D_E ROA_avg
swilk resid

