<a name="back_to_top"></a>
# Visualizing and Quantifying Flight Delay Trends in the U.S. Airline Industry
In this repository, we provide an overview of the MATLAB (sections 1-6) script utilized to:
1) Compute the flight delay matrices featured in our work: P (probability), D (delay), E (expected delay), S (Markov transition) and S<sup>n</sup> (stationary distribution).
2) Modify the code to obtain route-specific flight delay information.
Additionally, this repository also provides guidance on how to use and modify the Python (section 7) script utilized to:
3) Calculate route delays based on sequences of flights.
## MATLAB Code
### Table of Contents
1. [ Importing the Datasets ](#importing)
2. [ Building the Flight Delay Matrices ](#building)
3. [ Markov Chain Computations ](#markov)
4. [ Querying Route-specific Data ](#querying)
5. [ Additional Plots ](#additional)
6. [ Storing the Data ](#storing)
7. [ Sequence of Flights Delays ](#sequence)
---
<a name="importing"></a>
### 1: Importing the Datasets
**Description:** In this section of the code, the two datasets utilized in this work are imported. These are:
* 'Delay Data.xlsx' (the version utilized in this work can be found on this [online](https://mitprod-my.sharepoint.com/:f:/g/personal/andyeske_mit_edu/El17ZquVEvNIqZzj7RC4w_QBmxD9QLxfptm6CgCZwRF65Q?e=T1Ckal) folder). This datatable contained information about every flight operated in the United States during January of 2023.
* 'Tail Number.xlsm' (the version utilized in this work can be found on the [MATLAB Code](https://github.com/andyeske/Flight-delays/tree/main/MATLAB%20Code) folder). This datatable contained information about every tail-number in the US, with the corresponding aircraft type, upto 2022.
Both data sources were extracted from data made publicly available by the United States Bureau of Transportation Statistics. To obtain data corresponding to other months or years:
* Flight Delay data: to go the BTS Marketing Carrier [On-Time Performance](https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FGK&QO_fu146_anzr=b0-gvzr).
* Tail Number data: go to the BTS Air Carrier Financial [Schedule P-43 Inventory](https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=GEH&QO_fu146_anzr=Nv4%20Pn44vr4%20Sv0n0pvny).
**User Action:** Download the MATLAB script (which can be found [here](https://github.com/andyeske/Flight-delays/tree/main/MATLAB%20Code)), the two datatables listed above, and save everything in the same folder. Once in the MATLAB environment, simply click on _Run Section_.
**Lines of Code:** Lines 14 - 29.
([ back to top ](#back_to_top))
---
<a name="building"></a>
### 2: Building the Flight Delay Matrices
**Description:** In this section, the P (probability), D (delay), and E (expected delay) matrices are constructed. Each of these three matrix types will come in three varieties: day of the week (i.e., ```D_day```), airline carrier (i.e., ```D_airline```), and aircraft type (i.e., ```D_airplane```). The explanation for each type of matrix follows below:
```
- D_day: Average delay on each route, indexed by the day of the week. The
dimension of D_day is 333x339x8, since there are 339 airports in
the network. The 3rd dimension denotes the day of the week.
Hence, in D(:,:,i), i = 1 is a Monday, i = 7 is a Sunday, while i = 8
refers to the total average.
The rows of D_day represent the origin airport (OA), while the columns
denote the destination airport (DA).
- D_airline: Average delay on each route, indexed by airline (18 different
carriers considered in this work).
- D_airplane: Average delay on each route, indexed by airplane type (41
different types considered in this work).
```
**User Action:** Simply click on _Run Section_.
**Lines of Code:** Lines 30 - 231.
([ back to top ](#back_to_top))
---
<a name="markov"></a>
### 3: Markov Chain Computations
**Description:** In this section, the Markov chain computations are conducted to obtain a stationary distribution for expected arrival flight delays in the U.S. airline route network. These calculations exploit a thought experiment, in which a passenger embarks itself in an infinite random walk across the airline network, starting at airport A, taking an infinite number of flights (each with an associated delay probability), and eventually ending at airport B. As the results elucidate, what matters is not the destination airport B, but the origin airport A (indeed, all the columns of the stationary matrix S, which correspond to the destination airports, will be identical). The description of utilized Markov _transition matrix_ to obtain the stationary distribution follows below:
```
The rows of this matrix represent the origin airports, while the columns represent the destination. In
essence, the elements in each of the columns add up to 1, and the elements themselves represent the
number of flights out of airport i heading to airport j that are delayed, divided by the total number
of flights that are delayed heading into airport j. In essence, this matrix contains the answer to the
following question: out of all delayed flights arriving at airport j, what percentage correspond to
those coming from airport i?
```
The results from taking the 20th power of the Markov transition probility matrix can be seen in the plot below:
<p align="left">
<img src="https://github.com/andyeske/Flight-delays/blob/main/Sample%20Plots/Infinite%20Walks.jpg" width="500">
**Figure:** _Stationary Distribution Results_.
</p>
According to this plot, in the infinite random walks thought experiment, a passenger leaving out of Denver, irrespective of where it will ultimately end its journey, would be the most likely to be delayed, followed by Atlanta, Chicago, Dallas and Las Vegas.
**User Action:** Simply click on _Run Section_. However, it is possible to modify the code in this section (lines 244 - 246) to obtain the stationary distribution results using data specific to a day of the week, airline or aircraft type.
**Lines of Code:** Lines 232 - 290.
([ back to top ](#back_to_top))
---
<a name="querying"></a>
### 4: Querying Route-specific Data
**Description:** In this section, the user selects a particular route using the standard IATA airport three letter codes (e.g., SFO - HNL) and a day of the week, and the code returns a plot displaying the route-specific flight delay statistics. In the case where the selected route does not exist in the U.S. airline route network, the code would display ```Selected route does not exist in the database```. A sample plot is shown below:
<p align="left">
<img src="https://github.com/andyeske/Flight-delays/blob/main/Sample%20Plots/Route%20Example.jpg" width="500">
**Figure:** _Route-specific flight delay statistics, corresponding to SFO - HNL_.
</p>
Here, the top most plot displays three bars, for the selected day of week, average weekday, and airport average expected arrival delays; the middle plot presents the arrival delays on the route, by operating airline; the bottom plots shows the aircraft-specific data for the route. The left y-axis describes the expected arrival flight delay, while the right y-axis denotes the probability that the would be delayed. The results are specific to January 2019 data.
**User Action:** To obtain custom route-specific flight delay statistics, modify the following code (lines 294, 296 and 298) according to the user preferences:
```
Origin = 'SFO';
```
```
Destination = 'HNL';
```
```
Day = 'Friday';
```
Then, simply click on _Run Section_.
**Lines of Code:** Lines 291 - 409.
([ back to top ](#back_to_top))
---
<a name="additional"></a>
### 5: Additional Plots
**Description:** In this section, two additional plots are generated, corresponding to the network average delays disaggregated by airline and aircraft type. It is possible to modify the code in [ Section 2 ](#building) to display these resul
没有合适的资源?快使用搜索试试~ 我知道了~
量化和探索美国航空业的航班延误趋势matlab代码.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共12个文件
jpg:4个
csv:4个
xlsm:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 116 浏览量
2024-05-18
17:37:29
上传
评论
收藏 827KB ZIP 举报
温馨提示
1.版本:matlab2014/2019a/2021a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 12 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
Matlab科研辅导帮
- 粉丝: 2w+
- 资源: 7668
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)