Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_144')
library(outliers)  

Question 5.1: Using crime data from http://www.statsci.org/data/general/uscrime.txt (description at http://www.statsci.org/data/general/uscrime.html), test to see whether there is an outlier in the last column (number of crimes per 100,000 people). Is the lowest-crime city an outlier? Is the highest-crime city an outlier? Use the grubbs.test function in the outliers package in R

crime_df = read.table("C:\\Users\\vabhagat\\Downloads\\uscrime.txt", header= TRUE, stringsAsFactors = F) 
head(crime_df)

10 is a test for one outlier (side is detected automatically and can be reversed by opposite parameter). 11 is a test for two outliers on opposite tails, 20 is test for two outliers in one tail. Therefore, I chose type = 11

grubbs.test(crime_df[,16], type = 11, opposite = FALSE, two.sided = FALSE )
## 
##  Grubbs test for two opposite outliers
## 
## data:  crime_df[, 16]
## G = 4.26880, U = 0.78103, p-value = 1
## alternative hypothesis: 342 and 1993 are outliers

Since p-value = 1,both the highest and lowest values in the “Crime” column are within the expected standard of deviation and are not outliers.

Question 6.1: Describe a situation or problem from your job, everyday life, current events, etc., for which a Change Detection model would be appropriate. Applying the CUSUM technique, how would you choose the critical value and the threshold?

Where I live there has been cooler than average temperatures for the last two weeks. The drop has been significant enough that I have considered getting my winter clothes out of storage and putting away my summer wardrobe. Since I have limited closet space, this is an either/or type of situation and requires a significant enough time investment that I don’t want to make the mistake of putting warm-weather clothes away too early. It would be good to know if these cooler temperatures are just outliers (or a result of the outlier that is Hurricane Florence) or if they will be sustained. I would choose the Threshold based on average low temperatures for this time of year in my city and a critical value that is relatively large so that my model would be less sensitive to changes given the high variability of weather and wanting to avoid a false positive (deciding to put away summer clothes too early) more.

Question 4.1: Using July through October daily-high-temperature data for Atlanta for 1996 through 2015, use a CUSUM approach to identify when unofficial summer ends (i.e., when the weather starts cooling off) each year. You can get the data that you need from the file temps.txt or online, for example at http://www.iweathernet.com/atlanta-weather-records or https://www.wunderground.com/history/airport/KFTY/2015/7/1/CustomHistory.html . You can use R if you’d like, but it’s straightforward enough that an Excel spreadsheet can easily do the job too.

Please refer to the excel attached on the portal.

St = MAX(0,St(previous day)+([temp on day(x)/year(y)] - Mu - C)) Mu = 83.34 This is the average temperature across all days and years in the dataset

Based on Plot 1, it appears that the weather change happens towards the end of Aug.

Question 6.2: Use a CUSUM approach to make a judgment of whether Atlanta’s summer climate has gotten warmer in that time (and if so, when

Please refer to the excel attached on the portal.

Based on plot 2, though there has been variance in temprature over time, but there wasn’t really a pivotal year when the shift started happening.