Wednesday, November 8, 2023

Module #12 Assignment


Module #18 Assignment


R's plot() function can be used to show the data. You can plot the values from each year separately or overlay them for comparison because you have data from two years.


credit_card_data <- data.frame(

  Month = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),

  Year_2012 = c(31.9, 27, 31.3, 31, 39.4, 40.7, 42.3, 49.5, 45, 50, 50.9, 58.5),

  Year_2013 = c(39.4, 36.2, 40.5, 44.6, 46.8, 44.7, 52.2, 54, 48.8, 55.8, 58.7, 63.4)

)

plot(credit_card_data$Month, credit_card_data$Year_2012, type = "l", col = "blue", ylim = range(credit_card_data$Year_2012, credit_card_data$Year_2013), xlab = "Month", ylab = "Credit Card Charges", main = "Credit Card Charges Over Time")

lines(credit_card_data$Month, credit_card_data$Year_2013, col = "red")

legend("topright", legend = c("2012", "2013"), col = c("blue", "red"), lty = 1)



b. The R ets() function, which stands for error, trend, and seasonality, can be used for the Exponential Smoothing Model. This is a basic example:

ts_data <- ts(cbind(credit_card_data$Year_2012, credit_card_data$Year_2013), start = c(2012, 1), frequency = 12)

model <- ets(ts_data)

summary(model)


c. You can see how credit card charges have changed over the course of the months in both years by looking at the time series plot. The fitted model's characteristics, such as the error, trend, and seasonality components, are detailed in the Exponential Smoothing Model summary. You can talk about any conclusions you draw from the time series plot, including trends, patterns, and insights. Furthermore, by using the patterns found in the findings of the Exponential Smoothing Model, you can forecast future credit card charges and gain insight into the underlying elements.

No comments:

Post a Comment

“Ethical Concerns on the Deployment of Self-driving Cars”: A Policy and Ethical Case Study Analysis

Alec Gremer University of South Florida LIS4414.001U23.50440 Information Policy and Ethics Dr. John N. Gathegi, June 12th, 2023 “The Ethical...