<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="https://grahamwfield.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://grahamwfield.github.io/" rel="alternate" type="text/html" /><updated>2024-06-05T14:20:41+00:00</updated><id>https://grahamwfield.github.io/feed.xml</id><title type="html">Graham Field</title><subtitle>My Data Analytics Portfolio</subtitle><author><name>Graham Field</name></author><entry><title type="html">Growth of the Wind Energy Industry in Germany</title><link href="https://grahamwfield.github.io/2024/04/20/Growth-of-the-Wind-Energy-Industry-in-Germany.html" rel="alternate" type="text/html" title="Growth of the Wind Energy Industry in Germany" /><published>2024-04-20T03:45:13+00:00</published><updated>2024-04-20T03:45:13+00:00</updated><id>https://grahamwfield.github.io/2024/04/20/Growth-of-the-Wind-Energy-Industry-in-Germany</id><content type="html" xml:base="https://grahamwfield.github.io/2024/04/20/Growth-of-the-Wind-Energy-Industry-in-Germany.html"><![CDATA[<head>
  <h2>Introduction</h2>
<p>The renewable energy industry has seen massive growth over the years given the importance of moving away from fossil fuels. One of the most effective ways of producing renewable energy is through wind. A global leader in this transition has been Germany.
The growth of the wind industry has many aspects to it, both technologically and geographically. With limited space and limited suitable areas for building wind farms the drive to make turbines more powerful and efficient is a major driving force in the industry.
Understanding how the new technologies have improved and how this has led to large increases in production capacity and physical dimensions of the turbines makes for an interesting study. Perhaps shedding light on the future of the industry.
</head>

<p><b>Tools:</b>
    <ul>
        <li>Python</li>
        <li>Python</li>
        <li>Jupyter Notebooks</li>
        <li>Libraries : Pandas, NumPy, Matplotlib, Sklearn Clustering</li>
    </ul>
</p>

<p><b>Data:</b>
    <ul>
        <li>>34484 rows & 29 variables</li>
        <li>17 Regions, 342 Districts, 115 Manufacturers</li>
        <li>open source data</li>
    </ul>
</p>

<section>
            <h2>Step 1: Initial Data Exploration and Cleaning</h2>
  </p style="overflow: hidden; text-align: justify;">This is open-source data from the German Data Register (Marktstammdatenregister). </p>

</p style="overflow: hidden; text-align: justify;">This data is regularly updated and free to use for research purposes.</p>

</p style="overflow: hidden; text-align: justify;">There were several columns with NAN values, to deal with this I dropped many of the columns that were not necessary or irrelevant or not applicable, such as water depth for onshore turbines. The remaining NANs were either deleted. Several of the columns were merged which completed the data in those columns. Ultimately the data that I worked with with Python the data was relatively easy to clean and organise.</p>

<img style="float: left; margin-right: 15px; width: 350px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/0.1 Data.png "alt="Data Description">
  
</p style="overflow: hidden; text-align: justify;">Further l exploratory analysis confirmed that there were no duplicates, and the remaining missing values before being removed constituted approximately 2.5% these were also generally data points that represent wind parks in the planning or construction phase and have not yet been commissioned.
From the Data cleaning and exploration I have learned that the offshore industrial zone has its own column but I can also consider this as an additional state for the purposes of this case study. This greatly reduced the number of NANs and missing data in the State, ClusterNordsee, and ClusterOstsee Columns.</p>
 
<section>
    <h2>Step 2: Exploring Correlations</h2>
    <p>
        <strong>Strong Correlations</strong><br>
        Gross performance, Net rated power, Hub Height, and Rotor Diameter have very strong correlations which makes sense, as the turbine technology improves the turbines have been getting taller, their blades getting longer, and their power outputs have been increasing. with relation to Rotor Diameter, I can see this very well. it is worth noting here that net rated power and gross output are the same and that is why I have a 1-1 correlation.
        with hub height and power, I see a very strong correlation, this makes sense as the larger the blades are the more wind they can catch and the more power they can generate.
        with hub height and rotor diameter, I also see a strong correlation which also makes sense as the longer the blades get the higher you need to build the turbine. I don't want blades hitting the ground and I also want to keep the blades in the wind.
        I can also see a correlation between water depth and distance from the coastline which makes sense, as the further you go from land the deeper the water gets.
    </p>
    <p>
        <strong>Weak Correlations</strong><br>
        when it comes to the offshore sector. I see weak correlations because this does not determine the type of turbine that is built. As the technology improves the biggest and the best will be built. given that some turbines can be built to float the water depth and distance from the coastline really should have much impact. water depth and distance from the coastline also have weak correlations and would have very little to do with the type of turbine built as the water line is the water line and the metrics I have are ultimately determined by that. I can say that the the deeper the water and the further away from the coastline does not correlate to larger more powerful turbines.
    </p>
   <img style="float: right; margin-left: 15px; width: 400px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/1 correlation heatmap.png" alt="Correlation Heatmap">
    <p>
        <strong>Conclusion</strong><br>
        the improvement of technology is represented by the growth in power output and the strong correlating increase in Rotor diameter and hub height. As the turbines become more powerful the blades get longer and the towers get taller. the turbines being built offshore does not impact the improved power and size of the turbines and I can see this in the weak correlation. with water depth and distance from shore.<br><br>
        I learned that there is a very weak correlation between the physical dimensions and power rating vs the water depth and distance from the coastline. This makes sense as the type design of turbines isn’t affected by whether it is onshore or offshore.
    </p>
    
<section>
    <h2>Step 3: Linear Regression</h2>
    <p>“As turbines improve over time, their dimensions and output increase.” This was the hypothesis I wanted to test, using a simple regression method. I used test and training subsets of data to determine the relationships between the various dimensions of turbines.</p>
    <p>I can see there is a very strong correlation between Hub Height and rotor diameter vs Gross Performance. As the power increases, so does the Rotor Diameter and Hub Height. There are a few outliers; however, these could be between wind parks that still need to be built or prototypes, which may be listed as 0. When comparing these 3 aspects, I can see that they all follow a very similar pattern. This is going to be important to predict the size and power of future turbines.</p>
    <p>This will make it much easier to map out future potential locations for wind farms, ultimately earmarking locations for projects before they are conceptualized and helping the planning of infrastructure.</p>
<img style="float: right; margin-left: 15px; width: 400px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/2 Linear.png" alt="Linear Regression">
    <p>When looking at the graph, I notice that I could extrapolate and predict the future dimensions of turbines as there is a nice linear pattern and relationship between Gross performance, Rotor Diameter, and Hub Height. In future iterations, I would like to include a Predictive model and over time test it against existing theoretical and prototype Turbine Models Types.</p>
   <p>It will be quite interesting to see how the clustering performs.</p>
    </p>
<section>
  
    <h2>Step 4: Clustering</h2>
    <p>I used machine learning algorithms to perform k-means clustering on the data. Based on the results from the elbow method for optimal k, I chose 4 clusters. Given the high correlations between the physical aspects of the turbines, I did not need to standardize the information.</p>
<img style="float: left; margin-right: 15px; width: 400px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/3 Scatter Plot with ClustersGross Performance Rotor Diameter.png" alt="Clustering 1">
  <p>The clustering analysis between rotor diameter and gross performance has yielded insightful results, illuminating distinct patterns and relationships within the data. Through the application of clustering algorithms, I have successfully identified meaningful groupings or clusters based on the inherent characteristics of rotor diameter and gross performance. This segmentation allows us to discern clear trends and variations in the dataset, providing valuable insights into the underlying structure of the data. By uncovering these clusters, I gain a deeper understanding of how rotor diameter and gross performance interact and influence each other within the context of our analysis.</p>
<img style="float: right; margin-left: 15px; width: 400px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/4 3d clustering .2.png" alt="3d Cluster">
  <p>The success of the 3D clustering analysis between gross performance, rotor diameter, and hub height is evident in its ability to reveal multidimensional relationships and patterns within wind turbine data. By integrating these critical parameters into a cohesive analysis framework, clustering algorithms effectively segment the data into distinct clusters based on shared characteristics. Beyond segmentation, this analysis fosters deeper insights into the interactions between performance metrics and design attributes, informing decisions regarding turbine design, siting, and operational strategies.</p>
    <p>Similar to the insights gained from Linear regression, I would like to create a predictive model and then compare that to upcoming Theoretical and Prototype Turbine Model Types.</p>
  <img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/5 Summary stats.png" alt="Descriptive Stats">
  <p>
  <h3>Interpretation:</h3>
    <ul>
        <li>Gross Performance and Net Rated Power: These two features seem to have relatively high mean and median values in the Blue cluster compared to other clusters. The mean and median values for the Green cluster are slightly lower, followed by the Red cluster, and then the Orange cluster, which has the lowest values.</li>
        <li>Hub Height and Rotor Diameter: The mean and median values for Hub Height and Rotor Diameter also vary across clusters. The Blue cluster tends to have higher values for both features compared to other clusters. The Green cluster follows with slightly lower values, then the Red cluster, and finally the Orange cluster with the lowest values.</li>
    </ul>
    <h3>Cluster Characteristics:</h3>
    <p>Based on the mean and median values, I can infer certain characteristics of each cluster:</p>
    <ul>
        <li>Blue Cluster: This cluster appears to have the highest values for Gross Performance, Net Rated Power, Hub Height, and Rotor Diameter among all clusters, indicating that it may represent wind turbines with higher performance and larger physical dimensions.</li>
        <li>Green Cluster: This cluster has slightly lower values compared to the Blue cluster but higher than the Red and Orange clusters, suggesting moderate performance and dimensions.</li>
        <li>Red Cluster: The Red cluster has lower values for all features compared to the Blue and Green clusters, indicating lower performance and smaller physical dimensions.</li>
        <li>Orange Cluster: This cluster has the lowest values for all features, suggesting the lowest performance and smallest physical dimensions among all clusters.</li>
    </ul>
    <p>Overall, I would say this model has been successful at learning and clustering our data. The data is in line with all our previous analysis and has provided some valuable insights.</p>

<section>
    <h2>Step 5: Time Series</h2>
    <p>The time series of rotor diameter is crucial in wind turbine analysis as it directly influences turbine performance, efficiency, and maintenance requirements. Understanding its trends and variations aids in optimizing turbine design, predicting energy output, and implementing effective maintenance schedules, ultimately maximizing the operational efficiency and longevity of wind energy systems.</p>
   <img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/6 Additive Decomposition of Rotor Diameter Mean Monthly Grouping.png" alt="Additive Decomposition">
  <p>There is a clear upward trend for rotor diameter with a very nice upward trend line. There are some dips here and there but generally around times where there were significant changes in the economy or society, such as 2008 where there was a financial crash.</p>
    <p>Stationarizing the time series data of rotor diameter using the Dickey-Fuller method is pivotal for extracting meaningful insights and improving forecasting accuracy. By transforming the non-stationary rotor diameter time series into a stationary one, this process facilitates clearer identification of underlying patterns and relationships within the data. The success of stationarizing lies in its ability to stabilize statistical properties like mean and variance over time, achieved by removing trends and seasonality. The Dickey-Fuller test serves as a reliable diagnostic tool, confirming the stationarity of the series when the null hypothesis, indicating a unit root and non-stationarity, is rejected. Overall, stationarizing the rotor diameter time series enhances the reliability of subsequent analyses, enabling more accurate modeling and forecasting of future rotor diameter trends.</p>
    <img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/7 dicky fuller.png" alt="Dicky Fuller">
  <p>Typically, if the p-value is less than a chosen significance level (such as 0.05), you reject the null hypothesis and conclude that the time series is stationary. In this case, the p-value is approximately 0.962239, which is greater than 0.05. Therefore, I fail to reject the null hypothesis, indicating that there is insufficient evidence to conclude that the time series is stationary.</p>
  <img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/9 Stationorizing the mean monthly rotor diameter.png" alt="Stationary line graph">    
  <p>Here I can see the success of the Dickey-Fuller test in stationarizing the time series.</p>
  
  <h3>Autocorrelation</h3>
    <ul>
        <li>First test: The vertical lines represent the lags in the series, while the blue area represents the confidence interval. When lines go above the blue edge of the confidence interval, this means the lags are significantly correlated with each other. I have many lags beyond this interval and can deduce that this data is non-stationary.</li>
        <li>Second test: Things have improved a lot here, but it’s still not perfect. This means that, despite the Dickey-Fuller test saying that data is stationary, that stationarity is more acceptable but still weak. There are only 4 lags that are not within the confidence area.</li>
    </ul>
    <img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/8 Autocorrelation mean monthly rotor diameter.png" alt="Autocorrelation"> 
    <p>
  <h3>Conclusion</h3>
    <p>For all the time series that I tested, I can reject the null hypothesis and consider the time series as non-stationary. Based on the interpretation of the Dickey-Fuller test results, where the test statistic is not significantly low and the p-value is greater than common significance levels like 0.05 or 0.01, I cannot reject the null hypothesis. Therefore, I conclude that the data is likely non-stationary, indicating the presence of a trend or seasonality. The autocorrelation confirms this.</p>
    <p>After stationarizing a time series and observing less than 5 nodes outside the spread, it suggests a strong autocorrelation pattern within the data. This indicates that the values in the time series are highly correlated with their past values, which is a common characteristic of stationary time series data. With fewer than 5 nodes outside the spread, it implies that the majority of the data points closely adhere to the autocorrelation structure, indicating a stable and predictable behavior over time. This could be advantageous for forecasting and modeling purposes, as it suggests that past values can reliably inform future trends within the time series.</p>
    <p>I was not surprised by the results of the time series analysis. In relation to previous steps in this analysis, I can see a clear pattern of increase in all dimensions over time. The Rotor Diameter has the most linear and predictable trend of all the dimensions. This would be a great start for predictive modeling and forecasting.</p>

<section>
<h2>Step 6: Geospatial</h2>
<p>Given that wind farms require quite a lot of space, it is important that I consider where and who is building the turbines. In this section, I wanted to look at the areas with the highest production and the top manufacturers responsible for that production. In this section, I will look at the top 3 manufacturers as they all use slightly different strategies.</p>
<h3>Top 10 Manufacturers by State</h3>
<p>From the previous analytic steps, I can see and confirm that the top 3 states are Niedersachsen, Schleswig-Holstein, and Brandenburg. I also have the offshore sector which actually comes in second if I consider it as a state.</p>
<img style="height: auto; border: 5px solid #555;" class="img-fluid" src="/img/posts/Wind Turbine Pics/11 Gross production by state.png" alt="Manufacteurer and state">
<div style="clear: both; margin-bottom: 20px;"></div>
<div style="clear: both;">
    <div style="float: left; margin-right: 15px;">
        <img style="width: 350px; height: auto; border: 5px solid #555;" class="img-fluid" src="/img/posts/Wind Turbine Pics/12 Enerecon turbines.png" alt="Enercon Locations">
    </div>
    <div style="margin-left: 380px;">
        <h4>Enercon Locations</h4>
        <p>Given that Enercon has so many smaller installations, it's no surprise that I see such a densely populated Choropleth. I notice that Enercon does not have any offshore wind parks which is interesting.</p>
    </div>
</div>
<div style="clear: both; margin-bottom: 20px;"></div>

<div style="clear: both;">
    <div style="float: left; margin-right: 15px;">
        <img style="width: 350px; height: auto; border: 5px solid #555;" class="img-fluid" src="/img/posts/Wind Turbine Pics/13 Vestas Turbines.png" alt="Vestas Locations">
    </div>
    <div style="margin-left: 380px;">
        <h4>Vestas Locations</h4>
        <p>Vestas has a mix of sizes at their locations. I see that they have very good land coverage but they also have offshore installations. They are very well spread across the country and surrounding sea.</p>
    </div>
</div>
<div style="clear: both; margin-bottom: 20px;"></div>

<div style="clear: both;">
    <div style="float: left; margin-right: 15px;">
       <img style="width: 350px; height: auto; border: 5px solid #555;" class="img-fluid" src="/img/posts/Wind Turbine Pics/14 Siemens turbines.png" alt="Siemens Locations">
    </div>
    <div style="margin-left: 380px;">
        <h4>Siemens Locations</h4>
        <p>Siemens has by far the fewest locations which corresponds with our previous analytical steps. They have a few massive installations however it seems their main business is building these wind parks offshore.</p>
    </div>
</div>
<div style="clear: both; margin-bottom: 20px;"></div>


        <h4>Box Plot</h4>
  <p>When looking at this box and whisker plot I can see that Enercon has mainly smaller installation with a few outliers of large wind parks. Vestas has slightly more spread with most of its wind parks in the medium sized category. When I look at Siemens I can see that they generally have massive installation which makes sense as most offshore wind parks are huge. Given that Siemens is mostly responsible for offshore wind parks this would make sense.</p>
<img style="15px; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Wind Turbine Pics/15 box_plot_gp_top_10_manu.png" alt="Box and Whisker"> 
  <p>I found the results to be surprising. Smaller installations at a higher frequency are more effective at producing a greater cumulative power capacity, this would also have major benefits for transmission of power as the electricity doesn’t need to travel large distances to where it is needed. Building the production close to where it is needed is clearly a preferable method of producing power.</p>
</section>

            <h2>Further Research</h2>    
</p>It would be nice if I could include meteorological data so I could see where the highest and most consistent sites are for wind turbines and compare that to the current infrastructure.
Combining the two and then conducting a time series analysis to see how or if the weather patterns change would be an interesting theory to test.
</p><section>
    
            <h2>Retrospective</h2>    
</p>There are some skills I will definitely need to develop for the Further research of this project. Some of the main challenges I have are linking the dynamic meteorological data to the cumulative geospatial aspects. It will be very interesting trying to map the growth in height in turbines, the rotor diameter, and the gross output (the power being extracted from the wind) against the Meteorological conditions to see if there are any changes in local and regional climatic conditions will be challenging, I am quite excited to develop these skills and share the results in the near future. Perhaps I will notice a change in weather patterns one the physical dimensions or physical dimensions reach a certain point or a combination of these aspects. Perhaps I will see a change when a certain density of these aspects is reached.</p>

    <section>
            <h2>Conclusions</h2>    
</p>The data I've explored paints a compelling picture of the ongoing evolution in wind turbine technology, with a clear trend towards larger physical dimensions and increased power output. The analysis of rotor diameter, hub height, and net rated power reveals a notable upward trajectory over time, suggesting a concerted effort within the industry to enhance turbine efficiency and performance. This trend underscores a broader commitment to harnessing renewable energy resources more effectively, as larger turbines with higher power capacities have the potential to generate greater electricity yields while maximizing land and resource utilization. As technology continues to advance and economies of scale drive further innovation, I anticipate this trend towards larger and more powerful turbines to persist, signaling a promising future for the continued growth and sustainability of wind energy.</p>

        <section>
            <h2>Reflections</h2>    
</p>During this analysis, I encountered several challenges that required careful navigation and problem-solving. One notable issue was the handling of non-stationary time series data, particularly in relation to rotor diameter trends. Stationarizing the data using the Dickey-Fuller method proved crucial but required attention to detail and an understanding of the underlying statistical concepts. Additionally, managing the visualization and interpretation of multidimensional data, such as clustering between rotor diameter, hub height, and gross performance, presented complexities in conveying insights effectively. Despite these challenges, each hurdle served as an opportunity for growth and learning, ultimately enhancing my analytical skills and proficiency in wind turbine analysis.</p>    

        <section>
            <h2>The Future of the Industry</h2>    
</p>Looking ahead, the future of the wind energy industry holds immense promise, propelled by advancements in technology and a growing commitment to sustainability. Integrating meteorological data, especially wind speed information, into our analyses provides invaluable insights into turbine performance and energy production. By considering environmental factors alongside turbine specifications, I can optimize siting decisions, improve operational efficiency, and enhance forecasting accuracy. This holistic approach not only fosters a deeper understanding of wind energy dynamics but also paves the way for more robust and resilient energy systems. As the industry continues to innovate and adapt to evolving challenges, the integration of meteorological data stands poised to play a pivotal role in shaping the future trajectory of wind energy, driving progress towards a more sustainable and renewable energy landscape.</p>]]></content><author><name>Graham Field</name></author><summary type="html"><![CDATA[Introduction The renewable energy industry has seen massive growth over the years given the importance of moving away from fossil fuels. One of the most effective ways of producing renewable energy is through wind. A global leader in this transition has been Germany. The growth of the wind industry has many aspects to it, both technologically and geographically. With limited space and limited suitable areas for building wind farms the drive to make turbines more powerful and efficient is a major driving force in the industry. Understanding how the new technologies have improved and how this has led to large increases in production capacity and physical dimensions of the turbines makes for an interesting study. Perhaps shedding light on the future of the industry.]]></summary></entry><entry><title type="html">Instacart Online Shopping Analysis</title><link href="https://grahamwfield.github.io/2024/02/04/Instacart-Online-Shopping-Analysis.html" rel="alternate" type="text/html" title="Instacart Online Shopping Analysis" /><published>2024-02-04T14:45:13+00:00</published><updated>2024-02-04T14:45:13+00:00</updated><id>https://grahamwfield.github.io/2024/02/04/Instacart-Online-Shopping-Analysis</id><content type="html" xml:base="https://grahamwfield.github.io/2024/02/04/Instacart-Online-Shopping-Analysis.html"><![CDATA[<head>
</head>

<body>
  <h2>Introduction</h2>
  <p>Instacart is a real online grocer that has made some of its data available for download and use. The customer dataset used as part of the analysis was synthesized and contains data on the number of dependencies, income, and more.</p>

  <p><b>Tools:</b></p>
  <ul>
      <li>Python</li>
      <li>Jupyter Notebooks</li>
      <li>Libraries: Pandas, Numpy, Seaborn, Matplotlib</li>
  </ul>

  <p><b>Data:</b></p>
  <ul>
      <li>Open Source Data</li>
      <li>3 Million Rows</li>
      <li>23 Numeric and Categorical variables</li>
      <li>Joins: Order, Product, Customers, and Department</li>
  </ul>

  <p><b>Key Research Questions</b></p>
  <ul>
      <li>What are the busiest days of the week?</li>
      <li>When are the busiest hours of the day?</li>
      <li>Are there particular times of the day when spending is the highest?</li>
      <li>Who is placing the most orders?</li>
      <li>Which product departments are more popular than others?</li>
      <li>What is the distribution among users with regards to their brand loyalty and frequency of re-order and expenditure using mean, max, and min?</li>
      <li>Is there a connection between age and family status in terms of ordering habits?</li>
  </ul>
<p>
  <section>
    <h2>Step 1: Initial Data Exploration and Cleaning</h2>
    <p style="overflow: hidden; text-align: justify;">In the first step of the analysis, I conducted an initial analysis to gain an understanding of the shape and size of the data frames I was going to be dealing with.</p>
    <p style="overflow: hidden; text-align: justify;">Next, I needed to check for missing and duplicated data. Some rows needed to be deleted while others had missing values due to only a single order being placed in the history of the user.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/1 Cleaning.png" alt="Data Cleaning"><p>
  </section>
<p>
  <section>
    <h2>Step 2: Data Wrangling</h2>
    <p style="overflow: hidden; text-align: justify;">In this step, I identified unnecessary columns and dropped them from the data frame. Several columns were also renamed for ease of use and legibility. Some of the data types needed to be changed from integer to string.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/3 Wrangling.png" alt="Column Renaming">
    <span class="caption text-muted">Renaming of a column</span>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/4 Wrangling.png" alt="Dropping Columns">
    <span class="caption text-muted">Dropping unnecessary columns</span>
    <p style="overflow: hidden; text-align: justify;">For privacy reasons, all personal information which could lead to the identification of individuals was removed, such as first and last names as well as addresses. This data is regularly updated and free to use for research purposes.</p>
  </section>
<p>
  <section>
    <h2>Step 3: Merging Data Sets</h2>
    <p style="overflow: hidden; text-align: justify;">Before merging the two data frames, I checked the shape of the data frames, looking at the number of rows and columns in each. This helped in selecting the correct type of join.</p>
    <p style="overflow: hidden; text-align: justify;">I used the “product_id” column as both data frames had this column. I used a left join in Python to merge two data frames so that all records from the left dataframe are included in the result, and only the matching records from the right dataframe are included, ensuring no data from the left dataframe is lost even if there are no corresponding matches in the right dataframe.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/5 Merging.png" alt="Merging Data Frames">
    <span class="caption text-muted">Merging the two data frames</span>
    <p style="overflow: hidden; text-align: justify;">To confirm the success of the merge, I used a true-false indicator. The absence of false flags indicated a successful join.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/6 Merging.png" alt="Merge Validation">
  </section>
<p>
  <section>
    <h2>Step 4: Deriving New Variables</h2>
    <p style="overflow: hidden; text-align: justify;">To answer the research questions and gain deeper insight into the data, I derived new columns with labels for various parameters. Below is an example of creating price ranges.</p>
    <p style="overflow: hidden; text-align: justify;">I created price ranges for the products, categorized as Low, Mid, and High price ranges.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/7 New Variables.png" alt="Price Range Derivation">
    <p style="overflow: hidden; text-align: justify;">Using the `loc` function, I created a frequency count for the number of orders within the price ranges, ultimately creating a new column called “Price_range_Loc.”</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/16 loc.png" alt="Creating New Columns">
  </section>
<p>
  <section>
    <h2>Step 5: Grouping Data</h2>
    <p style="overflow: hidden; text-align: justify;">I used the `groupby()` and `transform()` functions to create a column with the maximum number of orders per unique customer id. The `np.max` argument was used to determine the maximum order number for each user.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/14 Grouping.png" alt="Grouping Data">
    <p style="overflow: hidden; text-align: justify;">I used the loc function again to create a loyalty flag column where the customer were categorised as either “New customer”, Regular “Customer” or “loyal Customer” based on the number of orders.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Code/15 Aggregating.png" alt="Loc">
    <p style="overflow: hidden; text-align: justify;">The same process was used to derive several more categories, such as order hour of the day for repeat and new customers, income levels (High, Mid, Low), customers with and without dependents, and customers by region, among others.</p>
  </section>

<p>
  <section>
    <h2>Step 6: Visual Analysis</h2>
    <p style="overflow: hidden; text-align: justify;">Now that I have completed the previous steps I have clean data with new variables that I can work with and visualise. This is my favourite part of the process and where I gain the most insight into the data I am working with. </p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Results/2 reorder_rate_by_hour_of_the_day_and_week.png" alt="reorder_rate_by_hour_of_the_day_and_week">
    <p style="overflow: hidden; text-align: justify;">The above heat map show the reorder rate by hours of the day and days of the week. We can see that Tuesday in particular has the highest reorder rate and that on all days between 06:00 and 09:00 have the highest re order rates.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Results/3 order_counts_of_hours_of_day_and_day_of_week.png" alt="Loc">
    <p style="overflow: hidden; text-align: justify;">The above Heat map shows order counts by time of day and day of the week. From this visualisation we can see that Monday and Tuesday are particularly busy and that throughout the week between 07:00 and 17:00.</p>
   
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Results/4 prices_hours.png" alt="prices_hours">
    <p style="overflow: hidden; text-align: justify;">The above chart which shows the highest price paid for orders is between 01:00 and 03:00 am this does not mean that the most orders placed are between these times.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Results/vis_35.png" alt="Loc">
    <p style="overflow: hidden; text-align: justify;">The above chart shows the distribution of Customers based on their age, income level and weather or not they have dependants. From this we can see that divided into region.
From the graph we can see that in all regions it is generally middle-aged and seniors with mid to high level of income that do most of the ordering. the south seems to have the largest customer base.
</p>
  
 <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Instacart/Visuals/Results/6vis_36.png" alt="Loc">
    <p style="overflow: hidden; text-align: justify;">The most popular products by far seem to be Fresh Produce, Beverages, Snacks and Eggs. </p>  
  
<h2>Recommendations</h2>

<h3>1. Busiest Days and Hours:</h3>
<p style="overflow: hidden; text-align: justify;"><b>Busiest Days:</b> The busiest days of the week are Friday, Saturday, and Sunday. Marketing should focus on advertising upsells and cross-sells during these days. To encourage higher frequency of orders during the week, advertise staples such as produce and eggs from Monday to Thursday.</p>
<p style="overflow: hidden; text-align: justify;"><b>Optimal Timing for Reorders:</b> For reorders, focus on upsells and cross-sells on Sunday morning, two days before the busiest period.</p>

<h3>2. Spending Patterns:</h3>
<p style="overflow: hidden; text-align: justify;"><b>Peak Spending Times:</b> Spending is highest between 09:00 and 17:00. There is a correlation between the number of orders and expenditure during these hours. Marketing should target these times.</p>
<p style="overflow: hidden; text-align: justify;"><b>Daily Spending Trends:</b> The average price per order peaks on Friday and Sunday, indicating that customers are willing to spend more on these days. Stronger advertising should be considered for these days.</p>
<p style="overflow: hidden; text-align: justify;"><b>High Price Orders:</b> The highest prices paid for orders occur between 01:00 and 03:00 AM, though this does not coincide with the highest order volumes.</p>

<h3>3. Customer Demographics:</h3>
<p style="overflow: hidden; text-align: justify;"><b>Frequent Buyers:</b> High earners, particularly those with dependents, place the most orders. Marketing should focus on these groups. Additionally, adults and seniors represent large market segments, so advertising targeted at these demographics would be beneficial.</p>

<h3>4. Popular Product Departments:</h3>
<p style="overflow: hidden; text-align: justify;"><b>Top Departments:</b> Produce, Beverages, Snacks, and Dairy/Eggs are the most popular departments. Marketing should focus on these categories to retain and attract customers.</p>
<p style="overflow: hidden; text-align: justify;"><b>Incentives:</b> Consider pairing popular products with lower-selling items to boost sales. Soda is the best-selling product across all regions, so advertising this could attract new customers. Fruits are also among the top-selling products.</p>

<h3>5. User Distribution and Brand Loyalty:</h3>
<p style="overflow: hidden; text-align: justify;"><b>Regional Trends:</b> The South has the highest order count, primarily from high earners. Middle earners show consistent ordering patterns across all regions. Interestingly, individuals without dependents in the Midwest order significantly higher-priced items than other regions.</p>
<p style="overflow: hidden; text-align: justify;"><b>Income Insights:</b> Adults with high income and no dependents have the highest earnings, though they do not place the most orders. Targeting this group with specific marketing could increase high-end sales.</p>

<h2>Reflections</h2>
<p style="overflow: hidden; text-align: justify;">This project has been very insightful, demonstrating how grouping and categorizing data can reveal trends and patterns among different demographics. Combining data and deriving new variables provided a wealth of new information. Managing the large amount of data and creating relevant, understandable visualizations was challenging but crucial for effective analysis.</p>
   
    </section>

</body>]]></content><author><name>Graham Field</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Rockbuster Video Rentals Analysis</title><link href="https://grahamwfield.github.io/2024/02/01/Rockbuster.html" rel="alternate" type="text/html" title="Rockbuster Video Rentals Analysis" /><published>2024-02-01T14:00:00+00:00</published><updated>2024-02-01T14:00:00+00:00</updated><id>https://grahamwfield.github.io/2024/02/01/Rockbuster</id><content type="html" xml:base="https://grahamwfield.github.io/2024/02/01/Rockbuster.html"><![CDATA[<head>
</head>

<body>
  <h2>Rockbuster Video Rentals</h2>
  <p>Posted by Graham Field on March 10, 2024 – 10 mins read</p>
  
  <h3>Project Overview</h3>
  <p><b>Duration of the project:</b> 1 week</p>
  <p><b>Role:</b> Data Analyst</p>
  <p><b>Tools:</b></p>
  <ul>
    <li>PostgreSQL</li>
    <li>Tableau</li>
  </ul>
  <p><b>Data:</b></p>
  <ul>
    <li>Relational Database</li>
    <li>2 Fact tables and 13 Dimension Tables</li>
  </ul>

  <h3>Key Questions</h3>
  <ul>
    <li>Which movies contributed the most/least to revenue gain?</li>
    <li>What was the average rental duration for all videos?</li>
    <li>Which countries are Rockbuster customers based in?</li>
    <li>Where are customers with a high lifetime value based?</li>
    <li>Do sales figures vary between geographic regions?</li>
  </ul>

  <h2>Introduction</h2>
  <p>Rockbuster Stealth LLC is a movie rental company that used to have stores around the world. Facing stiff competition from streaming services such as Netflix and Amazon Prime, the Rockbuster Stealth management team is planning to use its existing movie licenses to launch an online video rental service in order to stay competitive.</p>

  <h2>Getting to Know the Data</h2>
  <p>I began by creating a diagram of the tables which resembled a snowflake pattern, in addition to this I created a data dictionary which I needed for the joins later on. I started to search for duplicate and missing records to make sure my data was complete and consistent.</p>
  <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Proccess/1db vis.png" alt="Data Cleaning"><p>
  <p>Next was describing the data so that I could have some idea what I was working with. For example this SQL query is calculating the mode (most frequently occurring value) for several columns in the film table from a PostgreSQL database. The query uses the MODE() function within the GROUP BY clause to achieve this.</p>
  <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Proccess/2.png" alt="Data Cleaning"><p>
  <p>We can use this to find things like most popular film genre, longest movie, average movie rental, which genres contribute the most revenue, where are the most loyal customers and which are restrictions are the most popular.</p>

  <h2>Results</h2>
  <h4>High Customer and Payment Countries:</h4>
   <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Results/1.png" alt="Data Cleaning"><p>  
    <ul>
     <li>India, China, and the United States: These countries have the largest red circles, indicating they have generated the highest total payments. They are also shaded in darker blue, suggesting a higher number of customers.</li>
    <li>Other notable countries: Brazil, Japan, and Russia also have significant red circles, indicating substantial payments and a good number of customers.</li>
  </ul>

  <h4>Moderate Customer and Payment Countries:</h4>
  <ul>
    <li>Countries like Canada, Australia, Germany, and the United Kingdom have moderate red circles and are shaded in medium blue, indicating a moderate number of customers and payments.</li>
  </ul>

  <h4>Low Customer and Payment Countries:</h4>
  <ul>
    <li>Many countries in Africa, parts of South America, and some parts of Asia and Europe are shaded in lighter blue, indicating fewer customers. The red circles, if present, are small, indicating lower total payments.</li>
  </ul>

  <h4>Insights:</h4>
  <ul>
    <li>The video rental company seems to have a strong presence in major economies such as the US, India, and China, both in terms of customer base and revenue.</li>
    <li>There is significant variation in customer and payment distribution globally, with some regions contributing more than others.</li>
    <li>This data can be useful for the company to identify key markets and potential areas for growth. Focusing on regions with lower customer numbers but high potential for growth could be beneficial.</li>
  </ul>

  <h4>Rental Rate by NCPP Rating:</h4>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Results/2.png" alt="Data Cleaning"><p>  
    <ul>
      <li>G Rating: Average Rental Rate: 2.9237</li>
    <li>Movies rated G (General Audiences) have an average rental rate of approximately 2.92.</li>
    <li>NC-17 Rating: Average Rental Rate: 2.9710</li>
    <li>Movies rated NC-17 (Adults Only) have an average rental rate of approximately 2.97.</li>
    <li>PG Rating: Average Rental Rate: 3.0519</li>
    <li>Movies rated PG (Parental Guidance Suggested) have the highest average rental rate of approximately 3.05.</li>
    <li>PG-13 Rating: Average Rental Rate: 3.0348</li>
    <li>Movies rated PG-13 (Parents Strongly Cautioned) have an average rental rate of approximately 3.03.</li>
    <li>R Rating: Average Rental Rate: 2.9387</li>
    <li>Movies rated R (Restricted) have an average rental rate of approximately 2.94.</li>
  </ul>

  <h4>Insights:</h4>
  <ul>
    <li>PG and PG-13 Rated Movies: These categories have the highest average rental rates, with PG-rated movies slightly leading at 3.0519, followed closely by PG-13 at 3.0348. This suggests that movies in these categories are rented at higher rates compared to other ratings.</li>
    <li>G, NC-17, and R Rated Movies: These categories have slightly lower average rental rates, with NC-17 having the highest rate among them at 2.9710, followed by R at 2.9387 and G at 2.9237.</li>
    <li>The rental rate differences among the ratings are relatively small but can indicate preferences or pricing strategies based on movie ratings.</li>
  </ul>
 <h4>Top 10 Customers:</h4>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Results/3.png" alt="Data Cleaning"><p>  
    <ul>
      <li>Top Spenders: Eleanor Hu. from Saint-Denis, Reunion, and Clara Shaw from Molodetno, Belarus, are the highest spenders with $211.6 and $189.6, respectively.</li>
    <li>High Spenders: All customers listed are significant contributors to revenue, with the lowest among them (Roland So. from Yingkou, China) spending $80.8.</li>
    <li>Moderate to High Spending: Other customers, such as Casey Mena, Sara Perry, Leslie Sew., and Cecil Vines, show spending amounts between $115.7 and $130.7, indicating a consistent high level of expenditure among the top 10.</li>
    <li>Geographic Diversity: These top spenders come from a wide range of locations, including Reunion, Belarus, Turkey, Mexico, Indonesia, United Kingdom, Ukraine, United States, Canada, and China, reflecting a broad geographic distribution of high-value customers.</li>
  </ul>

  <h4>Sales by Genre</h4>
  <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Rock Buster/Visualisations/Results/4.png" alt="Data Cleaning"><p>
  <ul>
    <li>Top Selling Genres: Sports, Sci-Fi, and Animation are the top three genres with the highest total sales, indicating their popularity among customers.</li>
    <li>Moderate Selling Genres: Genres such as Comedy, Drama, Family, and Games show moderate total sales, ranging from approximately 3,750 to 4,118.</li>
    <li>Low Selling Genres: Thriller has significantly lower total sales (48) compared to other genres, indicating it is the least popular genre among customers.</li>
    <li>Sales Distribution: There is a noticeable gap between the highest selling genre (Sports with 4,892 sales) and the lowest selling genre (Thriller with 48 sales), showing a wide range of customer preferences.</li>
  </ul>

  <h2>Recommendations</h2>
 <p>
  <h4>Geographic Data Recommendations:</h4>
  <ul>
    <li>Focus on High Revenue Regions:
      <ul>
        <li>Increase marketing efforts in countries with high total payments such as the United States, India, and China. These markets already have a significant customer base and high revenue, indicating a strong interest in video rentals.</li>
        <li>Implement localized promotions and advertisements to cater to regional preferences and enhance customer loyalty in these key markets.</li>
      </ul>
    </li>
    <li>Expand in Moderate Revenue Regions:
      <ul>
        <li>For countries like Brazil, Japan, and Russia, where there is a moderate customer base and revenue, consider targeted campaigns to boost engagement and increase market share.</li>
        <li>Analyze customer behavior in these regions to tailor offers and services that meet their specific needs and preferences.</li>
      </ul>
    </li>
    <li>Explore Untapped Markets:
      <ul>
        <li>Identify countries with potential for growth but currently low customer numbers and revenue. Consider offering special deals or introductory offers to attract new customers.</li>
        <li>Conduct market research to understand barriers to entry and customer preferences in these regions to effectively penetrate these markets.</li>
      </ul>
    </li>
  </ul>

  <h4>Rental Rate by NCPP Rating Recommendations:</h4>
   <ul>
      <li>Optimize Pricing for High Demand Ratings:
      <ul>
        <li>PG and PG-13 rated movies have the highest average rental rates, indicating strong demand. Consider maintaining or slightly increasing rental prices for these categories to maximize revenue without deterring customers.</li>
        <li>Offer bundle deals or subscriptions featuring a mix of PG and PG-13 rated movies to provide value and encourage repeat rentals.</li>
      </ul>
    </li>
    <li>Promote Lower Demand Ratings:
      <ul>
        <li>For G, NC-17, and R rated movies, which have lower average rental rates, consider promotions or discounts to boost rentals.</li>
        <li>Highlight unique or popular titles within these categories to attract customer interest.</li>
      </ul>
    </li>
  </ul>

  <h4>Top 10 Customers Recommendations:</h4>
  <ul>
    <li>Enhance Customer Loyalty Programs:
      <ul>
        <li>Recognize and reward top spenders like Eleanor Hu. and Clara Shaw with exclusive benefits such as early access to new releases, special discounts, and personalized recommendations.</li>
        <li>Implement a tiered loyalty program to incentivize spending and engagement across different customer segments.</li>
      </ul>
    </li>
    <li>Personalized Marketing and Communication:
      <ul>
        <li>Use customer data to send personalized offers and communication. Tailor marketing messages based on past rental behavior and preferences to increase relevance and response rates.</li>
        <li>Regularly engage with top customers through newsletters, surveys, and feedback forms to strengthen relationships and gather insights for service improvement.</li>
      </ul>
    </li>
  </ul>

  <h2>Sales by Genre Recommendations:</h2>
  <ul>
    <li>Boost Inventory for Popular Genres:
      <ul>
        <li>Increase the inventory of high-demand genres like Sports, Sci-Fi, and Animation to ensure availability and meet customer demand.</li>
        <li>Regularly update and expand the catalog in these genres with new and trending titles to keep the offerings fresh and engaging.</li>
      </ul>
    </li>
    <li>Promotional Campaigns for Low Demand Genres:
      <ul>
        <li>For genres with lower sales such as Thriller, consider running targeted promotions to spark interest. Offer discounted rentals, feature these genres in newsletters, and create themed movie nights or bundles.</li>
        <li>Highlight critically acclaimed or popular titles within these genres to attract customers who may not typically rent from these categories.</li>
      </ul>
    </li>
    <li>Genre-Based Customer Segmentation:
      <ul>
        <li>Segment customers based on their rental history and preferences for specific genres. Use this segmentation to create targeted marketing campaigns that showcase new releases, recommendations, and promotions in their preferred genres.</li>
        <li>Offer personalized suggestions and curated lists to enhance the rental experience and drive sales across various genres.</li>
      </ul>
    </li>
  </ul>

  <h3>Reflections</h3>
  <p>My journey with SQL has been both enjoyable and enlightening. One of the aspects I enjoyed the most about using SQL is its powerful ability to handle and manipulate large datasets efficiently. The process of writing queries, optimizing them, and seeing immediate results has been incredibly satisfying. Each successful query felt like solving a puzzle, and the clarity it brought to complex data was immensely rewarding. While I have achieved a lot, I am excited to continue my learning journey and explore the vast possibilities that SQL offers. With continuous effort and curiosity, I aim to master SQL and leverage its full potential in my future projects.</p>
</body>]]></content><author><name>Graham Field</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Preparing for Influenza Season</title><link href="https://grahamwfield.github.io/2024/01/10/Preparing-for-Influenza-Season.html" rel="alternate" type="text/html" title="Preparing for Influenza Season" /><published>2024-01-10T14:45:13+00:00</published><updated>2024-01-10T14:45:13+00:00</updated><id>https://grahamwfield.github.io/2024/01/10/Preparing%20for%20Influenza%20Season</id><content type="html" xml:base="https://grahamwfield.github.io/2024/01/10/Preparing-for-Influenza-Season.html"><![CDATA[<head>
</head>

<body>
  <h2>Introduction</h2>
  <p>The annual influenza season in the United States poses significant challenges for healthcare providers. Vulnerable populations, such as young children and the elderly, are particularly at risk of developing severe complications from the flu, which often leads to increased hospitalizations. Medical staffing agencies play a crucial role in supporting hospitals and clinics by providing temporary staff to manage the surge in patients.</p>

  <h2>Objective</h2>
  <p>The primary objective of this analysis is to determine the optimal timing and allocation of staff to hospitals across the United States during the influenza season.</p>

  <h2>Scope</h2>
  <p>The project encompasses all hospitals within the 50 states of the United States, focusing on the upcoming influenza season to ensure adequate staffing and resource distribution. By examining historical data and identifying trends, we aim to enhance preparedness and response strategies for healthcare facilities.</p>

  <h2>Key Research Questions</h2>
  <ul>
      <li>Provide information to support a staffing plan, detailing what data can help inform the timing and spatial distribution of medical personnel throughout the United States.</li>
      <li>Determine whether influenza occurs seasonally or throughout the entire year. If seasonal, does it start and end at the same time (month) in every state?</li>
      <li>Prioritize states with large vulnerable populations. Consider categorizing each state as low-, medium-, or high-need based on its vulnerable population count.</li>
      <li>Assess data limitations that may prevent you from conducting your desired analyses.</li>
  </ul>

  <section>
    <h2>Step 1: Initial Data Exploration and Cleaning</h2>
    <p>After drawing requirements from the stakeholders and the business requirements document I evaluated each data set. There were several considerations with the data namely: its reliability, ownership, and ethical concerns. I don't want to present any data that could lead to the identification of individuals, given the scope and scale of this medical data.</p>
    <p>The focus of this was to send staff and allocate resources to areas which experience the greatest need. I focused on areas with the highest mortality rates.</p>
    <p>From the 4 possible data sets I selected:</p>
    <ul>
      <li>US Geographical Census Data</li>
      <li>US Influenza Deaths</li>
    </ul>
  </section>

  <section>
    <h2>Step 2: Cleaning and Consistency Checks</h2>
    <p>During the exploration of the data I found several inconsistencies namely: the naming of states and areas which were recorded but not part of the US such as Puerto Rico.</p>
    <p>There was some missing data due to privacy requirements where data that was less than 10 was removed. I imputed using both random and averaged methods. But ultimately chose the random seed.</p>

  <section>
    <h2>Step 3: Integration</h2>
    <p>In order to use the data sets for analysis I had to integrate or merge them. This is due to the data sets often not being complete and ready for use.</p>
    <p>I began by mapping the data and trying to find commonalities between the data sets. I identified “State” and “Year” as common columns. There was an issue with granularity as The US census data had state and county with year while the Influenza Deaths had State with Year and Month.</p>
    <p>Now that I have a common key to work with, I created Pivot tables which summarized the data on both data sets and allowed me to integrate the two data sets. I used VLOOKUP to integrate the data sets into one.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/1.png" alt="Data Integration">
    <p class="caption text-muted" style="text-align: center;">US Census Data</p>
     <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/2.png" alt="Data Integration">
  <p class="caption text-muted" style="text-align: center;">Influenza Deaths</p>
  <p>Now that I have the data sets integrated I began to segment them into age groups of 10 years and then created a secondary segment for retired vs non-retired or younger than 65 and older than 65.</p>
 <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/3.png" alt="Data Integration">
    <p class="caption text-muted" style="text-align: center;">US Census Data</p>
  <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/4.png" alt="Data Integration">
    <p class="caption text-muted" style="text-align: center;">Influenza Deats</p>
  <p>Now that I had the two tables with matching data I could create a new normalised data table that would give me death rates by dividing the census data to the matching Influenza deaths.</p>
  </section>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/5.png" alt="Data Integration">
    <p class="caption text-muted" style="text-align: center;">Normalised data</p>
   <h3>Analysis of the t-Tests</h3>
  
  <h3>Test 1: Deaths65+ vs. Census65+</h3>
  <p><b>t Stat:</b> -19.2112299</p>
  <p><b>P(T<=t) two-tail:</b> 9.25071E-61</p>
  <p><b>t Critical two-tail:</b> 1.965157098</p>
  <p>This test shows a highly significant difference between the mortality data for the 65+ age group and the census data for the same age group. However, this is not directly related to the null hypothesis about comparing mortality rates between age groups.</p>
  
  <h3>Test 2: Deaths 65- vs. Deaths65+</h3>
  <p><b>t Stat:</b> -8.7088285</p>
  <p><b>P(T<=t) two-tail:</b> 5.17089E-17</p>
  <p><b>t Critical two-tail:</b> 1.964991997</p>
  <p>This test directly compares the mean influenza mortality rates between the two age groups:</p>
  <p><b>t Stat:</b> -8.7088285</p>
  <p><b>t Critical two-tail:</b> 1.964991997</p>
  <p><b>P(T<=t) two-tail:</b> 5.17089E-17</p>
  
  <h3>Conclusion</h3>
  <p>The p-value for the second test (5.17089E-17) is extremely low, much lower than the typical significance level (α) of 0.05. This indicates that the difference in mean mortality rates between individuals aged 65 and older and those under 65 is statistically significant.</p>
  
  <h3>Decision</h3>
  <p>Since the p-value is much less than 0.05, we reject the null hypothesis (H0).</p>
  
  <h3>Summary</h3>
  <p>Based on the results of the t-test comparing the mortality rates between the two age groups, we have sufficient evidence to reject the null hypothesis. This indicates that there is a statistically significant difference in the mean influenza mortality rates between individuals aged 65 and older and those under 65.</p>

    <section>
    <h2>Step 4: Statistical Analysis and Testing</h2>
    <p>I began by stating 2 hypotheses:</p>
    <ul>
      <li>Null Hypothesis (H0): The mean influenza mortality rate for individuals aged 65 and older is equal to the mean influenza mortality rate for individuals under 65.</li>
      <li>Alternative Hypothesis (HA): The mean influenza mortality rate for individuals aged 65 and older is not equal to the mean influenza mortality rate for individuals under 65.</li>
    </ul>
    <p>The goal was to test whether the two groups had the same risk of death from influenza. The first test I ran was a statistical test to determine: Distribution, Standard Deviation, Number of outliers, and correlation. I wanted to determine if the average mortality rate was higher or lower for the two age groups.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/6.png" alt="Statistical Analysis">
      <p>The next test I ran was the two-tail test because I was interested in confirming the results from the previous test and confirming or rejecting the null hypothesis with certainty. I decided to include both equal and unequal variance tests for the following reasons.</p>
    <p>The first test shows the difference between the deaths in the 65+ age group and the overall census data for the 65+ population, highlighting the impact of influenza within this age group relative to its population size.</p>
    <p>The second test directly compares the mortality rates between the two age groups, showing the disparity in influenza mortality between younger and older individuals.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/work proccess/7.png" alt="Statistical Analysis">

  </section>
<p>
  <section>
    <h2>Step 5: Visual Analysis</h2>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/Results/1b.png" alt="Defining Influenza">
   <p>
    <h3>Defining Influenza and Who Is at Risk?</h3>
    <p>What is Influenza? Influenza, commonly known as the flu, is a contagious respiratory illness caused by influenza viruses. It can cause mild to severe illness and at times can lead to death. The flu spreads through respiratory droplets when people with the flu cough, sneeze, or talk.</p>
    <p>Who is at Risk? Influenza significantly impacts certain age groups more than others. The most vulnerable age groups include:</p>
    <ul>
      <li>Children younger than 5 years old, with a mortality rate of 3.2%.</li>
      <li>People over the age of 65 years, with an average mortality rate of 4.6%.</li>
      <ul>
        <li>65-74 years: 1.4% mortality rate</li>
        <li>75-84 years: 3.7% mortality rate</li>
        <li>85+ years: 8.7% mortality rate</li>
      </ul>
    </ul>
    <p>Vulnerable Groups: The chart shows the death rates across various age groups, highlighting the higher risk among the very young and the elderly. These populations should be the focus of targeted interventions to reduce mortality rates during the influenza season.</p>
  <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/Results/2b.png" alt="Defining Influenza">
  </section>

  <section>
    <h3>Where and Who is at Risk?</h3>
    <p>Geographical Analysis: The geographical distribution of influenza deaths shows significant variations. The top 15 states with the highest number of deaths include California, New York, Texas, Pennsylvania, and Florida, which are also among the most densely populated states.</p>
    <p>Regional Deaths Geographically: Mapping the deaths geographically allows us to identify high-risk areas. This information is crucial for directing resources and planning healthcare strategies.</p>
    <p>Total Deaths by Age Group: Analyzing the total deaths by age group reveals that older adults, especially those above 65, are at the highest risk. This demographic data is essential for preparing healthcare systems to meet the needs of these vulnerable populations.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/Results/3b.png" alt="Geographical Analysis">
  </section>

  <section>
    <h3>When is Influenza Season?</h3>
    <p>Influenza Seasonality: Influenza season typically starts in December, peaks in January, and declines by March. These months coincide with colder weather, which contributes to the spread of the virus.</p>
    <p>State-specific Analysis: California, New York, and Texas have the highest number of deaths, correlating with their large populations. This trend underscores the need for targeted resource allocation during peak months.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/Results/4b.png" alt="Influenza Seasonality">
    <p>Monthly Distribution of Deaths: Understanding the monthly distribution of deaths can help in planning the deployment of medical staff and resources. Ensuring that healthcare facilities are adequately staffed during peak months can save lives and improve patient outcomes.</p>
    <img style="width: 100%; height: auto; border: 5px solid #555" class="img-fluid" src="/img/posts/Influenza/Visualisations/Results/5b.png" alt="Influenza Seasonality">
  </section>

  <section>
    <h2>Conclusion and Recommendations</h2>
    <p>Conclusion: The analysis shows that certain age groups and geographical regions require more resources during the influenza season. Specifically, children under 5 and adults over 65 years need prioritized care due to higher mortality rates.</p>
    <p>Recommendations:</p>
    <ul>
      <li>Prioritize Care for Vulnerable Age Groups: Ensure that resources are directed towards children under 5 and adults over 65.</li>
      <li>Prepare for Seasonal Peaks: Staffing and resources should be heightened from December to March.</li>
      <li>Allocate Resources to High-Risk States: States like California, New York, Texas, Pennsylvania, and Florida should receive the majority of resources. The next tier of states should receive moderate resources.</li>
      <li>Enhance Public Health Campaigns: Increase awareness and vaccination efforts, particularly among high-risk groups and in high-risk states.</li>
    </ul>
    <p>Further Analysis: Future research should include additional data on vaccination rates, living standards, nutrition, and substance use to better understand the spread and survival rates of influenza. Collaboration with public health agencies can provide a more comprehensive approach to managing influenza seasons.</p>
  </section>

  <section>
    <h2>Ongoing Monitoring and Data Limitations</h2>
    <p>Ongoing Monitoring:</p>
    <ul>
      <li>Continue to track death rates over time to identify trends and emerging patterns.</li>
      <li>Include comparisons between vaccinated and unvaccinated populations to assess the effectiveness of vaccination campaigns.</li>
      <li>Assess how influenza deaths compare to other leading causes of death to allocate healthcare resources effectively.</li>
    </ul>
    <p>Data Limitations:</p>
    <ul>
      <li>Limited information on general health, fitness, diet, and hereditary factors can affect the analysis. More detailed health data could improve predictive models.</li>
      <li>High-population density states with low death rates should be studied to identify effective health practices that could be implemented elsewhere.</li>
      <li>Data quality and completeness are crucial; ensuring accurate reporting from healthcare facilities will enhance the reliability of future analyses.</li>
    </ul>
    <p>Assessment Recommendations:</p>
    <ul>
      <li>Regularly update and review data to reflect current trends.</li>
      <li>Engage with local health departments to validate and supplement data.</li>
      <li>Implement technological solutions to improve data collection and analysis.</li>
    </ul>
    <p>By addressing these limitations and continuing to monitor relevant data, we can improve our understanding of influenza patterns and enhance our preparedness for future seasons.</p>
  </section>
</body>]]></content><author><name>Graham Field</name></author><summary type="html"><![CDATA[]]></summary></entry></feed>