title: “Corn Production” format: html editor: visual ---
The Impact of Drought on Corn Production and Prices in Iowa.
Drought is a major concern for agricultural production, especially in the Midwest where corn is a significant crop. Iowa is the leading producer of corn in the United States, making it an important state to study the impact of drought on corn production and prices. This research proposal aims to investigate the following:
Ø The historical impact of drought on corn production and prices in Iowa: This study will use historical data on drought and corn production in Iowa to analyze how drought has affected corn production and prices in the past. The analysis will also identify the key factors that contributed to the impact of drought on corn production and prices.
Ø The potential impact of future droughts on corn production in Iowa and prices Iowa: This study will use climate change projections and models to forecast the potential impact of future droughts on corn production and prices in Iowa. The analysis will consider the different scenarios of drought severity and their impact on corn production and prices.
Data Analysis
Here, I have plotted the trend of every variable and then explored the relation between them.
From the analysis , the climate data has a non linear relationship with corn production and hence the linear regression model doesn’t seem to work.
Also, since corn crop cycle is April to October, only these temperatures will be considered for annual metrics.
library(readxl)library(tidyr)library(dplyr)Corn_Prod_Data <-read_csv("C:/Users/aishu/OneDrive/Desktop/Corn Production Data ( Final).csv", skip =1)
Rows: 33 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl (7): Year, Average Temperature (Deg F), Precipitation (Inches), Average ...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Load required packageslibrary(ggplot2)ggplot(Corn_Prod_Data, aes(x = Year)) +geom_line(aes(y =`Average Temperature (Deg F)`, color ="Average Temperature (Deg F)")) +geom_line(aes(y =`Precipitation (Inches)`, color ="Precipitation (Inches)")) +geom_line(aes(y =`Average Palmer Drought Severity Index (PDSI)`, color ="Average Palmer Drought Severity Index (PDSI)")) +labs(x ="Year", y ="Value", color ="Variable") +scale_color_manual(values =c("red", "blue", "green"))
library(ggplot2)ggplot(data =Corn_Prod_Data, aes(x = Year, y =`Average Palmer Drought Severity Index (PDSI)`, group =1)) +geom_line(aes(colour =ifelse(`Average Palmer Drought Severity Index (PDSI)`>=0, "brown", "green"))) +scale_color_manual(values =c("green", "brown"), guide =guide_legend(title ="PDSI")) +labs(x ="Year", y ="Average PDSI", title ="Average Palmer Drought Severity Index (PDSI)", subtitle ="The Palmer Drought Severity Index (PDSI) is a standardized index that generally spans -10 (dry) to +10 (wet).") +theme_bw() +theme(plot.title =element_text(size =14, face ="bold"),plot.subtitle =element_text(size =12),legend.position ="bottom") +geom_hline(yintercept =0, linetype ="dashed")
library(ggplot2)# create scatter plotggplot(Corn_Prod_Data, aes(x = Year, y =`Average Temperature (Deg F)`)) +geom_point() +geom_smooth(method ="lm", se =FALSE) +labs(x ="Year", y ="Average Temperature (Deg F)", title ="Average Temperature Trend")
`geom_smooth()` using formula = 'y ~ x'
# create scatter plotggplot(Corn_Prod_Data, aes(x = Year, y =`Precipitation (Inches)`)) +geom_point() +geom_smooth(method ="lm", se =FALSE) +labs(x ="Year", y ="Precipitation (Inches)", title ="Precipitation Trend")
`geom_smooth()` using formula = 'y ~ x'
ggplot(Corn_Prod_Data, aes(x = Year, y =`Yeild (BU/Acre)`)) +geom_line() +ylab("Yield") +scale_y_continuous()
ggplot(Corn_Prod_Data, aes(x = Year, y =`Production (BU)`)) +geom_line() +ylab("Productions(Bu)") +scale_y_continuous()
ggplot(Corn_Prod_Data, aes( x=`Corn Price (USD)`, y =`Production (BU)`)) +geom_point() +geom_smooth(method ="lm", se =FALSE) +xlab("Production") +ylab("Price")
`geom_smooth()` using formula = 'y ~ x'
ggplot(Corn_Prod_Data, aes(x =`Corn Price (USD)`, y =`Yeild (BU/Acre)`)) +geom_point() +geom_smooth(method ="lm", se =FALSE) +xlab("Yield") +ylab("Price")
`geom_smooth()` using formula = 'y ~ x'
# Fit the linear regression modelmodel <-lm(`Production (BU)`~`Average Palmer Drought Severity Index (PDSI)`+`Average Temperature (Deg F)`+`Precipitation (Inches)`, data =Corn_Prod_Data)# Print the model summarysummary(model)
Call:
lm(formula = `Production (BU)` ~ `Average Palmer Drought Severity Index (PDSI)` +
`Average Temperature (Deg F)` + `Precipitation (Inches)`,
data = Corn_Prod_Data)
Residuals:
Min 1Q Median 3Q Max
-1.108e+09 -2.907e+08 -2.385e+07 3.215e+08 6.029e+08
Coefficients:
Estimate Std. Error t value
(Intercept) -1.072e+09 2.189e+09 -0.489
`Average Palmer Drought Severity Index (PDSI)` 2.311e+07 4.595e+07 0.503
`Average Temperature (Deg F)` 6.357e+07 4.593e+07 1.384
`Precipitation (Inches)` 4.515e+06 1.980e+07 0.228
Pr(>|t|)
(Intercept) 0.628
`Average Palmer Drought Severity Index (PDSI)` 0.619
`Average Temperature (Deg F)` 0.177
`Precipitation (Inches)` 0.821
Residual standard error: 426600000 on 29 degrees of freedom
Multiple R-squared: 0.06988, Adjusted R-squared: -0.02634
F-statistic: 0.7262 on 3 and 29 DF, p-value: 0.5446
ggplot(Corn_Prod_Data, aes( x=`Precipitation (Inches)`, y =`Production (BU)`)) +geom_point() +geom_smooth(method ="loess")
`geom_smooth()` using formula = 'y ~ x'
ggplot(Corn_Prod_Data, aes( x=`Average Palmer Drought Severity Index (PDSI)`, y =`Production (BU)`)) +geom_point() +geom_smooth(method ="loess")
`geom_smooth()` using formula = 'y ~ x'
ggplot(Corn_Prod_Data, aes( x=`Average Temperature (Deg F)`, y =`Production (BU)`)) +geom_point() +geom_smooth(method ="loess")