Project : Quakes

Description of the project # In the given dataset, there are 5 variables: Latitude, Longitude, Depth, Magnitude, Number of stations reporting. we have 1000 observations in the given file.

Which number of stations have maximum depth? and maximum magnitude?

Let us investigate

Step 1: load the data

data("quakes")
View(quakes)
str(quakes)
## 'data.frame':    1000 obs. of  5 variables:
##  $ lat     : num  -20.4 -20.6 -26 -18 -20.4 ...
##  $ long    : num  182 181 184 182 182 ...
##  $ depth   : int  562 650 42 626 649 195 82 194 211 622 ...
##  $ mag     : num  4.8 4.2 5.4 4.1 4 4 4.8 4.4 4.7 4.3 ...
##  $ stations: int  41 15 43 19 11 12 43 15 35 19 ...
library(ggplot2)

Step2: Ensure you have a right package for the project analysis- ggplot2

Step 3: Scatter plot

ggplot(data=quakes, aes(x=mag, y=stations)) + geom_point()

Step 4: Now, we can add ‘clarity’ variable as color

ggplot (data=quakes, aes(x=mag, y=stations, color= depth)) + geom_point()

Step 5: The scatter plot has got many clumsy points and not so clear

ggplot (data =quakes ,aes(x=mag, y= stations,color= depth))+ geom_point()

Step 6: It seems to be clear but scatter plot is having all the records irrespective of significant and non significant.

ggplot(data = quakes[quakes$depth <1,], aes(x=mag, y=stations, color=depth)) + geom_point()

ggplot(data = quakes[quakes$depth >0,], aes(x=mag, y=stations, color=depth)) + geom_point()

Step 7: To see the averages for variable ‘depth’ let us run the following line

ggplot (data = quakes[quakes$depth <1,], aes(x=mag, y=stations, color=depth )) + geom_point() + geom_smooth()

ggplot (data = quakes[quakes$depth >0,], aes(x=mag, y=stations, color=depth )) + geom_point() + geom_smooth()
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: The following aesthetics were dropped during statistical transformation: colour
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

Conclusion:
1.In this plot we can see that the most number of stations have been collapsed due to earthquake
2.From this visual we can see that maximum stations has the highest magnitude with minimum depth.
3.0-50 number of stations have 4.0-5.0 magnitude with maximum depth.