• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 21 pages
Exam (elaborations)

ISYE 6402 Homework 4 Questions and Answers

Document preview thumbnail
Preview 3 out of 21 pages

ISYE 6402 Homework 4 Questions and Answers

Content preview

2/14/25, 12:02 AM ISYE 6402 Homework 4




ISYE 6402 Homework 4
Background
For this data analysis, you will analyze the daily and weekly domestic passenger count arriving in Hawaii airports.
File DailyDomestic.csv contains the daily number of passengers between May 2019 and February 2023 File
WeeklyDomestic.csv contains the weekly number of passengers for the same time period. Here we will use
diferent ways of ftting the ARIMA model while dealing with trend and seasonality.

library(lubridate)
library(mgcv)
library(tseries)
library(car)



Instructions on reading the data
To read the data in R , save the fle in your working directory (make sure you have changed the directory if
diferent from the R working directory) and read the data using the R function read.csv()

daily <- read.csv("DailyDomestic.csv", head = TRUE)
daily$date <- as.Date(daily$date)
weekly <- read.csv("WeeklyDomestic.csv", head = TRUE)
weekly$week <- as.Date(weekly$week)



Question 1. Trend and seasonality estimation
1a. Plot the daily and weekly domestic passenger count separately. Do you see a strong trend and seasonality?

# plot daily time series
daily_ts = ts(daily$domestic, start= decimal_date(ymd("2019-05-01")) , frequency = 365)
ts.plot(daily_ts, ylab="domestic_passenger_count", main="Daily Data")




1/21

,2/14/25, 12:02 AM ISYE 6402 Homework 4




# plot weekly time series
weekly_ts = ts(weekly$domestic, start= decimal_date(ymd("2019 -05-05")) , frequency = 52)
ts.plot(weekly_ts, ylab="domestic_passenger_count", main="Weekly Data")




Response

There seem to be some strong seasonality There are cyclical patterns with roughly yearly cycle. There are 2
roughly 2 peaks: one at the beginning of the year, the other at the end of the year. There is a slight upward trend
observed as well, but the trend is not strong.
1b. (Trend and seasonality) Fit the weekly domestic passenger count with a non-parametric trend using splines
and monthly seasonality using ANOVA. Is the seasonality signifcant? Plot the ftted values together with the
original time series. Plot the residuals and the ACF of the residuals. Comment on how the model fts and on the
2/21

, 2/14/25, 12:02 AM ISYE 6402 Homework 4

appropriateness of the stationarity assumption of the residuals.

# x-axis points converted to 0-1 scale, common in nonparametric
regression time.pts = c(1:length(weekly_ts))
time.pts = c(time.pts - min(time.pts))/max(time.pts)

# splines Trend Estimation
weekly_month <- as.factor(month(weekly$week))
weekly.gam.fit = gam(weekly_ts~s(time.pts)+weekly_month)
weekly_ts.fit.gam = ts(fitted(weekly.gam.fit), start=decimal_date(ymd("2019-05-
05")),fre quency=52)
ts.plot(weekly_ts, ylab="domestic_passenger_count")
lines(weekly_ts.fit.gam, lwd=2, col = 'purple')




# calculate residual
weekly_ts.dif.gam = ts((weekly_ts - weekly_ts.fit.gam), start=decimal_date(ymd("2019-
05-05")),frequency=52)

# plot residual
ts.plot(weekly_ts.dif.gam,ylab="residual")




3/21

Document information

Uploaded on
October 2, 2025
Number of pages
21
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TutorExpert
3.7
(80)
Sold
611
Followers
314
Items
10997
Last sold
2 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions