# Using GAMs to model time-series-like data

My gym tweets out how many people are in the weight room throughout the day. I have scraped the data and put it into a SQLite database here. I'm interested in using GAMs to model how many people will be in the weight room based on the date.

There are a couple things about the data that should be noted:

1) The observations are not evenly spaced. They gym tries to tweet every half hour, but sometimes goes several hours without a tweet. Even if these long stretches of no observations were filled in, the remaining observations are still not exactly half an hour apart. So far as I understand, this precludes time series methods.

2) There is very strong autocorrelation within days which should be accounted for somehow.

3) The best predictors are likely time of day, day of week, day of month, month of year, and year. I have weather covariate data, but these don't seem to play an appreciable role in predicting usage.

I've tried modelling this data using other methods like boosted trees, but was wondering how GAMs might differ in modelling ability.

Here is some code to get the data into a dataframe

library(tidyverse)
library(DBI)
library(lubridate)
library(mgcv)

connection = dbConnect(RSQLite::SQLite(), 'Western_Tweet_Data.sqlite3')
gym = dbGetQuery(connection,'select created_at, WR from WesternWR union select created_at,WR from HistoricWR')

model.data = gym %>%
mutate(
yr = year(created_at),
mnth = month(created_at, abbr = F, label = T),
day =  mday(created_at),
wday = wday(created_at, abbr = F, label = T),
time = hour(created_at) + minute(created_at)/60
)


Here are my main questions:

1) The usage changes by month and by day of week. Would it be best to account for use using a tensor interaction smooth ti or should I use random effects for month and day of week?

2) How can I account for the autocorrelation within days? I hear gp is a good way to do this for time series data, can I account for the interaction of month and day of week with a gp smooth?

3) If I want to smooth by time and day of month, is it is simple as just adding a s(time) + s(day) in the model equation?

Any tips, especially regarding 1 and 2, would be appreciated.