jlivsey / UB-sping24-time-series

3 stars 1 forks source link

James Livsey #1

Open jlivsey opened 5 months ago

jlivsey commented 5 months ago
library(seasonal)
m <- seas(AirPassengers)
tsbox::ts_plot(tsbox::ts_c(AirPassengers, final(m)))

Created on 2024-01-30 with reprex v2.0.2

jlivsey commented 5 months ago

First attempt to forecast the weekly initial claims data. I will use the Facebook Prophet.

library(tidyverse)
library(prophet)
library(fredr)

icnsa = fredr(series_id = "ICNSA")

df <- icnsa |>
  select(ds = date, y = value)

m <- prophet(df)
#> Disabling weekly seasonality. Run prophet with weekly.seasonality=TRUE to override this.
#> Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.
future <- make_future_dataframe(m, periods = 1)

forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
#>              ds     yhat yhat_lower yhat_upper
#> 2973 2023-12-23 487058.3   184576.5   791642.2
#> 2974 2023-12-30 544926.0   228351.7   843077.8
#> 2975 2024-01-06 593973.3   294475.9   904214.0
#> 2976 2024-01-13 593983.0   275790.2   904047.3
#> 2977 2024-01-20 539374.0   227671.7   835698.4
#> 2978 2024-01-21 528947.1   232701.8   844609.6

Created on 2024-01-31 with reprex v2.0.2

So I forecast the new data release value will be 528947.1 with confidence interval (232701.8, 844609.6)

jlivsey commented 5 months ago

Released forecast was 261,029. Error in my point forecast was 528947.1 - 261029 = 267918.1

vgunturi commented 5 months ago

Released forecast was 261,029. Error in my point forecast was 261,029 - 209106 = 51,923

jlivsey commented 5 months ago

My select student function

select_student <- function(n = 1){
  names_vector <- c("Bedarkar", "Peduru", "Kadiri", "Markunda", "Anand", 
                    "Bhardwaj", "Soni", "Patra", "Maru", "Singh", 
                    "Jaskirat Singh", "Gangu", "Vadhiya", "Kulkarni", 
                    "Samala", "Sarbhai", "Tiwari", "Bhupathiraju", 
                    "Gadhave", "Haveliwala", "Chandrasekar", "Hatote", 
                    "Ghosh", "Prasannan", "Pawar", "Kaveti", "Gudimetla", 
                    "Gunturi", "Yerriboina", "Patil")
  sample(names_vector, n, replace = FALSE)
}
jlivsey commented 4 months ago

A place to document forecasts Google Sheet