Forest fires, known as wildfires, is a fire in an area of combustible vegetation that occurs in a countryside or rural area. Wildfires can cause damage to the land, the property, the ecosystem, the life in the area, the weather, and much more. For this project, I got the data from https://www.datazar.com/file/f1e113f1b-dab5-47c2-ad4b-c8ca08adca5c, I then copied and pasted the data into a text file. From there I converted it to excel file, then imported it into R
library(readxl)
df <- read_excel("C:/Documents/My Excel/Forestfires.xlsx")
forestfire<-df[,-c(1:2)]
head(forestfire)
## # A tibble: 6 x 11
## month day FFMC DMC DC ISI temp RH wind rain area
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 mar fri 86.2 26.2 94.3 5.1 8.2 51 6.7 0 0
## 2 oct tue 90.6 35.4 669. 6.7 18 33 0.9 0 0
## 3 oct sat 90.6 43.7 687. 6.7 14.6 33 1.3 0 0
## 4 mar fri 91.7 33.3 77.5 9 8.3 97 4 0.2 0
## 5 mar sun 89.3 51.3 102. 9.6 11.4 99 1.8 0 0
## 6 aug sun 92.3 85.3 488 14.7 22.2 29 5.4 0 0
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
The reason for me doing this is because I want to see a total amount with regards to month and day so I can get a good feeling about the frequency of forest fires and when we can expect to have the most forest fires
unique(forestfire$month)
## [1] "mar" "oct" "aug" "sep" "apr" "jun" "jul" "feb" "jan" "dec" "may"
## [12] "nov"
Looks like there were forest fires occuring each month; however, the frequency varies per month
summary(dplyr::filter(forestfire,month=='jan'))
## month day FFMC DMC
## Length:2 Length:2 Min. :18.70 Min. :1.10
## Class :character Class :character 1st Qu.:34.55 1st Qu.:1.75
## Mode :character Mode :character Median :50.40 Median :2.40
## Mean :50.40 Mean :2.40
## 3rd Qu.:66.25 3rd Qu.:3.05
## Max. :82.10 Max. :3.70
## DC ISI temp RH
## Min. : 9.30 Min. :0.000 Min. :5.200 Min. : 78.0
## 1st Qu.: 49.83 1st Qu.:0.725 1st Qu.:5.225 1st Qu.: 83.5
## Median : 90.35 Median :1.450 Median :5.250 Median : 89.0
## Mean : 90.35 Mean :1.450 Mean :5.250 Mean : 89.0
## 3rd Qu.:130.88 3rd Qu.:2.175 3rd Qu.:5.275 3rd Qu.: 94.5
## Max. :171.40 Max. :2.900 Max. :5.300 Max. :100.0
## wind rain area
## Min. :0.90 Min. :0 Min. :0
## 1st Qu.:1.45 1st Qu.:0 1st Qu.:0
## Median :2.00 Median :0 Median :0
## Mean :2.00 Mean :0 Mean :0
## 3rd Qu.:2.55 3rd Qu.:0 3rd Qu.:0
## Max. :3.10 Max. :0 Max. :0
summary(dplyr::filter(forestfire,month=='feb'))
## month day FFMC DMC
## Length:20 Length:20 Min. :68.20 Min. : 3.200
## Class :character Class :character 1st Qu.:83.90 1st Qu.: 4.825
## Mode :character Mode :character Median :84.40 Median : 8.100
## Mean :82.91 Mean : 9.475
## 3rd Qu.:85.05 3rd Qu.:10.425
## Max. :86.90 Max. :27.500
## DC ISI temp RH
## Min. : 15.30 Min. :0.80 Min. : 4.200 Min. :35.00
## 1st Qu.: 24.62 1st Qu.:2.10 1st Qu.: 6.350 1st Qu.:45.25
## Median : 43.00 Median :3.05 Median : 8.800 Median :52.00
## Mean : 54.67 Mean :3.35 Mean : 9.635 Mean :55.70
## 3rd Qu.: 53.35 3rd Qu.:3.95 3rd Qu.:13.000 3rd Qu.:68.00
## Max. :353.50 Max. :7.70 Max. :15.700 Max. :82.00
## wind rain area
## Min. :0.900 Min. :0 Min. : 0.000
## 1st Qu.:2.100 1st Qu.:0 1st Qu.: 0.000
## Median :3.100 Median :0 Median : 0.550
## Mean :3.755 Mean :0 Mean : 6.275
## 3rd Qu.:5.400 3rd Qu.:0 3rd Qu.: 6.495
## Max. :9.400 Max. :0 Max. :51.780
summary(dplyr::filter(forestfire,month=='mar'))
## month day FFMC DMC
## Length:54 Length:54 Min. :69.00 Min. : 2.40
## Class :character Class :character 1st Qu.:88.10 1st Qu.:24.35
## Mode :character Mode :character Median :90.10 Median :35.80
## Mean :89.44 Mean :34.54
## 3rd Qu.:91.62 3rd Qu.:48.30
## Max. :93.40 Max. :52.20
## DC ISI temp RH
## Min. : 15.50 Min. : 0.700 Min. : 5.30 Min. :18.0
## 1st Qu.: 65.42 1st Qu.: 5.000 1st Qu.:11.05 1st Qu.:27.0
## Median : 80.80 Median : 7.800 Median :13.30 Median :36.5
## Mean : 75.94 Mean : 7.107 Mean :13.08 Mean :40.0
## 3rd Qu.: 97.80 3rd Qu.: 9.000 3rd Qu.:15.43 3rd Qu.:46.0
## Max. :103.80 Max. :12.500 Max. :18.80 Max. :99.0
## wind rain area
## Min. :0.900 Min. :0.000000 Min. : 0.000
## 1st Qu.:4.000 1st Qu.:0.000000 1st Qu.: 0.000
## Median :5.150 Median :0.000000 Median : 0.000
## Mean :4.969 Mean :0.003704 Mean : 4.357
## 3rd Qu.:5.800 3rd Qu.:0.000000 3rd Qu.: 3.018
## Max. :9.400 Max. :0.200000 Max. :36.850
summary(dplyr::filter(forestfire,month=='apr'))
## month day FFMC DMC
## Length:9 Length:9 Min. :81.50 Min. : 3.00
## Class :character Class :character 1st Qu.:81.90 1st Qu.: 9.10
## Mode :character Mode :character Median :86.30 Median :14.60
## Mean :85.79 Mean :15.91
## 3rd Qu.:88.00 3rd Qu.:23.30
## Max. :91.00 Max. :27.40
## DC ISI temp RH
## Min. : 7.90 Min. : 2.300 Min. : 5.80 Min. :20.00
## 1st Qu.:25.60 1st Qu.: 2.700 1st Qu.: 9.30 1st Qu.:33.00
## Median :43.50 Median : 3.700 Median :13.40 Median :51.00
## Mean :48.56 Mean : 5.378 Mean :12.04 Mean :46.89
## 3rd Qu.:55.20 3rd Qu.: 5.100 3rd Qu.:15.20 3rd Qu.:54.00
## Max. :97.10 Max. :12.300 Max. :17.60 Max. :75.00
## wind rain area
## Min. :1.800 Min. :0 Min. : 0.000
## 1st Qu.:3.100 1st Qu.:0 1st Qu.: 0.000
## Median :4.500 Median :0 Median : 0.000
## Mean :4.667 Mean :0 Mean : 8.891
## 3rd Qu.:5.800 3rd Qu.:0 3rd Qu.: 4.610
## Max. :9.400 Max. :0 Max. :61.130
summary(dplyr::filter(forestfire,month=='may'))
## month day FFMC DMC
## Length:2 Length:2 Min. :85.10 Min. :25.40
## Class :character Class :character 1st Qu.:86.22 1st Qu.:26.05
## Mode :character Mode :character Median :87.35 Median :26.70
## Mean :87.35 Mean :26.70
## 3rd Qu.:88.47 3rd Qu.:27.35
## Max. :89.60 Max. :28.00
## DC ISI temp RH
## Min. : 73.70 Min. :3.50 Min. :11.30 Min. :40.0
## 1st Qu.: 83.72 1st Qu.:4.05 1st Qu.:12.97 1st Qu.:53.5
## Median : 93.75 Median :4.60 Median :14.65 Median :67.0
## Mean : 93.75 Mean :4.60 Mean :14.65 Mean :67.0
## 3rd Qu.:103.78 3rd Qu.:5.15 3rd Qu.:16.32 3rd Qu.:80.5
## Max. :113.80 Max. :5.70 Max. :18.00 Max. :94.0
## wind rain area
## Min. :4.000 Min. :0 Min. : 0.00
## 1st Qu.:4.225 1st Qu.:0 1st Qu.: 9.62
## Median :4.450 Median :0 Median :19.24
## Mean :4.450 Mean :0 Mean :19.24
## 3rd Qu.:4.675 3rd Qu.:0 3rd Qu.:28.86
## Max. :4.900 Max. :0 Max. :38.48
summary(dplyr::filter(forestfire,month=='jun'))
## month day FFMC DMC
## Length:17 Length:17 Min. :53.40 Min. : 49.50
## Class :character Class :character 1st Qu.:90.40 1st Qu.: 71.00
## Mode :character Mode :character Median :91.10 Median : 93.30
## Mean :89.43 Mean : 93.38
## 3rd Qu.:93.10 3rd Qu.: 96.30
## Max. :94.30 Max. :180.40
## DC ISI temp RH
## Min. :200.0 Min. : 0.40 Min. :10.60 Min. :25.00
## 1st Qu.:233.8 1st Qu.: 7.10 1st Qu.:19.10 1st Qu.:38.00
## Median :297.7 Median : 7.50 Median :20.70 Median :40.00
## Mean :297.7 Mean :11.78 Mean :20.49 Mean :45.12
## 3rd Qu.:316.7 3rd Qu.:12.70 3rd Qu.:23.20 3rd Qu.:46.00
## Max. :433.3 Max. :56.10 Max. :28.00 Max. :90.00
## wind rain area
## Min. :1.300 Min. :0 Min. : 0.000
## 1st Qu.:2.700 1st Qu.:0 1st Qu.: 0.000
## Median :4.500 Median :0 Median : 0.000
## Mean :4.135 Mean :0 Mean : 5.841
## 3rd Qu.:4.900 3rd Qu.:0 3rd Qu.: 3.190
## Max. :9.400 Max. :0 Max. :70.320
summary(dplyr::filter(forestfire,month=='jul'))
## month day FFMC DMC
## Length:32 Length:32 Min. :79.50 Min. : 48.30
## Class :character Class :character 1st Qu.:90.55 1st Qu.: 85.15
## Mode :character Mode :character Median :91.60 Median :102.60
## Mean :91.33 Mean :110.39
## 3rd Qu.:93.20 3rd Qu.:119.20
## Max. :94.60 Max. :263.10
## DC ISI temp RH
## Min. :296.3 Min. : 1.500 Min. :12.60 Min. :22.00
## 1st Qu.:407.6 1st Qu.: 7.100 1st Qu.:18.15 1st Qu.:30.75
## Median :441.5 Median : 9.000 Median :23.15 Median :40.00
## Mean :450.6 Mean : 9.394 Mean :22.11 Mean :45.12
## 3rd Qu.:474.9 3rd Qu.:11.225 3rd Qu.:24.93 3rd Qu.:53.00
## Max. :795.9 Max. :16.800 Max. :30.20 Max. :90.00
## wind rain area
## Min. :0.900 Min. :0.00000 Min. : 0.000
## 1st Qu.:2.100 1st Qu.:0.00000 1st Qu.: 0.000
## Median :3.600 Median :0.00000 Median : 1.035
## Mean :3.734 Mean :0.00625 Mean : 14.370
## 3rd Qu.:4.900 3rd Qu.:0.00000 3rd Qu.: 6.367
## Max. :8.000 Max. :0.20000 Max. :278.530
summary(dplyr::filter(forestfire,month=='aug'))
## month day FFMC DMC
## Length:184 Length:184 Min. :63.50 Min. : 47.9
## Class :character Class :character 1st Qu.:91.40 1st Qu.:111.2
## Mode :character Mode :character Median :92.10 Median :145.4
## Mean :92.34 Mean :153.7
## 3rd Qu.:94.53 3rd Qu.:181.3
## Max. :96.20 Max. :273.8
## DC ISI temp RH
## Min. :100.7 Min. : 0.800 Min. : 5.10 Min. :19.00
## 1st Qu.:604.3 1st Qu.: 7.775 1st Qu.:18.90 1st Qu.:33.75
## Median :647.1 Median :10.600 Median :21.25 Median :42.00
## Mean :641.1 Mean :11.072 Mean :21.63 Mean :45.49
## 3rd Qu.:685.6 3rd Qu.:14.100 3rd Qu.:24.23 3rd Qu.:56.00
## Max. :819.1 Max. :22.700 Max. :33.30 Max. :96.00
## wind rain area
## Min. :0.400 Min. :0.0000 Min. : 0.000
## 1st Qu.:2.700 1st Qu.:0.0000 1st Qu.: 0.000
## Median :4.000 Median :0.0000 Median : 0.545
## Mean :4.086 Mean :0.0587 Mean : 12.489
## 3rd Qu.:4.900 3rd Qu.:0.0000 3rd Qu.: 5.027
## Max. :8.900 Max. :6.4000 Max. :746.280
summary(dplyr::filter(forestfire,month=='sep'))
## month day FFMC DMC
## Length:172 Length:172 Min. :50.40 Min. : 46.2
## Class :character Class :character 1st Qu.:91.00 1st Qu.: 91.8
## Mode :character Mode :character Median :92.10 Median :117.9
## Mean :91.24 Mean :120.9
## 3rd Qu.:92.50 3rd Qu.:130.1
## Max. :94.30 Max. :291.3
## DC ISI temp RH
## Min. :665.3 Min. : 0.400 Min. : 9.80 Min. :15.00
## 1st Qu.:692.6 1st Qu.: 7.000 1st Qu.:17.27 1st Qu.:32.75
## Median :728.6 Median : 8.100 Median :19.60 Median :40.00
## Mean :734.6 Mean : 8.577 Mean :19.61 Mean :42.84
## 3rd Qu.:764.0 3rd Qu.: 9.600 3rd Qu.:22.15 3rd Qu.:51.00
## Max. :860.6 Max. :22.600 Max. :30.20 Max. :86.00
## wind rain area
## Min. :0.900 Min. :0 Min. : 0.00
## 1st Qu.:2.200 1st Qu.:0 1st Qu.: 0.00
## Median :3.350 Median :0 Median : 1.36
## Mean :3.558 Mean :0 Mean : 17.94
## 3rd Qu.:4.500 3rd Qu.:0 3rd Qu.: 7.56
## Max. :7.600 Max. :0 Max. :1090.84
summary(dplyr::filter(forestfire,month=='oct'))
## month day FFMC DMC
## Length:15 Length:15 Min. :84.90 Min. :32.80
## Class :character Class :character 1st Qu.:90.60 1st Qu.:36.65
## Mode :character Mode :character Median :90.60 Median :43.70
## Mean :90.45 Mean :41.42
## 3rd Qu.:91.70 3rd Qu.:46.50
## Max. :92.60 Max. :48.50
## DC ISI temp RH
## Min. :664.2 Min. : 3.000 Min. :11.30 Min. :24.00
## 1st Qu.:671.5 1st Qu.: 5.950 1st Qu.:15.65 1st Qu.:29.50
## Median :686.9 Median : 6.700 Median :16.80 Median :35.00
## Mean :681.7 Mean : 7.147 Mean :17.09 Mean :37.47
## 3rd Qu.:691.8 3rd Qu.: 8.800 3rd Qu.:18.75 3rd Qu.:45.50
## Max. :696.1 Max. :11.100 Max. :21.70 Max. :60.00
## wind rain area
## Min. :0.90 Min. :0 Min. : 0.000
## 1st Qu.:2.70 1st Qu.:0 1st Qu.: 0.000
## Median :4.00 Median :0 Median : 0.000
## Mean :3.46 Mean :0 Mean : 6.638
## 3rd Qu.:4.50 3rd Qu.:0 3rd Qu.: 6.135
## Max. :5.40 Max. :0 Max. :49.370
summary(dplyr::filter(forestfire,month=='nov'))
## month day FFMC DMC
## Length:1 Length:1 Min. :79.5 Min. :3
## Class :character Class :character 1st Qu.:79.5 1st Qu.:3
## Mode :character Mode :character Median :79.5 Median :3
## Mean :79.5 Mean :3
## 3rd Qu.:79.5 3rd Qu.:3
## Max. :79.5 Max. :3
## DC ISI temp RH wind
## Min. :106.7 Min. :1.1 Min. :11.8 Min. :31 Min. :4.5
## 1st Qu.:106.7 1st Qu.:1.1 1st Qu.:11.8 1st Qu.:31 1st Qu.:4.5
## Median :106.7 Median :1.1 Median :11.8 Median :31 Median :4.5
## Mean :106.7 Mean :1.1 Mean :11.8 Mean :31 Mean :4.5
## 3rd Qu.:106.7 3rd Qu.:1.1 3rd Qu.:11.8 3rd Qu.:31 3rd Qu.:4.5
## Max. :106.7 Max. :1.1 Max. :11.8 Max. :31 Max. :4.5
## rain area
## Min. :0 Min. :0
## 1st Qu.:0 1st Qu.:0
## Median :0 Median :0
## Mean :0 Mean :0
## 3rd Qu.:0 3rd Qu.:0
## Max. :0 Max. :0
summary(dplyr::filter(forestfire,month=='dec'))
## month day FFMC DMC
## Length:9 Length:9 Min. :84.00 Min. :25.40
## Class :character Class :character 1st Qu.:84.60 1st Qu.:25.40
## Mode :character Mode :character Median :85.40 Median :25.40
## Mean :84.97 Mean :26.12
## 3rd Qu.:85.40 3rd Qu.:26.70
## Max. :85.40 Max. :27.80
## DC ISI temp RH
## Min. :349.7 Min. :2.000 Min. :2.200 Min. :21.00
## 1st Qu.:349.7 1st Qu.:2.600 1st Qu.:4.600 1st Qu.:21.00
## Median :349.7 Median :2.600 Median :4.600 Median :24.00
## Mean :351.2 Mean :3.467 Mean :4.522 Mean :38.44
## 3rd Qu.:352.6 3rd Qu.:4.100 3rd Qu.:5.100 3rd Qu.:59.00
## Max. :354.6 Max. :6.800 Max. :5.100 Max. :61.00
## wind rain area
## Min. :4.900 Min. :0 Min. : 5.38
## 1st Qu.:8.000 1st Qu.:0 1st Qu.: 9.27
## Median :8.500 Median :0 Median :10.73
## Mean :7.644 Mean :0 Mean :13.33
## 3rd Qu.:8.500 3rd Qu.:0 3rd Qu.:17.85
## Max. :8.500 Max. :0 Max. :24.77
data<-data.frame(x=c('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'),y=c(2,20,54,9,2,17,32,284,172,15,1,9))
barplot(data$y,names.arg = data$x,ylim=c(0,180), ylab="Frequency of forest fires", xlab="Month")
Looking at the summary results, per month, I found that there were more forest fires occuring during September, August, and march with occurences of 172, 184, and 54. I think the reason for August and September having the most fires is because those months are the peak of summer season, and thus the weather get hot and humid which is very prone for trees to catch fire. All other months had occurences of less than 20 fires. November through January is when there was the absolute lowest frequency of forest fires. I believe the reason is because of the winter season. The weather is so cold that there is absolutely no chance of a forest fire occuring, since the snow and cold weather can easily extinguish the fire.
I’m using linear regression to see if there is a relationship between Fine Fuel Moisture Code to the other variables which include: ,DMC,DC,ISI,temp,RH,wind,rain, and area. The regression equation, given by the formula \(y=x_{1}+x_{2}+.....+x_{N-1}+x_N\) where \(x_N\) represents the total number of independant variables. For this, I want to see how other variables can effect FFMC. Usually, FFMC is the most important variable because it is a numeric rating of the moisture content of litter and other fine fuels. The higher the value is, the more flammable and likely it is to ignite, which is why I chose FFMC as the dependant variable
attach(forestfire)
FFMC<-lm(FFMC~DMC+DC+ISI+temp+RH+wind+rain+area)
summary(FFMC)
##
## Call:
## lm(formula = FFMC ~ DMC + DC + ISI + temp + RH + wind + rain +
## area)
##
## Residuals:
## Min 1Q Median 3Q Max
## -59.884 -0.850 0.494 1.716 7.958
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 88.1670104 1.4332143 61.517 < 2e-16 ***
## DMC 0.0205418 0.0043961 4.673 3.81e-06 ***
## DC 0.0016565 0.0010908 1.519 0.129
## ISI 0.5093626 0.0466887 10.910 < 2e-16 ***
## temp -0.0394974 0.0528843 -0.747 0.455
## RH -0.0961427 0.0153178 -6.277 7.43e-10 ***
## wind -0.0780952 0.1121663 -0.696 0.487
## rain 0.7556544 0.6488335 1.165 0.245
## area -0.0001051 0.0029790 -0.035 0.972
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.273 on 508 degrees of freedom
## Multiple R-squared: 0.4101, Adjusted R-squared: 0.4008
## F-statistic: 44.15 on 8 and 508 DF, p-value: < 2.2e-16
From the results that obtained about the regression model, I can conclude that the model isn’t that accurate because \(R^2 = 0.4008\). I think a possible reason is because looking at the plot above which displays frequency of fires vs. month. I can see that there were more forest fires happening during March compared to June and July, both of which are in the summer season. As a result, this caused the linear model to be less and less accurate since it’s slightly harder to predict the certain trend in the forest fire. I think a possible explanation for this is that March is closer to spring, which is where temperature/weather/climate tends to change dramatically, therefore there a shift in weather patterns which might impact the ignition sensitivity of the forest trees, thus resulting in fires happening. Again, this is a possible cause but there is no guarantee that my theory is correct.