forked from datasci-harris/DAP2-final-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.R
More file actions
21 lines (16 loc) · 805 Bytes
/
model.R
File metadata and controls
21 lines (16 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## REGRESSION MODEL
# Prepare data for regression
regression_data <- merged_data %>%
left_join(co2_data, by = c("country" = "Country")) %>%
mutate(
Share_of_World = as.numeric(sub("%", "", Share_of_World)) / 100, # Convert percentage to decimal
total_financing = mitigation_finance + adaptation_finance # Calculate total financing
) %>%
select(country, total_financing, renewable_energy, co2_emissions, Share_of_World) %>%
filter(!is.na(total_financing), !is.na(renewable_energy), !is.na(co2_emissions))
# Regression model for Renewable Energy
model_renewable <- lm(renewable_energy ~ total_financing, data = regression_data)
summary(model_renewable)
# Regression model for CO2 Emissions
model_co2 <- lm(co2_emissions ~ total_financing, data = regression_data)
summary(model_co2)