  {"id":1380,"date":"2022-04-04T16:45:00","date_gmt":"2022-04-04T16:45:00","guid":{"rendered":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/?p=1380"},"modified":"2022-04-18T15:21:34","modified_gmt":"2022-04-18T15:21:34","slug":"daily-attendances-in-accident-and-emergency-departments-forecasting-attendances","status":"publish","type":"post","link":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/2022\/04\/04\/daily-attendances-in-accident-and-emergency-departments-forecasting-attendances\/","title":{"rendered":"(Part 2) Daily attendances in accident and emergency departments  \u2013 Forecasting attendances"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1380\" class=\"elementor elementor-1380\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3eb88db elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3eb88db\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-777c548\" data-id=\"777c548\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-85ae895 elementor-widget elementor-widget-text-editor\" data-id=\"85ae895\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In this second and final blog in the series dedicated to analysing daily attendances in accident and emergency departments,\u00a0<span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">we will\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400;text-align: start\">attempt to forecast the daily number of attendances at A&amp;E using three different forecasting methods.<\/span><span style=\"font-size: 13px\">\u00a0The first blog focused on exploring the data and identifying relationships between attendances\/admissions and\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">patients\u2019 age\/referral source\/arrival date\/time. <\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400;text-align: start\">\u00a0To read the first blog (<a href=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/2022\/03\/15\/ae-patients-attendances-exploratory-data-analysis\/\" target=\"_blank\" rel=\"noopener\">click here<\/a>).\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-32e1090 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"32e1090\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ad68100\" data-id=\"ad68100\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2c62ec2 elementor-widget elementor-widget-heading\" data-id=\"2c62ec2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">2.5 Decomposing the Data<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-72013e1 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"72013e1\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2b0b07c\" data-id=\"2b0b07c\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6b38ec0 elementor-widget elementor-widget-text-editor\" data-id=\"6b38ec0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In 2015 the hospital of interest saw one of its neighbouring hospital&#8217;s ED close, as a result the number of attendances at the A&amp;E\u00a0<span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">suddenly<\/span><span style=\"font-size: 13px\">\u00a0increased. As seen in figure 9, the average number of attendances before and after 2015 are different. This could be accounted for using change point detection prior to implementing our forecasting algorithms. However, due to the nature of the change and also to simplify the problem and accurately forecast the time series, only attendances recorded between 2016 and 2020 were kept. (To learn more and read a blog on change point detection (<\/span><a style=\"font-size: 13px\" href=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/2022\/02\/14\/yearly-coal-mining-disasters-changepoint-detection\/\" target=\"_blank\" rel=\"noopener\">click here<\/a><span style=\"font-size: 13px\">)).<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-60ac4b1 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"60ac4b1\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2b05c1f\" data-id=\"2b05c1f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-37d46c1 elementor-widget elementor-widget-image\" data-id=\"37d46c1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"768\" height=\"380\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9-768x380.png\" class=\"attachment-medium_large size-medium_large wp-image-1395\" alt=\"Fig9\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9-768x380.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9-300x148.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9-1024x506.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9-1536x759.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig9.png 1823w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 9: Daily number of attendances at the A&amp;E from the beginning of 2012 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-001a8f3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"001a8f3\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-625b7b2\" data-id=\"625b7b2\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4e0b0e6 elementor-widget elementor-widget-text-editor\" data-id=\"4e0b0e6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To improve understanding of the time series, I applied a TBATS decomposition to the data. Other more common decomposition methods such as X11 could not be used as they do not handle multiple seasonality.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d98b9bf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d98b9bf\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-00a7fd2\" data-id=\"00a7fd2\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-21d58a4 elementor-widget elementor-widget-image\" data-id=\"21d58a4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"768\" height=\"403\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10-768x403.png\" class=\"attachment-medium_large size-medium_large wp-image-1399\" alt=\"Fig10\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10-768x403.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10-300x157.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10-1024x537.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10-1536x806.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig10.png 1809w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 10: TBATS decomposition of the daily number of attendances at the A&amp;E from the beginning of 2016 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d16ec9f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d16ec9f\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-960cd1f\" data-id=\"960cd1f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-292cf5f elementor-widget elementor-widget-text-editor\" data-id=\"292cf5f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In figure 10, the first plot corresponds to the actual daily attendances at the A&amp;E. The second plot represents the level of the time series, which roughly corresponds to the trend. The third and fourth plots represent the weekly and yearly seasonality, respectively. From figure 11, we can see that the TBATS model has successfully captured the weekly seasonality. There are 8 points in that plot corresponding to 8 days, with the first point being a Monday. Mondays\u2019 average higher number of attendances is well represented. The yearly seasonality is also well captured in figure 12, where the summer months have on average a higher number of attendances.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3e7a8db elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3e7a8db\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b6b280d\" data-id=\"b6b280d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-731fcf2 elementor-widget elementor-widget-image\" data-id=\"731fcf2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"768\" height=\"444\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11-768x444.png\" class=\"attachment-medium_large size-medium_large wp-image-1400\" alt=\"Fig11\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11-768x444.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11-300x173.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11-1024x592.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11-1536x888.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig11.png 1602w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 11: TBATS decomposition weekly seasonality.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6e8a85d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6e8a85d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-37d7809\" data-id=\"37d7809\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e05622b elementor-widget elementor-widget-image\" data-id=\"e05622b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"446\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12-768x446.png\" class=\"attachment-medium_large size-medium_large wp-image-1401\" alt=\"Fig12\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12-768x446.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12-300x174.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12-1024x594.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12-1536x891.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig12.png 1577w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 12: TBATS decomposition yearly seasonality.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-cb6863e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cb6863e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0b65c60\" data-id=\"0b65c60\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cfc04d2 elementor-widget elementor-widget-text-editor\" data-id=\"cfc04d2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Next, we can apply several tests to ensure the residuals of the model resembled white noise. The residuals from the TBATS look to have mean zero and are normally distributed (Fig.13). The ACF plot of residuals does not show any significant autocorrelation and the histogram of residuals are centred around zero and normally distributed. Additionally, performing a Ljung-Box test yields a p-value of 0.2457 which is greater than 0.05. Therefore, we can assume that residuals are independent. Thus, all non-randomness has been well captured by the model.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8c9712c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8c9712c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6339a88\" data-id=\"6339a88\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0ce4ac8 elementor-widget elementor-widget-image\" data-id=\"0ce4ac8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"393\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13-768x393.png\" class=\"attachment-medium_large size-medium_large wp-image-1420\" alt=\"Fig13\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13-768x393.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13-300x153.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13-1024x524.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13-1536x786.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/fig13.png 1750w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 13: TBATS residuals plot (Top), ACF of residuals (Bottom left), Histogram of residuals  (Bottom right).<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c86d71d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c86d71d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7ce3aeb\" data-id=\"7ce3aeb\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-817eb9a elementor-widget elementor-widget-heading\" data-id=\"817eb9a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">3 Forecasting daily attendances, results and limitations.<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6d6eb45 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6d6eb45\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5342f3a\" data-id=\"5342f3a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f421f4c elementor-widget elementor-widget-text-editor\" data-id=\"f421f4c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In this section, three different models which account for multiple seasonalities will be used to forecast the average daily number of attendances at A&amp;E.<span style=\"font-size: 13px\">\u00a0The two seasonalities of the time series have length 365.25 and 7 days. The time series shows a positive trend and an additive seasonal pattern. The data was split 80\/20 into a training dataset (1169 days) and a testing dataset (292 days).\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">The first model\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">we will look at\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">is the TBATS (Trigonometric, Box-Cox transformation, ARMA errors, Trend, Seasonal components) model. The second model is an ARIMA model with Fourier series as external\u00a0<\/span><span style=\"font-family: Poppins;font-size: 13px;font-style: normal;font-weight: 400\">regressor. Finally the third model is an Autoregressive Neural Network model. We will then look at combining the different models to try and improve our predictive accuracy.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-31db968 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"31db968\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-95a4203\" data-id=\"95a4203\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-91ecb8c elementor-widget elementor-widget-heading\" data-id=\"91ecb8c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3.1 Forecasting using TBATS<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-25719e9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"25719e9\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0311ff6\" data-id=\"0311ff6\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f674124 elementor-widget elementor-widget-text-editor\" data-id=\"f674124\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Figure 14 shows the daily number of attendances at the A&amp;E, from January 2016 to the end of 2019. The blue line corresponds to the actual data and was split 80\/20 between training and testing, respectively. The red line corresponds to the TBATS forecasts from <br \/>March 15th, 2019 to December 31st, 2019. The TBATS forecast and testing datasets have equal length (292 daily figures).<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a5042a5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a5042a5\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c7e5852\" data-id=\"c7e5852\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e0bd604 elementor-widget elementor-widget-image\" data-id=\"e0bd604\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"392\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast-768x392.png\" class=\"attachment-medium_large size-medium_large wp-image-1542\" alt=\"Tbats general forecast\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast-768x392.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast-300x153.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast-1024x523.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast-1536x784.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-general-forecast.png 1642w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 14: Daily number of attendances from 2016 to the end of  2019 and TBATS forecast from March 15th, 2019 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-94dc68e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"94dc68e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c7c8c36\" data-id=\"c7c8c36\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d740361 elementor-widget elementor-widget-text-editor\" data-id=\"d740361\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>From figure 15, the TBATS forecasts look to be reasonably close to the actual daily number of attendances. However, the TBATS model struggles to predict spikes in the data, especially negative ones.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dd05894 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dd05894\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-14e5023\" data-id=\"14e5023\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1b365c8 elementor-widget elementor-widget-image\" data-id=\"1b365c8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"583\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-random-forecasts-768x583.png\" class=\"attachment-medium_large size-medium_large wp-image-1543\" alt=\"Tbats random forecasts\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-random-forecasts-768x583.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-random-forecasts-300x228.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-random-forecasts-1024x777.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/tbats-random-forecasts.png 1146w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 15: Four 4 weeks plots of daily number of attendances at  A&amp;E, TBATS forecast (red) and test data (blue).<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-25322f3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"25322f3\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c7d409f\" data-id=\"c7d409f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9bdea8c elementor-widget elementor-widget-heading\" data-id=\"9bdea8c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3.2 Forecasting using ARIMA model and Fourier series as external \nregressor<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d2db48b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d2db48b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6b50984\" data-id=\"6b50984\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f6b727b elementor-widget elementor-widget-text-editor\" data-id=\"f6b727b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In order to select the optimal number of Fourier terms for each seasonality, two nested for loops were created to identify the number of terms which minimises the AIC. According to the algorithm, 3 and 10 terms are optimal for the weekly and yearly seasonalities, respectively. Figure 16 shows the actual daily number of attendances at the A&amp;E (blue line) and the ones forecasted by the ARIMA model with Fourier series as external regressor (red line).<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-45abe6b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"45abe6b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-77bae6c\" data-id=\"77bae6c\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4697b15 elementor-widget elementor-widget-image\" data-id=\"4697b15\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"405\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast-768x405.png\" class=\"attachment-medium_large size-medium_large wp-image-1540\" alt=\"Arima general forecast\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast-768x405.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast-300x158.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast-1024x540.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast-1536x810.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-general-forecast.png 1623w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 16: Daily number of attendances  from 2016 to the end of  2019 and ARIMA with Fourier series as external regressor forecast from March 15th, 2019 to  the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-09ba384 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"09ba384\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-95866fb\" data-id=\"95866fb\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4531927 elementor-widget elementor-widget-text-editor\" data-id=\"4531927\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>As shown in figure 17, the forecasted figures look reasonably close to the actual data. However, similarly to the TBATS forecasts, the negative spikes in the data are not predicted very well.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e68c2a4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e68c2a4\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b538d02\" data-id=\"b538d02\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b937d6c elementor-widget elementor-widget-image\" data-id=\"b937d6c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"566\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-random-forecasts-768x566.png\" class=\"attachment-medium_large size-medium_large wp-image-1541\" alt=\"Arima random forecasts\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-random-forecasts-768x566.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-random-forecasts-300x221.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-random-forecasts-1024x755.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/arima-random-forecasts.png 1203w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 17: Four 4 weeks plots of daily number of attendances at  A&amp;E, ARIMA with Fourier series as external regressor forecast (red) and test data (blue).<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1e25edd elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1e25edd\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-89b3c45\" data-id=\"89b3c45\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7a05f0c elementor-widget elementor-widget-heading\" data-id=\"7a05f0c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3.3 Forecasting with an Autoregressive Neural Network model<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-40cb1ea elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"40cb1ea\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1a21044\" data-id=\"1a21044\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-937b30c elementor-widget elementor-widget-text-editor\" data-id=\"937b30c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Looking at figure 18, we can see that the autoregressive neural network forecasts seem relatively close to the actual data. Furthermore, it appears to be able to predict some spikes in the data.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f850e36 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f850e36\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6cf8e64\" data-id=\"6cf8e64\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e591c02 elementor-widget elementor-widget-image\" data-id=\"e591c02\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"378\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts-768x378.png\" class=\"attachment-medium_large size-medium_large wp-image-1538\" alt=\"ANN general forecasts\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts-768x378.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts-300x148.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts-1024x505.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts-1536x757.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-general-forecasts.png 1778w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 18: Daily number of attendances  from 2016 to the end of  2019 and Autoregressive Neural Network forecast from March 15th, 2019 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d52b2d5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d52b2d5\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c70219e\" data-id=\"c70219e\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3063211 elementor-widget elementor-widget-text-editor\" data-id=\"3063211\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The autoregressive neural network (ANN) does not look to have captured the seasonality of the time series as well as the other two models. However, it seems better at predicting spikes in the data. When forecasting the daily number of attendances at the A&amp;E using the autoregressive neural network, I tested if forecasts based on detrended and deseasonalised data would yield a more accurate prediction. This revealed that detrending and deseasonalising the data did increase the forecast\u2019s accuracy (results are shown in the Results and Limitations section below).<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ed68d8e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ed68d8e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bbb2882\" data-id=\"bbb2882\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-02b695e elementor-widget elementor-widget-image\" data-id=\"02b695e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"509\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-random-forecasts-768x509.png\" class=\"attachment-medium_large size-medium_large wp-image-1539\" alt=\"ANN random forecasts\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-random-forecasts-768x509.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-random-forecasts-300x199.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-random-forecasts-1024x679.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/ANN-random-forecasts.png 1317w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Figure 19: Four 4 weeks plots of daily number of attendances at A&amp;E, Autoregressive Neural Network (red) and test data (blue).<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-fc84b66 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"fc84b66\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f8b52e0\" data-id=\"f8b52e0\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-24a9ce2 elementor-widget elementor-widget-heading\" data-id=\"24a9ce2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3.4 Combining forecasting models<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-52112bf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"52112bf\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b6485f8\" data-id=\"b6485f8\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0807e90 elementor-widget elementor-widget-text-editor\" data-id=\"0807e90\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>It is sometimes possible to improve the forecasts\u2019 accuracy by combining predictions from different models. The forecasts from the three models tested above were combined using two different methods. The first method consisted of using an aggregation algorithm (here a Polynomial Potential aggregation) which would decide the weights used when combining the daily number of attendances from the different forecasts. The weights were assigned as to minimise the loss function (here the mean square error).<br \/>This was done for all possible combinations of the three forecasts using the function <a href=\"https:\/\/www.rdocumentation.org\/packages\/opera\/versions\/1.2.0\/topics\/mixture\" target=\"_blank\" rel=\"noopener\"><strong>mixture()<\/strong><\/a> from the package \u2018<a href=\"https:\/\/cran.r-project.org\/web\/packages\/opera\/opera.pdf\" target=\"_blank\" rel=\"noopener\"><strong>opera<\/strong><\/a>\u2019. The second method used to combine the forecasts was to average the daily predictions. This was also done for all possible combinations of the three forecasts.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d480215 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d480215\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-df2bc50\" data-id=\"df2bc50\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-fa957c6 elementor-widget elementor-widget-heading\" data-id=\"fa957c6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3.5 Results and Limitations<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7fdc555 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7fdc555\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-74fae1e\" data-id=\"74fae1e\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-579dc6b elementor-widget elementor-widget-text-editor\" data-id=\"579dc6b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>I used two different accuracy measures to compare the forecasts. First, the Mean Absolute Error (MAE) gives the average number of attendances by which the forecasts and the actual data differ across the 292 days forecasted. Secondly, the Root Mean Squared Error (RMSE) which computes the square root of the mean of the squared residuals. These two measures were obtained comparing the 292 daily number of attendances from the test data and the forecasts. Both MAE and RMSE are scale dependant which implies that they can be used to compare forecasts made on the same dataset.<\/p><p>Table 2 shows that detrending and deseasonalizing the ANN increased the accuracy of the forecast. The RMSE and the MAE both reduced, from 22.88 to 19.52 and 17.88 to 15.49, respectively. However, it is the TBATS model which produced the most accurate forecasts with a RMSE of 19.01 and a MAE of 15.07.\u00a0\u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8894ade elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8894ade\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-57cf136\" data-id=\"57cf136\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2ebe908 elementor-widget elementor-widget-image\" data-id=\"2ebe908\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"318\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table-768x318.png\" class=\"attachment-medium_large size-medium_large wp-image-1561\" alt=\"Not combined prediction accuracy table\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table-768x318.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table-300x124.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table-1024x425.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table-1536x637.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/not-combined-prediction-accuracy-table.png 1698w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Table 2: RMSE and MAE from the forecasts of 292 daily number of attendances at A&amp;E, from March 15th, 2019 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ae2d9db elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ae2d9db\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cc41777\" data-id=\"cc41777\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f506292 elementor-widget elementor-widget-text-editor\" data-id=\"f506292\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Combining forecasts reduced the RMSE and MAE for all prediction combinations when using the aggregation algorithm which minimises the mean square error. The most accurate forecast was obtained when combining the predictions from the TBATS model <br \/>and the ANN. The forecast of this combination produced a RMSE of 18.37 and a MAE of 14.42 (Tab.3). Moreover, the predictions made from averaging the forecasts yielded mixed results. Only predictions made from combining all three forecasts or combining TBATS and ANN were more accurate than the forecasts made by the models separately.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5d3d7a2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5d3d7a2\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bc62eea\" data-id=\"bc62eea\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3579169 elementor-widget elementor-widget-image\" data-id=\"3579169\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"299\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table-768x299.png\" class=\"attachment-medium_large size-medium_large wp-image-1557\" alt=\"Prediction accuracy table\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table-768x299.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table-300x117.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table-1024x399.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table-1536x599.png 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-content\/uploads\/sites\/37\/2022\/03\/prediction-accuracy-table.png 1688w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Table 3: RMSE and MAE from combined forecasts (using an aggregation algorithm) of 292  daily number of attendances at A&amp;E, from March 15th, 2019 to the end of 2019.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4d6cb56 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4d6cb56\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-757a8ce\" data-id=\"757a8ce\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6822d49 elementor-widget elementor-widget-text-editor\" data-id=\"6822d49\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Nevertheless, there are three major limitations to the forecasts produced above. 1) The forecasts are based only on past observations and no other variables are used in the predictions. This limits how accurate the forecasts can be. To improve the forecasts, other variables should be accounted for such as weather (potential increase in car accidents on very rainy day) or festive periods (around Christmas more people get injured due to increase alcohol consumption, installation of decorations and time spent in the kitchen). 2) The models cannot forecast significant changes in the number of attendances and therefore cannot predict strong spikes in the data. 3) Finally, if the recording guidelines of what is considered an attendance and\/or the A&amp;E\u2019s capacity change (such as an extension is built), then the current forecasts will need to be revised.\u00a0<\/p><p>However, forecasting the daily average number of attendances at A&amp;E departments can help hospitals. It can provide guidance on the amount of stock which needs to be purchased. It can help decide how many new staff need to be recruited and how to schedule their shifts. Overall, it will improve the quality of service and reduce the patients\u2019 waiting time.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>In this second and final blog in the series dedicated to analysing daily attendances in accident and emergency departments,\u00a0we will\u00a0attempt to forecast the daily number of attendances at A&amp;E using three different forecasting methods.\u00a0The first blog focused on exploring the data and identifying relationships between attendances\/admissions and\u00a0patients\u2019 age\/referral source\/arrival date\/time. \u00a0To read the first blog [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":1608,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ocean_post_layout":"full-width","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","slim_seo":{"title":"(Part 2) Daily attendances in accident and emergency departments \u2013 Forecasting attendances - Thomas Newman","description":"In this second and final blog in the series dedicated to analysing daily attendances in accident and emergency departments,\u00a0we will\u00a0attempt to forecast the dail"},"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-statistics","entry","has-media"],"_links":{"self":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/posts\/1380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/comments?post=1380"}],"version-history":[{"count":170,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/posts\/1380\/revisions"}],"predecessor-version":[{"id":1619,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/posts\/1380\/revisions\/1619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/media\/1608"}],"wp:attachment":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/media?parent=1380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/categories?post=1380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/thomas-newman\/wp-json\/wp\/v2\/tags?post=1380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}