R project folder on github
Identify any relationship between food items price change and 1) COVID-19 cases, 2) Afghanistan government fall (in 2021)
All the datasets are downloaded from HDX, they are publicly available and expected they should already be cleaned and validated by organizations who own them. As per business task, we’d need two different datasets, 1) Afghanistan COVID-19 dataset, 2) Joing Market Monitoring Initiative (JMMI) dataset.
Important! There was no data available for the month of March, 2021 in JMMI datasets, so that month is ignored.
Both datasets seem clean and publicly pubished. I just have done few modification to make it easier to deal with them.Please note, that all the modification except file renaming done by R coding, so it handles by itself - you don’t need to worry.
I’ve done some exploratory data analysis to better understand my datasets, then plotted them to see if there is any relationship between these two indicators. The findings show that there is quite obvious positive relationship between food price change and 1) COVID-19 cases, and 2) Taliban take over.
#To see if there is any relationship between food item price change and COVID cases change
price_vs_covid %>% ggplot(aes(x = cases_avg, y = food_items_avg))+
geom_point()+
geom_smooth(method = 'lm', se = F)+
labs(title = "Relationship between COVID and food item price change", x = "COVID cases", y = "Food items average price(per kg)")
## `geom_smooth()` using formula 'y ~ x'
#To see if there is any change in food item price in pre and post fall of country
price_vs_collapse %>% ggplot(aes(x = collapse, y = food_items_avg, fill = collapse))+
geom_bar(stat = 'identity', position = 'dodge')+
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 1))+
labs(title = "Collapse impact in Food item price", y = "Food items average price(per kg)", x = "Collapse")
The relationship between food price change and COVID cases seems statistically significant. And it shows that around 50% of the reason of food price change was the COVID-19 pandemic.
##Modeling
#linear regression on food item price and COVID-19 cases
price_mod <- lm(cases_avg ~ food_items_avg, data = price_vs_covid)
summary(price_mod)
##
## Call:
## lm(formula = cases_avg ~ food_items_avg, data = price_vs_covid)
##
## Residuals:
## Min 1Q Median 3Q Max
## -907.2 -772.3 108.7 630.3 1287.8
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4793.56 2398.49 -1.999 0.07673 .
## food_items_avg 112.74 34.29 3.288 0.00941 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 863.7 on 9 degrees of freedom
## Multiple R-squared: 0.5457, Adjusted R-squared: 0.4952
## F-statistic: 10.81 on 1 and 9 DF, p-value: 0.009411
Note: JMMI food items are: