<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tate Lowry on Medium]]></title>
        <description><![CDATA[Stories by Tate Lowry on Medium]]></description>
        <link>https://medium.com/@jtlowry2?source=rss-cd086484a362------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hgoONBB-6gSLb_Wf</url>
            <title>Stories by Tate Lowry on Medium</title>
            <link>https://medium.com/@jtlowry2?source=rss-cd086484a362------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jtlowry2/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond First and Last Click: Simulating Hidden Marketing Complexity]]></title>
            <link>https://medium.com/@jtlowry2/beyond-first-and-last-click-simulating-hidden-marketing-complexity-f0dfffced5d9?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0dfffced5d9</guid>
            <category><![CDATA[marketing-attribution]]></category>
            <category><![CDATA[web-analytics]]></category>
            <category><![CDATA[marketing-analytics]]></category>
            <category><![CDATA[digital-marketing]]></category>
            <category><![CDATA[attribution-modeling]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Sun, 17 May 2026 23:23:23 GMT</pubDate>
            <atom:updated>2026-05-17T23:23:23.804Z</atom:updated>
            <content:encoded><![CDATA[<p>The objective was to build a marketing simulation to explore various attribution models. The idea is to develop an initial conceptual simulation that can then be iterated on later and made more complex as needed.</p><p>From there I can compare and contrast different approaches to marketing attribution already knowing the ground truth.</p><p>At a high level the simulation needs to:</p><ol><li>Create synthetic users</li><li>Move them through sessions</li><li>Log session and user data like web analytics data</li><li>Facilitate comparisons between models</li></ol><p>The simulation consist of three layers:</p><ul><li><strong>World definition</strong>: what pages / channels exists</li><li><strong>Behavior engine</strong>: how users move and decide</li><li><strong>Logging + evaluation</strong>: how and what data gets recorded and stored</li></ul><h4>Simulation Implementation</h4><p>The simulation generates a synthetic stream of marketing sessions designed to mimic how users interact with channels before converting.</p><p>Each simulated user is assigned behavioral traits such as intent level, patience, and retargetability. Sessions are then generated across channels like Paid Search, Organic Search, Email, Direct, and Social using weighted probabilities to create a more realistic channel mix.</p><p>The model also simulates funnel progression by assigning users to pages ranging from the homepage to checkout. Most sessions occur higher in the funnel, while fewer users reach high-intent pages like cart or checkout.</p><p>Conversion probability is influenced by both user intent and session context. High-intent users are more likely to convert, while certain channels and deeper funnel pages receive additional weighting to reflect stronger purchase intent.</p><p>To make the dataset resemble real behavioral data, each session is timestamped and incremented forward over time, creating a chronological stream of interactions between 2020 and 2025.</p><p>The final output is written into separate user and session datasets, providing a controlled environment for testing attribution models and analyzing how conversion credit shifts across the customer journey.</p><h4>Simulating 100,000 Sessions</h4><p>After simulating 100,000 marketing sessions and performing some initial analysis I had the following statistics:</p><ul><li>Users interacted with approximately <strong>1.08 marketing channels</strong> before converting</li><li>Standard deviation was approximately <strong>0.326</strong></li><li>Approximately <strong>6.7% of purchases</strong> involved multiple channels</li></ul><p>This means roughly <strong>93% of conversions were effectively single-channel journeys</strong>. At first glance, this makes simple last-click attribution appear effective.</p><p>This type of low-complexity attribution environment is realistic for:</p><ul><li>Branded search ecosystems</li><li>Strong direct-navigation brands</li><li>Email-heavy retention ecosystems</li><li>Low-consideration consumer purchases</li></ul><p>However, it becomes much less realistic for:</p><ul><li>Enterprise B2B sales</li><li>High-consideration purchases</li><li>Research-heavy buying journeys</li><li>Long sales cycles</li></ul><p>The important nuance is this:</p><p>Even when only a small percentage of journeys are multi-touch, those journeys often contain the highest behavioral complexity.</p><h4>Comparing First Touch vs. Last-Touch Attribution</h4><p>I then compared two common attribution models:</p><ul><li>First-Click attribution</li><li>Last-Click attribution</li></ul><p>At an aggregate level the results appear surprisingly similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*uQSMo6ORshYwNvj8sgaLHQ.png" /></figure><p>The channel level attribution remained relatively stable.</p><p>No channel was radically revalued simply by changing attribution methodology.</p><p>Even after isolating the 6.7% cohort of users who interacted with multiple channel prior to converting, first-touch and last-touch attribution remained surprisingly aligned at aggregate scale.</p><p>Channel rankings stayed relatively stable and no single channel experienced a dramatic revaluation simply by switching attribution models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*qjJkkW4KcMuRxsc6t7boHw.png" /></figure><p>However, inspecting the underlying customer journeys revealed substantially more behavioral complexity than either attribution model exposed independently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*5Eea_P5ET6csrqd3LRCawg.png" /><figcaption>Multi touch channel paths</figcaption></figure><p>Within the multi-touch cohort, users followed highly varied conversion paths involving repeated exposures, cross-channel transitions, and multiple intermediary touch points occurring between the initial discovery interaction and the final conversion event.</p><p>Some journeys were relatively linear while others involved several reinforcing interactions across channels before a purchase decision was made. Although the aggregate attribution outputs appeared stable, the path-level data showed that very different behavioral journeys were ultimately collapsing into similar attribution outcomes.</p><p>This highlights an important limitation of simplistic attribution frameworks: even when first-click and last-click models produce similar top-line reporting, they can still compress away much of the internal complexity that shapes how conversions actually occur.</p><h4>How Last Click Models Over Simplify</h4><p><strong>User A: </strong>Paid Search -&gt; Conversion</p><p><strong>User B</strong>: Organic Search -&gt; Social -&gt; Email -&gt; Direct -&gt; Paid Search -&gt; Conversion</p><p>Under a last-click attribution model, our Paid Search channel would get credit for both users.</p><p>But these journeys are fundamentally different.</p><p>User B contains:</p><ul><li>Assisted conversions</li><li>Reinforcement behavior</li><li>Sequential influence</li><li>Multi-channel engagement patterns</li><li>Potential retargeting effects</li><li>Delayed decision-making</li></ul><p>Yet all of that complexity disappears under simplistic attribution frameworks.</p><h4>Simple Attribution Models Can Be Misleading</h4><p>One of the more interesting findings from the simulation was that attribution stability does not necessarily imply behavioral simplicity.</p><p>Although first-touch and last-touch attribution appeared directionally similar in aggregation, the underlying customer journeys revealed substantially more complexity than either model exposed.</p><p>At aggregate scale:</p><ul><li>channel rankings remained relatively stable</li><li>first-touch and last-touch attribution appeared directionally consistent</li><li>no channel experienced dramatic revaluation</li></ul><p>Initially, this could suggest that simplistic attribution models are “good enough.”</p><p>However, path-level inspection told a very different story.</p><p>Within the multi-touch cohort, users exhibited highly varied behavioral sequences involving:</p><ul><li>repeated channel exposure</li><li>reinforcement behavior</li><li>discovery-to-conversion loops</li><li>cross-channel transitions</li><li>varying path lengths</li></ul><p>The attribution models remained stable largely because the complexity compressed into similar endpoint distributions.</p><p>Phrased another way: <em>Different journeys were collapsing into the same attribution outcomes.</em></p><h4>Where This Goes Next</h4><p>This simulation is still low-complexity and serves as a first pass exploration into attribution behavior.</p><p>One of the more interesting observations was that the simulated conversion paths exhibited too much randomness and diversity compared to what would likely occur in a real-world marketing ecosystem.</p><p>In practice, customer behavior tends to produce recurring channel sequences rather than highly fragment path variability across each user.</p><p>This suggest the simulation would benefit from additional behavioral constraints and more realistic journey generation logic.</p><p>The next phase will likely involve revisiting the simulation itself to introduce greater behavioral realism and more sophisticated multi-touch interactions between channels. This includes modeling recurring channel patterns, introducing stronger user intent states, and allowing for more complex reinforcement behavior across sessions.</p><p>The goal is to not simply build a “better” attribution model.</p><p>The larger objective is to better understand how customer behavior creates attribution ambiguity and how much behavioral complexity can remain hidden even when aggregate attribution models appear directionally stable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0dfffced5d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Interview Prep to Proof of Concept: Modeling Crime Exposure Risk in Raleigh, NC]]></title>
            <link>https://medium.com/@jtlowry2/from-interview-prep-to-proof-of-concept-modeling-crime-exposure-risk-in-raleigh-nc-4324d2f35bfe?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/4324d2f35bfe</guid>
            <category><![CDATA[public-safety]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[intellgience]]></category>
            <category><![CDATA[crime-analysis]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Sun, 29 Mar 2026 19:18:28 GMT</pubDate>
            <atom:updated>2026-03-29T19:18:28.677Z</atom:updated>
            <content:encoded><![CDATA[<p>I had an interview awhile back for a crime analyst position. While I didn’t get the job the preparation process turned out to be far more valuable than I expected.</p><p>One concept that stuck with me during the research process was <strong>repeat victimization</strong>.</p><p>Repeat victimization refers to situations where a person, place, or business is targeted more than once often within a short time frame and frequently for the same type of crime.</p><p>According to the NCJRS Virtual Library, repeat victimization accounts for a significant portion of overall crime.</p><h4>What Does Repeat Victimization Look Like?</h4><p>A few simple examples:</p><ul><li>An apartment complex burglarized twice within a week</li><li>A retail store repeatedly targeted for shoplifting</li><li>A vehicle break-in followed by another incident nearby the next day</li></ul><p>The pattern isn’t random it’s predictable. And that’s what makes it actionable.</p><h4>Why Does Repeat Victimization Happen?</h4><p>There are a few key drivers:</p><ol><li><strong>Location Factors</strong>: Urban density, visibility, and environmental design all matter. Areas with high foot traffic, limited guardianship, or easy access tend to experience more repeat incidents.</li><li><strong>Victim Characteristics: </strong>Prior victimization increases future risk. Socioeconomic conditions and environmental exposure also play a role.</li><li><strong>Offender Behavior: </strong>Offenders tend to return to places that “worked”. If a location is perceived as low-risk and high-reward, it becomes a repeat target.</li></ol><h4>Turning Theory Into Practice</h4><p>To go beyond theory, I built a small proof-of-concept analysis using public crime data from Raleigh, North Carolina. While this project was originally inspired by an Apex Police Department role, the workflow is transferable to any department.</p><p><strong>Objective: </strong>identify repeat victimization patterns and quantify an “exposure” risk for nearby locations that could become the next target.</p><h4>Building the Exposure Risk Model</h4><p>I approached this like a data science problem:</p><ul><li><strong>Data Source:</strong> Raleigh Open Data — Police Incident Reports</li><li><strong>Processing:</strong> Python (cleaning, transformation, feature engineering)</li><li><strong>Visualization:</strong> Tableau</li></ul><p>The core idea was to estimate how “at risk” a nearby location is after a crime occurs.</p><h3>Exposure Risk Formula</h3><p>At a high level, exposure risk is calculated as:</p><blockquote><strong><em>Risk ∝ (Severity × Recency) / Distance</em></strong></blockquote><ul><li><strong>Severity:</strong> How serious the incident is (e.g., larceny vs. violent crime)</li><li><strong>Recency:</strong> How recently the crime occurred</li><li><strong>Similarity: </strong>While this variable was not used in the proof of concept the idea is similar places are at a higher risk of repeat victimization</li><li><strong>Distance:</strong> Proximity to other locations</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*Rm5__7M9GQ1s-ZehEJX-dQ.png" /><figcaption><strong>Figure 1 </strong>Risk Exposure Formula</figcaption></figure><ul><li>S_i: ranking of the severity of crime</li><li>T_i: recency weight (&lt;= 1 day=1.6, 2–7 days: 2.4, 8–30 days: 2.2, 31–90 days: 1.4, &gt; 90 days: 1.1)</li><li>M_i: M.O similarity (same store / time of day) etc, similarity metric the idea is similar places are at a higher risk of repeat victimization</li><li>d_{iL}: distance between incident and location</li></ul><p>This creates a dynamic score that increases immediately after an incident and decays over time and distance.</p><h3>Key Findings</h3><h4><strong>1. Property Crime is Rising</strong></h4><p>Property crimes increased approximately <strong>23.4% from 2022 to 2024</strong>, driven primarily by larceny.</p><p>This suggests not just more crime but more opportunities for repeat victimization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*mg5610_lTrYN_DJLxMn8Bg.png" /><figcaption><strong><em>Figure 2 </em></strong><em>Property Crime by Year 2014–2024 Raleigh Open Data Police Incidents Reports</em></figcaption></figure><h4>2. Crime is Highly Concentrated</h4><p>Mapping incidents revealed five persistent hotspots:</p><ul><li>Glenwood South</li><li>Crabtree Valley</li><li>South Saunders</li><li>New Bern Avenue</li><li>Brier Creek</li></ul><p>These areas consistently generate high volumes of incidents, making them ideal candidates for targeted interventions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*0_IihO4xCj5Xcm5xMFCjoA.png" /><figcaption><strong><em>Figure 3 </em></strong><em>Property Crime 2014–2024 Raleigh, Open Data Police Incidents Reports</em></figcaption></figure><h4>3. Repeat Victimization Happens Fast</h4><p>This was the most interesting finding:</p><ul><li><strong>16% of repeat incidents occur within 24 hours</strong></li><li><strong>42% occur within one week</strong></li></ul><p>This highlights a critical <strong>“re-offense window”</strong> a short period where intervention is most effective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*f1JeTgdVJrJfIVemYdzqZg.png" /><figcaption><strong><em>Figure 4 </em></strong><em>Time Course of Repeated Larceny Incidents 2014–2024, Raleigh Open Data Police Reports</em></figcaption></figure><h4>4. Exposure Risk Identifies Near-Future Targets</h4><p>The exposure risk model flagged areas around:</p><ul><li>Glenwood Avenue</li><li>New Bern Avenue</li></ul><p>These weren’t just high-crime areas they were <strong>high-risk-for-next-incident areas</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*KoyEVRjYK6spHNh7TOJD_Q.png" /><figcaption><strong><em>Figure 5 </em></strong><em>Exposure Risk Summary Table 2020–2024, Raleigh Open Data Police Reports</em></figcaption></figure><h4>What This Means for Policing Strategy</h4><p>This type of analysis isn’t just descriptive it’s operational.</p><p><strong>Recommended Actions</strong></p><p><strong>1. Rapid Response Deployment</strong><br> Deploy directed patrols within <strong>24 hours</strong> of a larceny in high-risk areas.</p><p><strong>2. Targeted Outreach</strong><br> Engage:</p><ul><li>Retail businesses</li><li>Apartment complexes</li></ul><p>Especially during evening peak hours.</p><p><strong>3. Data-Driven Briefings</strong><br> Incorporate exposure risk scoring into <strong>weekly crime briefings</strong> to prioritize patrol allocation.</p><h3>Why This Matters</h3><p>Most crime analysis focuses on <strong>where crime has happened</strong>.</p><p>This approach focuses on:</p><blockquote><strong><em>Where crime is likely to happen next.</em></strong></blockquote><p>That shift from reactive to proactive is where real impact happens.</p><h3>Final Thoughts</h3><p>Even though I didn’t land the role, this project gave me a deeper appreciation for how data science can be applied in public safety.</p><p>What started as interview prep turned into something more:</p><ul><li>A working analytical framework</li><li>A transferable model for law enforcement agencies</li><li>And a reminder that sometimes the side projects are the real win</li></ul><h3>Resources</h3><ul><li>Weisel, Deborah Lamm. <em>Analyzing Repeat Victimization</em>. U.S. <a href="https://popcenter.asu.edu/sites/g/files/litvpz3631/files/analyzing_repeat_victimization.pdf">Department of Justice, Office of Community Oriented Policing Services</a>.</li><li>NCJRS Virtual Library — Repeat Victimization</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4324d2f35bfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Query Analysis: Calculating Bounce Rate]]></title>
            <link>https://medium.com/@jtlowry2/query-analysis-calculating-bounce-rate-9fe95ab1715c?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe95ab1715c</guid>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[web-analytics]]></category>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[marketing-analytics]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 13:02:55 GMT</pubDate>
            <atom:updated>2026-02-17T13:02:55.035Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently started a new role were Heap Analytics is used as part of the tech stack. While this platform has many positives a downside is the need to calculate trivial metrics once the data has been exported into BigQuery.</p><h4>Defining Bounce Rate</h4><p>Through my research I found various platforms define bounce rate differently.</p><p>For example, Heap takes a simplified approach according to their common queries formula. It is defined as the percentage of sessions where a visitor views only one page on a website before leaving.</p><p>So the percentage of sessions with a single page view.</p><p>On the other hand, GA4 has a more nuanced definition of bounce rate.</p><p>They define it as the percentage of total sessions that were not engaged sessions. Which is represented as the inverse of the engagement rate.</p><pre>Bounce Rate = 100% - Engagement Rate</pre><p>They define an engaged session as:</p><ul><li>Last longer than 10 seconds</li><li>Has a <a href="https://support.google.com/analytics/answer/9355848">key event</a></li><li>Has 2 or more screen or page views</li></ul><h4>Calculating Bounce Rate</h4><p>Heap Analytics</p><pre>WITH data as (<br>  SELECT time::date as day, session_id, count(*) as pageviews<br>  FROM heap_production.pageviews<br>  GROUP BY 1,2<br>)<br>SELECT day, count(case when pageviews = 1 then 1 else null end) / count(*) as bounce_rate<br>from data<br>GROUP BY 1<br>ORDER BY 1</pre><p>GA4 Calculation</p><p>This bounce rate calculation reconstructs GA4 session behavior directly from BigQuery export data by modeling engagement criteria rather than relying on a pre-built metric. Since GA4 does not store bounce rate explicitly, the query derives it by identifying sessions that fail engagement thresholds (less than 10 seconds duration, fewer than 2 page views, and no conversion event).</p><p>The approach highlights three key analytical insights:</p><ol><li><strong>Bounce rate in GA4 is a derived metric</strong>, not a stored one.</li><li><strong>Session duration is approximated using timestamp spread</strong>, which may differ slightly from GA4’s internal engagement-time logic.</li><li><strong>Bounce is defined behaviorally</strong>, meaning it reflects low-intent sessions rather than simply “single-page visits” as in Universal Analytics.</li></ol><pre>----------------------------------------------------------------------------------------------------&gt;<br>-- Bounce Rate Conceputal Work<br>----------------------------------------------------------------------------------------------------&gt;<br><br>&quot;&quot;&quot;<br>Bounce Rate: <br><br>The percentage of sessions where a visitor views only one apage on a website before leaving, without any interaction.<br><br>GA4&#39;s definition of a bounced session is:<br><br>A session is considered engaged if it meets any of these:<br> * &gt;= seconds of engagement time<br> * &gt;= 2 page/screen views<br> * Or contains a conversion event<br><br>&quot;&quot;&quot;<br><br>WITH base AS (<br><br>  SELECT<br>    user_pseudo_id,<br>      (<br>        SELECT value.int_value<br>        FROM UNNEST(event_params)<br>        WHERE key = &quot;ga_session_id&quot;) AS ga_session_id,<br>    TIMESTAMP_MICROS(event_timestamp) AS time_converted,<br>    event_name<br><br>  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`<br>  WHERE _TABLE_SUFFIX BETWEEN &#39;20210101&#39; AND &#39;20210131&#39;<br><br>),<br><br>duration AS (<br><br>  SELECT<br>    MIN(time_converted) AS start_time,<br>    MAX(time_converted) AS end_time,<br>    CONCAT(user_pseudo_id, &quot;_&quot;, ga_session_id) AS u_id,<br>    TIMESTAMP_DIFF(MAX(time_converted), MIN(time_converted), SECOND) AS session_duration<br>  FROM base<br>  GROUP BY u_id<br>  HAVING TIMESTAMP_DIFF(MAX(time_converted), MIN(time_converted), SECOND) &lt; 1800<br><br>),<br><br>-- page views per session calc<br>event_count AS (<br><br>  SELECT<br>    COUNTIF(event_name=&quot;page_view&quot;) AS page_views,<br>    COUNTIF(event_name=&quot;purchase&quot;) AS purchases,<br>    CONCAT(user_pseudo_id, &quot;_&quot;, ga_session_id) AS u_id<br>  FROM base<br>  GROUP BY u_id<br><br>)<br><br>SELECT<br>  SUM(bounced) / count(*) AS bounce_rate,<br>  ROUND(SAFE_DIVIDE(SUM(bounced), count(*)), 4) AS bounce_rate_pct<br>FROM (<br><br>  SELECT<br>    d.u_id,<br>    d.session_duration,<br>    e.page_views,<br>    e.purchases,<br>    CASE<br>        WHEN d.session_duration &lt; 10 AND e.page_views &lt; 2 AND e.purchases = 0 THEN 1 -- 1 indicates bounced session<br>        ELSE 0<br>    END AS bounced<br>  FROM duration AS d<br>  LEFT JOIN event_count AS e<br>    ON d.u_id = e.u_id<br><br>)</pre><h4>My Takeaway</h4><p>Calculating bounce rate is far less straightforward than it first appears. What seems like a “trivial” metric is actually a reflection of how a platform defines user engagement.</p><p>Heap’s definition is simple and pageview-based: a bounce is a session with only one pageview. This makes it easy to compute once the data is exported into BigQuery, but it assumes that meaningful engagement only happens through additional pageviews.</p><p>GA4, on the other hand, reframes bounce rate as the inverse of engagement. Instead of asking “Did the user view more than one page?”, it asks “Did the session demonstrate meaningful interaction?” That interaction may come from time on site, multiple views, or a key event. As a result, bounce becomes a behavioral classification rather than a structural one.</p><p>Reconstructing GA4’s bounce rate in BigQuery highlights an important analytical lesson: metrics are not universal truths they are definitions layered on top of event logic. When working with exported data, analysts must explicitly model those definitions. Doing so forces clarity around assumptions, session reconstruction, and engagement thresholds.</p><p>Ultimately, the exercise reinforces a broader point: understanding how a metric is defined is just as important as calculating it.</p><p>Without that context, comparisons across tools or even across teams can be misleading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe95ab1715c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Standard Error and How Does it Relate to AB Testing?]]></title>
            <link>https://medium.com/@jtlowry2/what-is-standard-error-and-how-does-it-relate-to-ab-testing-d7efe7fc9f9c?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7efe7fc9f9c</guid>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Fri, 12 Sep 2025 21:02:11 GMT</pubDate>
            <atom:updated>2025-09-12T21:02:11.969Z</atom:updated>
            <content:encoded><![CDATA[<p>A primary goal of analysis is to estimate a characteristic of a population using a sample of data taken from that population. We may wish to estimate the expected value of a population using the sample mean.</p><p>Given this is an estimated parameter it is almost never exact. Therefore all estimates have an element of error associated with them. This is where the concept of the standard error comes from.</p><p>The standard error is, roughly speaking the typical magnitude of the estimation error.</p><p>According to <a href="https://statisticsbyjim.com/basics/difference-standard-deviation-vs-standard-error/">Statistics by Jim</a>, the standard error quantifies the variability between samples drawn from the same population. It assesses how far a sample statistic likely falls from a population parameter.</p><p>The standard error helps to quantify the variability or precision of a sample statistic. Like the average conversion rate across repeated samples.</p><p>The smaller the standard error the more precise the estimate. The larger the standard error the more uncertainty.</p><h4>Standard Error Formula</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*n8zwq-Z_0oEm-tnkYI9GgA.png" /><figcaption>Standard Error v. Standard Deviation Formula</figcaption></figure><p>The standard error is comprised of the standard deviation divided by the square root of the sample size or the number of observations in a sample.</p><p>In order to calculate the standard deviation used in our standard error calculation we take the summation of the difference between our observed population value and our population mean squared, divided by the size of the population and finally we take the square root.</p><h4>A/B testing</h4><p>So, how does this relate to running a/b tests or experiments?</p><p>Well in an a/b test, you’re observing a sample of users who observe one of two landing pages. And ultimately we are interested in the true population like what the true conversion rate would be if everyone saw landing page A vs. landing page B.</p><p>And because sample statistics vary due to random sampling we need a way to quantify the sampling variability.</p><p>This is what the standard error does.</p><h4>Simulation Breakdown</h4><p>Let’s dig into an example simulating our standard error.</p><p>Let’s say we have a population of 1000 values with a mean of 10 and a standard deviation of 2.</p><p>The below code creates our population dataset which consist of 1000 observations with a mean of 10 and a standard deviation of 2.</p><pre>population = rnorm(1000, mean=10, sd=2) </pre><p>Our data looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*phrx_wZ6yO9pSd5_rTb3-Q.png" /></figure><p>Viewing it in a boxplot format we can see the mean of our population is 10 with a several outliers in both directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*hj-aulctbya_uc7XVZVHvg.png" /></figure><p><strong>Calculating the Standard Error</strong></p><p>To calculate the standard error we randomly draw 10 samples that each consist of 10 observations from our population dataset and calculate the mean value.</p><p>The code below establishes a sample size of 10 and randomly selects 10 observations for each sample set of data.</p><pre>sample_size = 10<br><br>sample_means = replicate(10, mean(sample(population, size = sample_size, replace=FALSE)))</pre><p>We can see below our mean from our sample means is a bit higher than when we calculated for our population below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*SM8RFJ-e_tKoFDG1DARVBw.png" /></figure><p>From there we can calculate the Standard Error using the formula mentioned previously.</p><pre>std.error = sd(sample_means) / sqrt(100)</pre><p>We first calculate the standard error using the function sd then divide it by the square root of 100 which represents the number of total observations in our sample size.</p><p>In summary, the standard error is a core concept when interpreting the results of an A/B test. It gives us confidence into the validity of the results and how precise our estimates are.</p><p>Additionally, since A/B tests draw only from a sample of users from a larger population, their results are inherently subject to random sample variation. The standard error quantifies this variation by estimating how far a sample statistic such as conversion rate or mean might from the true population value if the experiment were repeated many times.</p><p>By incorporating the standard error into your analysis, you gain a clearer understanding of how much confidence you can place in your observed differences between variants, making it an essential tool for drawing reliable conclusions from experimental data.</p><p>Shedden, Kevin. “Standard Errors.” <em>Introduction to Data Science</em>, University of Michigan Department of Statistics, <a href="https://dept.stat.lsa.umich.edu/~kshedden/introds/topics/standard_errors/">https://dept.stat.lsa.umich.edu/~kshedden/introds/topics/standard_errors/</a>. Accessed 12 Sept. 2025.</p><p>Frost, Jim. “Difference Between Standard Deviation and Standard Error.” <em>Statistics By Jim</em>, <a href="https://statisticsbyjim.com/basics/difference-standard-deviation-vs-standard-error/">https://statisticsbyjim.com/basics/difference-standard-deviation-vs-standard-error/.</a> Accessed 12 Sept. 2025.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7efe7fc9f9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cosine Similarity Explained: SEO Applications, Machine Learning, and Python Examples]]></title>
            <link>https://medium.com/@jtlowry2/cosine-similarity-explained-seo-applications-machine-learning-and-python-examples-0fcbe728fba2?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fcbe728fba2</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[technical-seo]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 19:06:22 GMT</pubDate>
            <atom:updated>2025-08-31T19:06:22.946Z</atom:updated>
            <content:encoded><![CDATA[<p>Cosine Similarity is a mathematical concept that’s becoming more relevant in SEO and machine learning discussions. In SEO, it’s used for keyword clustering, content analysis, and duplicate detection. In machine learning, it powers tasks like document classification, recommendation engines, and search retrieval.</p><p>I first encountered Cosine Similarity at Georgia Tech while studying programming and data science. More recently, I came across it in a Deep-ML challenge that asked me to calculate the Cosine Similarity between two vectors. Let’s break down what it is, how it works, and why it’s so useful.</p><h3>What Is Cosine Similarity?</h3><p>Cosine Similarity is a measure of similarity between two non-zero vectors in an inner product space. Instead of looking at magnitude (how long the vectors are), it measures the <strong>cosine of the angle between them</strong>.</p><ul><li>If the angle is 0° (vectors pointing in the same direction), similarity = 1.</li><li>If the vectors are orthogonal (90°), similarity = 0.</li><li>If the vectors point in opposite directions (180°), similarity = –1.</li></ul><p>In simple terms: it tells us how “close” two sets of numbers are, regardless of scale.</p><p>The formula looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*0yJkI6hcWCQAB9Q745bBtQ.png" /></figure><p>Where:</p><ul><li><strong>A * B </strong>is the dot product of the vectors</li><li>||<strong>A</strong>|| and ||<strong>B</strong>|| are their Euclidean magnitudes</li></ul><h3>Vectors in Plain English</h3><p>A vector is just a sequence of numbers. For example:</p><pre>import numpy as np<br><br>v1 = np.array([1, 2, 3])<br>v2 = np.array([4, 5, 6])</pre><p>Geometrically, you can think of vectors as arrows in space. Cosine similarity is simply comparing the angle between these arrows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*3ia6HUBeaqYKj2-03XHBVg.png" /></figure><h3>Cosine Similarity vs Other Distance Measures</h3><p>There are other distance measures you might encounter in machine learning:</p><ul><li>Euclidean: Straight line distance measure commonly used in Clustering and K-means</li><li>Manhattan: Grid-based distance measure</li><li>Minkowski: generalized distance metric</li><li>Cosine: angle between vectors, text similarity</li></ul><p>The key difference: <strong>Cosine ignores magnitude</strong>, making it ideal for comparing text or keyword frequency vectors.</p><h3>How to Calculate Cosine Similarity in Python</h3><p>Here’s my implementation in NumPy:</p><pre>def cosine_similarity(v1, v2):<br>    &quot;&quot;&quot;<br>    Return the cosine similarity of two vectors with matching shapes<br>    &quot;&quot;&quot;<br>    if v1.shape == v2.shape and v1.shape[0] != 0 and v2.shape != 0:<br>        # calculate the dot product<br>        dotProd = np.dot(v1, v2)<br>        # calculate the L2 norm:<br>        # 1. square each element in the vector<br>        # 2. sum them together<br>        # 3. take the square root<br>        prodL2 = np.sqrt(np.sum(v1**2)) * np.sqrt(np.sum(v2**2))<br><br>        return round(dotProd / prodL2, 3)<br>    <br>    else:<br>        return None<br><br><br># Example usage<br>v1 = np.array([1, 2, 3])<br>v2 = np.array([4, 5, 6])<br>print(cosine_similarity(v1, v2))  # Output: ~0.9746</pre><h3>Applications in SEO and Information Retrieval</h3><p>In SEO, you can use Cosine Similarity to:</p><ul><li><strong>Cluster Keywords</strong>: Group related terms into themes for content strategy.</li><li><strong>Detect Duplicate Content</strong>: Identify near-identical product descriptions or pages.</li><li><strong>Optimize Internal Linking</strong>: Suggest contextually similar pages to link together.</li><li><strong>E-commerce SEO</strong>: Compare product titles, descriptions, or categories to improve catalog navigation.</li></ul><p>Search engines themselves use Cosine Similarity (and related techniques) to evaluate how similar a query is to a document.</p><h3>Limitations of Cosine Similarity</h3><p>One downside is <strong>magnitude blindness</strong>.</p><p>For example:</p><pre>Vector A = [1, 2, 3]<br>Vector B = [2, 4, 6]</pre><p>These vectors point in the exact same direction, so their cosine similarity = 1, even though one is scaled differently.</p><p>This can be an issue if magnitude (frequency, weight, or importance) matters.</p><h3>Key Takeaways</h3><ul><li><strong>Cosine Similarity</strong> measures the angle between vectors, not their magnitude.</li><li>It’s widely used in <strong>SEO</strong> (keyword clustering, duplicate detection) and <strong>machine learning</strong> (classification, recommendation, search).</li><li>The formula is simple: dot product divided by product of magnitudes.</li><li>Python’s NumPy makes implementation straightforward.</li><li>While powerful, it doesn’t account for differences in scale (magnitude blindness).</li></ul><p>If you’re an SEO professional, think of Cosine Similarity as a mathematical way to group related keywords and understand semantic relationships in your content.</p><p>You can view my entire implementation of <a href="https://github.com/jrdnlwry/python-practice-problems/blob/main/CosineSimilarity.ipynb">Cosine Similarity along with a simple vector embedding on my GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fcbe728fba2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predictive Winbacks That Print Money]]></title>
            <link>https://medium.com/@jtlowry2/predictive-winbacks-that-print-money-fff5661cd331?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/fff5661cd331</guid>
            <category><![CDATA[digital-marketing]]></category>
            <category><![CDATA[web-analytics]]></category>
            <category><![CDATA[ga4]]></category>
            <category><![CDATA[ppc-marketing]]></category>
            <category><![CDATA[google-analytics]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 21:08:47 GMT</pubDate>
            <atom:updated>2025-08-24T21:29:12.633Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How GA4’s predictive audiences are quietly minting revenue for leading brands and how you can replicate their success.</em></p><h3>Big Idea</h3><p>Most businesses still treat Google Analytics 4 (GA4) as a dashboard upgrade. But companies like McDonald’s, ASDA, and Líder have already discovered something bigger: <strong>GA4’s predictive audiences can be activated directly into campaigns that win back lapsed users and multiply revenue.</strong></p><p>This is not a theory. It’s <strong>documented revenue lift</strong> in the triple- and quadruple-digit range, thanks to a feature that’s already sitting inside GA4 free for those who know how to turn it on.</p><h3>Why Now?</h3><p><strong>Universal Analytics is gone.</strong> GA4 is the only relevant game in town.</p><p><strong>Privacy is tightening.</strong> Predictive features let you use <em>first-party signals</em> instead of relying on third-party cookies.</p><p><strong>Budgets are scrutinized.</strong> Executives want <strong>proof of ROI</strong>, not more impressions or other vanity metrics.</p><p>In short: if you can turn predictive audiences into <strong>cheaper conversions and higher ROAS</strong>, you’re ahead of 80% of your peers.</p><h3>What the Winners Did (Proof in Action)</h3><h3>McDonald’s Hong Kong</h3><p><strong>Business Problem</strong></p><p>McDonald’s Hong Kong had invested heavily in <strong>driving mobile app installs</strong> through promotions, media buys, and partnerships. While acquisition numbers looked strong, the <strong>engagement cliff</strong> was steep:</p><ul><li>Many users downloaded the app to redeem an offer but never came back.</li><li>Re-engagement campaigns were broad and expensive, targeting all inactive users without precision.</li><li>ROI pressure was rising: leaders wanted more <strong>transactions, not just installs</strong>.</li></ul><p>The <strong>core issue:</strong> High app penetration, but <strong>revenue per user plateauing</strong> because retention was weak.</p><p><strong>GA4 Analytic Insight</strong></p><p>Using GA4’s <strong>predictive audiences</strong>, the analytics team identified a crucial insight:</p><ul><li>Within the pool of inactive users, GA4 could <strong>predict which subset was still likely to purchase within the next 7 days</strong> (based on event history, session behavior, and conversion probability models).</li><li>Instead of wasting spend on the entire dormant user base, they now had a <strong>high-intent micro-segment</strong> to target.</li></ul><p>This insight reframed the strategy: <strong>not all inactive users are equally “lost.” Some are on the verge of reactivation if nudged correctly.</strong></p><p><strong>System Design</strong></p><p>The pipeline was straightforward but powerful:</p><ol><li><strong>GA4 events</strong> (installs, app opens, cart actions, prior purchases).</li><li><strong>GA4 predictive audiences</strong> auto-classified “Likely 7-day purchasers.”</li><li><strong>Exported directly</strong> to Google Ads as a re-engagement audience.</li><li><strong>Campaign creative tailored</strong> to highlight timely food offers and discounts.</li></ol><p>In essence: <em>GA4 → Predictive Audiences → Ads Activation → Sales.</em></p><h3>Intervention</h3><p>Armed with this audience, McDonald’s ran <strong>targeted app re-engagement campaigns</strong>:</p><ul><li><strong>Messaging:</strong> Reminded users of convenience (“tap to order”), exclusive app-only deals, and delivery speed.</li><li><strong>Budget shift:</strong> Reduced spend on broad retargeting; redirected toward predictive high-intent users.</li><li><strong>Execution:</strong> A/B tested creatives for meal bundles vs. discounts, ensuring the right triggers drove conversion.</li></ul><p><strong>Measured Impact</strong></p><p>The results were dramatic:</p><ul><li><strong>+550% increase in in-app orders.</strong></li><li><strong>+560% revenue lift from the predictive audience segment.</strong></li><li>Lower cost-per-order vs. broad retargeting.</li></ul><p>For executives, the key was not just the lift, but the <strong>proof that GA4 predictions could directly translate into cash flow</strong>.</p><p><strong>Executive Takeaway</strong></p><ul><li><strong>Predictive audiences = efficiency lever.</strong> Instead of re-engaging everyone, focus only on the <em>likely buyers</em>.</li><li><strong>App growth ≠ revenue growth.</strong> Install campaigns must be paired with smart reactivation.</li><li><strong>GA4 can be an activation engine, not just a reporting tool.</strong></li></ul><p><strong>“Copy This” Checklist (for any brand with an app)</strong></p><ul><li>Enable Enhanced Measurement + purchase events in GA4.</li><li>Check predictive audience eligibility (needs 1,000+ users/events per 7 days).</li><li>Create “Likely 7-day purchasers” audience</li><li>Export to Ads as a remarketing segment.</li><li>Run controlled re-engagement campaigns with offer-based creatives.</li><li>Benchmark against generic retargeting to prove ROI.</li></ul><blockquote><a href="https://marketingplatform.google.com/about/resources/mcdonald-hong-kong-uses-google-analytics-4-to-increase-in-app-orders-by-550-percent/">McDonald’s Hong Kong uses Google Analytics 4 to increase in-app orders by 550%</a></blockquote><h3>ASDA (UK Grocer)</h3><p><strong>Business Problem</strong></p><p>ASDA, one of the UK’s largest grocery retailers, faced a common growth wall in digital advertising:</p><ul><li>Their <strong>standard retargeting campaigns</strong> were running out of steam.</li><li>As campaigns matured, <strong>conversion rates plateaued</strong> and cost-per-acquisition (CPA) began climbing.</li><li>Expanding audiences meant reaching less qualified shoppers, which eroded media efficiency.</li></ul><p>The challenge was clear: <strong>keep growing online sales without ballooning acquisition costs.</strong></p><p><strong>GA4 Analytic Insight</strong></p><p>ASDA’s analytics team turned to <strong>GA4’s predictive audiences</strong>.</p><ul><li>GA4 uses machine learning models to identify <strong>“likely to purchase soon”</strong> segments, based on signals like session frequency, basket activity, and micro-conversions (e.g., add-to-cart, product views).</li><li>Instead of retargeting <em>all visitors</em>, ASDA now had a <strong>dynamic, high-intent pool</strong> refreshed daily by GA4’s models.</li></ul><p>This transformed their campaign targeting from <strong>reactive (“who visited”)</strong> to <strong>predictive (“who will buy next”).</strong></p><p><strong>System Design</strong></p><p>The flow looked like this:</p><ol><li><strong>GA4 data</strong> collected across ASDA’s ecommerce site.</li><li><strong>Predictive audiences</strong> automatically segmented “likely to purchase soon” users.</li><li><strong>Export to DV360</strong> (Google’s demand-side platform).</li><li><strong>Layer predictive segments</strong> onto existing campaigns alongside affinity/retargeting audiences.</li><li><strong>Optimize bids and budgets</strong> toward these predictive users.</li></ol><p>In essence: <em>GA4 → Predictive Audiences → DV360 activation → Media efficiency.</em></p><p><strong>Intervention</strong></p><p>With predictive segments in place, ASDA refined its digital media strategy:</p><ul><li><strong>Audience layering:</strong> Predictive segments combined with standard retargeting to sharpen precision.</li><li><strong>Creative alignment:</strong> Campaigns highlighted convenient shopping, fresh offers, and delivery options to match buyer intent.</li><li><strong>Budget reallocation:</strong> Diverted spend away from broad, low-converting audiences toward GA4-defined high-value ones.</li></ul><p><strong>Measured Impact</strong></p><p>The campaign shift delivered <strong>tangible bottom-line results</strong>:</p><ul><li><strong>+84% Return on Ad Spend (ROAS)</strong> compared to baseline.</li><li><strong>–48% CPA</strong>, nearly halving the cost of acquiring a new customer.</li></ul><p>For ASDA’s marketing leadership, this proved that GA4 wasn’t just an analytics upgrade — it was a <strong>profitability engine.</strong></p><p><strong>Executive Takeaway</strong></p><ul><li><strong>Efficiency isn’t about spending less; it’s about spending smarter.</strong> Predictive audiences help media budgets chase high-probability buyers, not cold traffic.</li><li><strong>Plateaued retargeting isn’t the end of growth.</strong> GA4’s models inject fresh lift into campaigns that otherwise stagnate.</li><li><strong>This is transferable.</strong> Any retailer with sufficient data volume can replicate ASDA’s playbook.</li></ul><p><strong>“Copy This” Checklist (for retailers running paid media)</strong></p><ul><li>Ensure GA4 purchase events and enhanced ecommerce tracking are firing correctly.</li><li>Confirm predictive audiences are eligible (1,000+ purchasers/events over 7 days).</li><li>Create “likely to purchase soon” audiences inside GA4.</li><li>Export these audiences into DV360 (or Google Ads).</li><li>Layer predictive audiences with existing retargeting campaigns.</li><li>Benchmark CPA/ROAS against baseline retargeting.</li></ul><blockquote><a href="https://uk.sparkfoundryww.com/case-studies/asda-drives-incrementality-ga4s-predictive-audiences">ASDA drives incrementality with GA4’s predictive audiences</a></blockquote><h3>Líder (Walmart Chile)</h3><h3>Business Problem</h3><p>As one of Chile’s largest grocery retailers, <strong>Líder</strong> already had <strong>strong web and app traffic</strong> thanks to brand recognition and aggressive customer acquisition. However, the numbers revealed a problem:</p><ul><li><strong>High traffic ≠ high conversions.</strong> While site visits and app downloads were robust, the actual <strong>purchase rate through the app was lagging.</strong></li><li>Retargeting campaigns were too broad, serving ads to anyone who interacted with the app or site, regardless of their purchase intent.</li><li>This scattershot approach <strong>drove up CPAs</strong> and diluted the efficiency of digital marketing budgets.</li></ul><p><strong>The challenge:</strong> How to <strong>convert more of the existing traffic into paying customers</strong> without overspending on generic retargeting.</p><h3>GA4 Analytic Insight</h3><p>Líder leveraged GA4’s <strong>predictive audiences</strong> to get a sharper read on user intent:</p><ul><li>GA4 flagged users with a <strong>high probability of making a purchase within the next 7 days</strong>, both on <strong>web and mobile app</strong> platforms.</li><li>This “Likely 7-day purchasers” segment effectively filtered out low-intent browsers, leaving only the <strong>subset of visitors most primed to buy.</strong></li></ul><p>By moving from “everyone who touched the app” to “likely buyers in the next week,” Líder reframed its retargeting strategy around <strong>probability, not possibility.</strong></p><h3>System Design</h3><p>The activation pipeline looked like this:</p><ol><li><strong>GA4 tracking</strong> across web and app captured user behavior (sessions, carts, product views, and prior purchases).</li><li><strong>Predictive audiences</strong> were auto-generated in GA4.</li><li><strong>Audience export to Ads/DV360</strong>, creating a live segment of high-intent users.</li><li><strong>Custom re-engagement campaigns</strong> tailored specifically to this audience.</li></ol><p>Simple but powerful: <em>GA4 → Predictive Audiences → Ads Activation → Measurable lift.</em></p><h3>Intervention</h3><p>Armed with this predictive audience, Líder adjusted its media campaigns:</p><ul><li><strong>Targeting precision:</strong> Focused spend only on users tagged as “likely 7-day purchasers.”</li><li><strong>Creative messaging:</strong> Highlighted timely grocery offers, free delivery thresholds, and app-only promotions.</li><li><strong>Cross-platform coverage:</strong> Ensured predictive segments were activated for both web and app journeys, unifying the experience.</li></ul><h3>Measured Impact</h3><p>The results were immediate and compelling:</p><ul><li><strong>–85% CPA</strong> compared to broad retargeting campaigns.</li><li><strong>5.4% conversion rate (CVR)</strong> within the predictive audience segment.</li></ul><p>This wasn’t just a performance improvement, it was a <strong>step change in marketing efficiency</strong>. Líder proved that precision targeting with GA4 could dramatically reduce waste while lifting conversions.</p><h3>Executive Takeaway</h3><ul><li><strong>Traffic is not the bottleneck conversion is.</strong> GA4 predictive segments help focus effort where it counts.</li><li><strong>High-intent users deliver outsized ROI.</strong> The cost savings (–85% CPA) show the power of prediction over broad retargeting.</li><li><strong>Cross-platform predictive targeting ensures consistency.</strong> Líder won by unifying app + web audiences into one predictive strategy.</li></ul><h3>“Copy This” Checklist (for multi-channel retailers)</h3><ul><li>Ensure GA4 predictive audiences are enabled across both <strong>web and app</strong>.</li><li>Define “Likely 7-day purchasers” as a custom audience.</li><li>Export audience into Ads/DV360.</li><li>Build tailored creatives for app vs. web users (promo codes, delivery offers, etc.).</li><li>Benchmark against broad retargeting CPA/CVR to validate lift.</li></ul><p>Predictive audiences act as <em>filters for money in motion</em>. Instead of wasting ad spend on everyone, brands bet big on users GA4 deems <em>most likely to buy soon</em>.</p><blockquote><a href="https://marketingplatform.google.com/about/resources/lider-drives-in-app-purchases-at-a-lower-cpa-with-google-analytics/">Líder drives in-app purchases at a lower CPA with Google Analytics</a></blockquote><h3>Why Losers Miss Out</h3><ul><li>They never enable predictive audiences (requires Enhanced Ecommerce + sufficient event volume).</li><li>They focus only on reports, not <strong>activation</strong> (i.e., exporting audiences to Ads).</li><li>They lack server-side tagging or data quality, so GA4 models never hit eligibility.</li><li>They run campaigns on “all visitors,” burning budget on low-intent users.</li></ul><p>Not fixing your measurement infrastructure is like printing money — then lighting it on fire.</p><h3>Risk &amp; Gotchas</h3><ul><li><strong>Data gaps</strong>: If events aren’t tracking cleanly, models won’t populate.</li><li><strong>Small volumes</strong>: Low traffic sites may never hit eligibility.</li><li><strong>Blind faith</strong>: Always A/B test predictive segments against baselines.</li><li><strong>Costs</strong>: BigQuery export helps debug but adds cloud spend.</li></ul><h3>Self-Assessment: Are You Ready?</h3><ul><li>Do we track purchases and engagement cleanly in GA4?</li><li>Is Enhanced Ecommerce configured?</li><li>Are GA4 audiences linked to Ads/DV360?</li><li>Do we run A/B tests on predictive vs. standard retargeting?</li><li>Have we documented revenue impact?</li></ul><p>If you answered <strong>“no”</strong> to more than two, you’re not yet set up to print predictive winbacks.</p><p>I help brands like yours <strong>fix tracking, configure Enhanced Ecommerce, and unlock predictive audiences</strong> so you can turn analytics into actual ROI.</p><p>👉 <a href="https://calendly.com/jrdnlwry/30min">Book a GA4 Audit Call</a> to get a clear roadmap in under 30 minutes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fff5661cd331" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Marketing Mix Modelling with Regression]]></title>
            <link>https://medium.com/@jtlowry2/marketing-mix-modelling-with-regression-6784c1e796b0?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/6784c1e796b0</guid>
            <category><![CDATA[attribution]]></category>
            <category><![CDATA[marketing-mix-modeling]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Sun, 17 Aug 2025 22:42:21 GMT</pubDate>
            <atom:updated>2025-08-17T22:42:21.458Z</atom:updated>
            <content:encoded><![CDATA[<p>Marketing Mix Modeling encompasses using statistical techniques to analyze how different marketing channels influence sales. Statistical models are typically used for explanatory and predictive modeling.</p><p>This particular concept has came up recently for me across multiple job interviews so I wanted to explore this topic deeper and begin to build some familiarity.</p><p>According to Marketing Mix Modelling from multiple regression perspective, there are two key challenges: multicollinearity and selection of informative variables.</p><h3>Model Selection</h3><p>There are a variety of methods and approaches to Marketing Mix Modelling.</p><p>There are Bayesian Methods that make use of prior knowledge accumulated in previous media mix models (Jin, Wang, Sun, Chan, &amp; Koehler, 2017). Additionally, there are even open source models like <a href="https://developers.google.com/meridian/notebook/meridian-getting-started">Google’s Meridian</a>.</p><p>While there are a variety of model methods and approaches to use I chose to explore using a linear model. This is one of the most commonly applied functional forms in Marketing Mix Modelling. (Mhitarean-Cuvsinov, n.d.)</p><p>These linear models assume the following simple structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*OkkMtikivLZBtcurMwzI_Q.png" /></figure><ul><li>beta_0: intercept</li><li>beta_n: represents our predictor variables</li><li>epsilon: represents the estimated error term</li></ul><p>A big advantage of a linear model is its ease of interpretation. However, a drawback of these models is the linearity assumption implies constant returns to scale. (Mhitarean-Cuvsinov, n.d.)</p><h3>Feature Engineering</h3><p>I want to address the problem of creating informative variables by creating features that model diminishing returns, carryover effects and decompose the time series data to create lagged trends.</p><p><strong>Diminishing Returns and Carryover Effects</strong></p><p>These two concepts can be summed up to:</p><ol><li>As we spend more money on a channel we experience diminishing returns</li><li>Just because we spend money on a campaign this week does not mean we can expect sales to occur within the same week — there’s a carry over effect</li></ol><p>In the context of marketing and media spend there is usually a point of diminishing returns. Meaning, every dollar spent on paid search may not always yield a two dollar return.</p><p>Jin, Wang, Sun, Chan, and Koehler (2017) describe using a hill function equation to capture the relationship of diminishing returns from media spend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*66jUqgsJWyDK-a7hF7YWww.png" /></figure><p>Additionally, there are other functions that can capture this relationship within our data. Kübler (2021) describes using a simplified exponential function to capture this relationship.</p><p>In my approach I decided to test both approaches and validate how they impact the model’s predictive power.</p><p>When it comes to carry over effects we can use the <em>adstock</em> function to model this effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*QmVJhg1-lqfxhlvckMr1Wg.png" /></figure><p>Jin, Wang, Sun, Chan, and Koehler (2017) describes this as:</p><p>The cumulative media effect is a weighted average of media spend in the current week and previous <em>L-1</em> weeks. Where <em>L</em> is the maximum duration of carryover effect assumed for a medium.</p><p><strong>Leveraging Historic Sales Data</strong></p><p>In addition to the other features I wanted to explore using historic sales data to inform the model. My plan was to decompose the sales data and extract the trends to add predictive power. I decided to use Holt-Winters seasonal method which leverages three smoothing equations. The level, trend and seasonal component with corresponding smoothing parameters alpha, beta and gamma.</p><p>I used the additive method below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*TsAsUmFH0Tth6XAAOyJaWA.png" /></figure><p>Overall my plan is to test 4 different types of models with the main KPI being the Mean Squared Prediction Error as a measure of success.</p><p>This measures the expected squared distance between what each predictor predicts for a specific value and what that true value is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*AQ6RzKtfXkLmUY4lmhznUw.png" /></figure><p>I will calculate this metric for each of the four models.</p><h3>Generating Synthetic Data</h3><p>Jin, Wang, Sun, Chan, and Koehler (2017) describes using an ARIMA method to generate time series data with sinusoidal seasonality. Sinusoidal seasonality refers to the periodic and predictable patterns in time series data that occurs at specific regular intervals.</p><p>Additionally, I add noise to the data using a normal distribution with a mean of zero and a standard deviation of 1 to introduce a bit of randomness that you would expect to see in real data.</p><p>When I take the sales data, put it in a time series object and decompose it we can see the noise represented below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*u4f5-Yezuoe6GrhpFs9Bcg.png" /><figcaption>Randomness within the data</figcaption></figure><h3>Training the Models</h3><p><strong>Model 1</strong></p><p>The first model trained only had each media’s spend as the features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*ZCmourlnNZTE3sr8p5FIPg.png" /></figure><p>We can see the model is statistically significant with a p-value below our alpha of 0.05 and a relatively high F-statistic with an adjusted R-squared of 0.7579.</p><p>Note the F-statistic is used to assess the overall significance of the model.</p><p>It is defined as:</p><p>F = MSR / MSE</p><p>The numerator (MSE) represents the explained variability, while MSE represents the unexplained or residual variability.</p><p>Essentially, the higher the F-statistic the better our model is at explaining the variability of the data.</p><p>Additionally, our features are statistically significant and right away it appears that we may be losing money on our display campaigns.</p><p>So far it appears as though each additional unit of display spend is associated with a decrease of ~0.50 units in sales, controlling for TV and search spend.</p><p>This already indicates a negative relationship between display spend and sales.</p><p><strong>Model 2</strong></p><p>For our second model I began adding additional features like the <em>adstock</em> function to capture the delayed effects and the exponential function to model diminishing results from ad spend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*6C0nz1h9PB4sRhjGDdvcpw.png" /></figure><p>We begin to see a significant increase in our adjusted R-squared value at 0.8454 and our model appears statistically significant with a low overall p-value and a relatively high F-statistic even though it’s dropped a bit from the first model.</p><p>We can also run an ANOVA test comparing the baseline model (Model 1) with the extended model (Model 2). The results indicate the additional features (exponential and lagged terms) significantly improve the model fit: the F-statistic is 7.41 with a p-value of 5.25e-06 which is well below the stated alpha of 0.05.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*quYeaFzEq-ZP7SVH8G6oKg.png" /></figure><p>This provides strong evidence that the extra features explain additional variance in sales beyond the baseline media spend variables.</p><p><strong>Model 3</strong></p><p>For our third model I wanted to incorporate the hill function to model the diminishing returns from media spend with the same lagged terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*5iliEqkFUPQntFeZdu4CTw.png" /></figure><p>This model has an adjusted R-squared value of 0.8535 slightly higher than the previous model with an F-statistic slightly higher suggesting it explains more variability within the data.</p><p>Additionally, we can perform an ANOVA with this model against our baseline as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*pFd0kHXj3HZ_Axm5Ykmiyw.png" /></figure><p>We see a higher F-statistic (8.3972 vs 7.41) when comparing this model against our baseline with a p-value (1.126e-06) well below our alpha of 0.05.</p><p>The results indicate the additional features like the Hill function in conjunction with the lagged terms significantly improve the model fit from the baseline.</p><p><strong>Model 4</strong></p><p>This final model test the additional features from using Holt-Winters to decompose the time series data. I chose to use the trend and level data.</p><p>From there I created lagged terms using the prior weeks sales as a predictor for the current weeks sales. The thought process is we can use past sales data to help inform our future sales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*XlULVUWf8LpJwz1jjZ2Opw.png" /></figure><p>We see the overall model is still statistically significant however two key things stick out. First the F-statistic for this model is lower than the prior models and the adjusted R-squared only slightly improved.</p><p>Additionally, the ANOVA test when compared against the baseline model still suggest statistical significance but the F statistic is notably lower compared to the other models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*LxLu2tq_uHsytbrMl5W75A.png" /></figure><p>However, when I use an ANOVA test to compare this 4th model to the 3rd model it indicates the lagged Holt-Winters features are likely not statistically significant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*wSX3h9o4sXKocmFVeprIQw.png" /></figure><h3>Model Performance</h3><p>A final step is to see how well each model predicts future sales in the test data set. This is data the models have not previously seen so we can assess the predictive power of each model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*_TWIAsF0wychrWD6M9UB6A.png" /><figcaption>Performance of each Model</figcaption></figure><ul><li>Model 1: baseline model with media spend as predictors</li><li>Model 2: media spend, exponential function (diminishing returns), adstock</li><li>Model 3: media spend, hill function (diminishing returns), adstock function</li><li>Model 4: media spend, hill function, adstock function, Holt-Winters lagged features</li></ul><p>The biggest improvement to the predictive power of the model came from incorporating additional features to capture lagged effects and diminishing returns of media spend (model1 -&gt; model2).</p><p>Additionally, it does appear the Holt-Winters lagged features appear to also add some incremental improvements to predictive power given the improvements from model3 compared to model4.</p><p>I believe incorporating features that model diminishing returns and lagged effects from media spend provide a strong baseline for building MMM’s.</p><h4>Important Considerations</h4><p>While there was a lot of analysis and research done on there are a few items I want to highlight.</p><p>First, I did not validate all the assumptions of linear regression. Secondly, I did not perform variable selection as part of this research. While selecting informative features is a challenge for building marketing mix models we have variable selection techniques like <a href="https://bookdown.org/staedler_n/highdimstats/ridge-regression-and-shrinkage.html">Ridge Regression</a> and <a href="https://bookdown.org/staedler_n/highdimstats/lasso-regression-and-elasticnet.html">Lasso </a>to help us address multicollinearity issues and select informative features.</p><h3>Tying it all Together</h3><p>This exploration reinforced how critical it is to account for both diminishing returns and carryover effects when building Marketing Mix Models. Even simple linear regression models become far more powerful when lagged terms and non-linear transformations are applied.</p><p>While each modeling approach has tradeoffs, my analysis suggests incorporating adstock functions and diminishing return curves provide the strongest baseline for predictive accuracy.</p><p>I am currently pursuing my M.S. in Computational Analytics and looking for opportunities to apply these methods in real-world settings. If your team is exploring Marketing Mix Modeling, econometric forecasting, or advanced analytics, I’d love to collaborate whether through an internship, research project, or consulting engagement.</p><p>Feel free to connect with me here or on <a href="https://www.linkedin.com/in/lowryjordan/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6784c1e796b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predicting Employee Attrition with Data Science: What Makes People Quit?]]></title>
            <link>https://medium.com/@jtlowry2/predicting-employee-attrition-with-data-science-what-makes-people-quit-b71851420e00?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/b71851420e00</guid>
            <category><![CDATA[human-resources]]></category>
            <category><![CDATA[hrtech]]></category>
            <category><![CDATA[hr]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 18:09:34 GMT</pubDate>
            <atom:updated>2025-04-29T18:09:34.273Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-changing work culture, employee turnover isn’t just expected it’s often inevitable. But while some level of attrition is healthy, high turnover rates can disrupt productivity, affect team dynamics, and cost businesses thousands of dollars per departure.</p><p>So I asked myself:</p><blockquote>Can we use data science to identify what drives employee attrition — and predict who’s most likely to leave?</blockquote><p>Using the <a href="https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset">IBM HR Analytics Attrition dataset</a>, I set out to explore the factors behind attrition through statistical analysis and predictive modeling.</p><h4>The Problem</h4><p>According to a 2024 U.S. Bureau of Labor Statistics report, the median employee tenure is just <strong>3.9 years</strong>. While some see job hopping as a way to grow income and career opportunities, high turnover creates real challenges for organizations.</p><p>My goals were threefold:</p><ol><li><strong>Test</strong> if generational groups differ in their average tenure.</li><li><strong>Identify</strong> which features contribute most to attrition.</li><li><strong>Build</strong> a predictive model using logistic regression.</li></ol><h4>The Dataset</h4><p>The dataset includes 1,470 records of employees, each with 35 features such as:</p><ul><li><strong>Demographic</strong>: Age, gender, marital status</li><li><strong>Job-related</strong>: Department, job role, income</li><li><strong>Engagement</strong>: Job satisfaction, work-life balance</li><li><strong>Attrition</strong>: Whether they left the company</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*ka00u4M_revKw-pcMNo7jA.png" /></figure><h4>Hypothesis Testing with ANOVA</h4><p>To see if tenure differs across generations, I used <strong>One-Way ANOVA</strong>. I grouped employees into:</p><ul><li><strong>Gen Z</strong>: Age &lt; 29</li><li><strong>Millennials</strong>: Age 29–44</li><li><strong>Gen X</strong>: Age 45–60</li></ul><p>Among employees who quit, the average tenure varied significantly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*kf116iIghnzwldd_ibjcqQ.png" /></figure><p>The ANOVA test confirmed this difference was <strong>statistically significant</strong> (<em>p &lt; 0.001</em>). A post-hoc <strong>Tukey’s Test</strong> showed meaningful differences between every generational group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*1FhggoERas2O0yKRaOZpbQ.png" /></figure><h4>Feature Engineering &amp; Encoding</h4><p>Before modeling, I:</p><ul><li><strong>Created generational age brackets</strong></li><li><strong>Encoded categorical variables</strong> with get_dummies()</li><li><strong>Dropped redundant or low-variance features</strong></li><li><strong>Flagged multicollinearity</strong> with VIF scores</li></ul><h4>Tackling Multicollinearity with Lasso</h4><p>To reduce noise and improve model generalization, I used <strong>Lasso Regression</strong> for feature selection. Lasso helped me retain only the most informative variables by penalizing less useful ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*4TAu7-E4HIabwZKRvBSyKQ.png" /><figcaption>Lasso Regression Formula</figcaption></figure><p>Some of the selected features:</p><ul><li>BusinessTravel_Travel_Frequently</li><li>JobRole_Research Scientist</li><li>OverTime_Yes</li><li>age_bracket_Generation Z</li><li>MaritalStatus_Single</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*h4nN-ybwn0UV8ioGpKHw7Q.png" /><figcaption>Feature Selection from Lasso</figcaption></figure><h3>Logistic Regression Model</h3><p>With these selected features, I trained a <strong>Logistic Regression</strong> model:</p><ul><li><strong>Train/test split</strong>: 80/20</li><li><strong>Accuracy</strong>: 87%</li><li><strong>Recall (attrition class)</strong>: 50%</li><li><strong>Confusion Matrix</strong> showed class imbalance, with the model better at predicting who stays vs who leaves</li></ul><h4>Key Findings</h4><p><strong>Increased Risk of Attrition:</strong></p><ul><li><strong>Frequent Business Travel</strong> → 3.7× more likely to quit</li><li><strong>Research Scientists</strong> → 7.4× more likely to quit</li><li><strong>Gen Z Employees</strong> → 5.8× more likely to quit<br> (All statistically significant, <em>p &lt; 0.05</em>)</li></ul><p><strong>Decreased Risk of Attrition:</strong></p><ul><li><strong>Human Resources roles</strong> → 66% <em>less</em> likely to quit</li></ul><p>These insights can guide <strong>retention strategies</strong> for HR teams — like adjusting travel demands or offering more growth paths for early-career Gen Z employees.</p><h3>Takeaways</h3><ul><li><strong>Statistical testing</strong> like ANOVA is invaluable for understanding generational behavior.</li><li><strong>Lasso regression</strong> helps reduce noise and multicollinearity before modeling.</li><li>Even with solid accuracy, <strong>class imbalance</strong> remains a challenge in attrition models — underscoring the need for balanced datasets or alternate modeling approaches.</li></ul><h3>👋Let’s Connect</h3><p>I’m passionate about using data to solve real business problems — especially in areas like workforce analytics, behavioral modeling, and operational strategy.</p><p>If you’re working on similar problems or hiring for data roles, let’s chat!</p><p><a href="https://github.com/jrdnlwry/employee_attrition_CSE-6040/blob/main/CSE6040Project_Employee_Attr.ipynb">GitHub Employee Attrition</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b71851420e00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In recent years, the Town of Cary — a fast-growing city in North Carolina — has faced rising flood…]]></title>
            <link>https://medium.com/@jtlowry2/in-recent-years-the-town-of-cary-a-fast-growing-city-in-north-carolina-has-faced-rising-flood-4e2ac91e91fb?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e2ac91e91fb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 23:38:23 GMT</pubDate>
            <atom:updated>2025-02-10T23:38:23.452Z</atom:updated>
            <content:encoded><![CDATA[<p>In recent years, the Town of Cary — a fast-growing city in North Carolina — has faced rising flood risks. Fueled by rapid urban expansion and its proximity to two major river basins, Cary recognized the need to shift from reacting to flood incidents to proactively predicting and preparing for them.</p><p>As part of this effort, Cary integrated an early warning flood prediction system that collects real-time data from IoT sensors, merges it with weather forecasts, and uses predictive analytics to anticipate flood events. The overarching goal is to protect the city’s residents and support nearby communities downstream of Cary’s watershed.</p><h3>Project Background</h3><p>Cary’s population has tripled in a relatively short time, leading to an influx of new roads, parking lots, and commercial buildings. While this growth boosts the local economy, it also increases stormwater runoff on impervious surfaces like asphalt and concrete, which can overwhelm drainage systems. Additionally, Cary’s close proximity to two major river basins heightens the potential for flooding. Recognizing these challenges, city officials sought to develop a predictive system — rather than only responding after floodwaters rise.</p><p><strong>Key Challenges</strong></p><ul><li><strong>Urban runoff</strong>: Non-absorbent surfaces like roads and sidewalks increase stormwater runoff.</li><li><strong>River proximity</strong>: Being near two major river basins accelerates flood risk.</li><li><strong>Wider impact</strong>: Excess water in Cary affects neighboring communities due to interconnected watersheds.</li></ul><h3>Model Building</h3><p>Cary’s flood prediction system hinges on data gathered from solar-powered, cellular-enabled IoT sensors that record:</p><ul><li>Water height and depth</li><li>Current flow</li><li>Rainfall levels</li></ul><p>This data is uploaded to the cloud and integrated with external weather data (using an open-source weather API as a proxy). The following sections outline each predictive model and its role in the system.</p><h3>Forecasting Rainfall</h3><p><strong>Given {precipitation / rainfall from the weather data and rainfall from active sensor data}, use {a triple exponential smoothing model} to {forecast rainfall}.</strong></p><p>A <strong>Holt-Winters</strong> (triple exponential smoothing) approach is ideal here because it accounts for both trend and seasonality in rainfall data. Accurate forecasts help city officials anticipate potential flood periods and allocate resources proactively.</p><h3>Change Detection</h3><h4>Monitoring Rapidly Changing Weather Conditions</h4><ol><li><strong>Given {rainfall from IoT sensors}, use a {CUSUM model} to {detect changing weather conditions} and {alert IoT sensors to start sending data to the cloud at quicker intervals}.</strong></li><li><strong>Given {river level from IoT sensors}, use a {CUSUM model} to {detect changing river conditions} and {alert IoT sensors to start sending data to the cloud at quicker intervals}.</strong></li></ol><p>The <strong>CUSUM (Cumulative Sum) model</strong> identifies abrupt shifts in sensor readings. When changes are detected, the system increases the frequency of data uploads, improving real-time monitoring. While more frequent uploads could lead to higher data storage costs, this is a relatively small price to pay compared to the risk of missing a critical event.</p><h4>Monitoring Changing Sensor Conditions</h4><p><strong>Given {battery and power levels}, use a {CUSUM model} to {monitor battery levels in the sensors}.</strong></p><p>By tracking battery and power levels, officials can be promptly alerted when a sensor’s energy falls below a predefined threshold. Technicians can then address potential malfunctions before they compromise data collection during a storm.</p><h3>Estimating Storm Variability</h3><p>Rainfall events can vary significantly within the same city, with some areas receiving heavy downpours while neighboring regions remain relatively dry.</p><p><strong>Given {precipitation / rainfall data from IoT sensors} use a {GARCH model} to {estimate the variance during storm events}.</strong></p><p>A <strong>GARCH (Generalized Autoregressive Conditional Heteroskedasticity)</strong> model helps quantify how volatility in rainfall changes over time. By knowing which areas are likely to experience the heaviest rainfall, officials can concentrate resources where they are needed most.</p><h3>Predicting Flood Events</h3><h4>Predicting Overflow from River Basins</h4><p>The city uses solar-powered sensors to measure water height, depth, and current flow in local rivers.</p><p><strong>Given {the river’s water height, depth and flow} use a {Logistic regression model} to {predict the likelihood of a river overflowing}.</strong></p><p>This model calculates the probability that river levels will exceed their banks, informing early flood warnings and allowing time to implement protective measures.</p><h4>Predicting the Likelihood of a Flood Event</h4><p>A second logistic regression model combines multiple data sources:</p><p><strong>Given {pressure systems, temperature, humidity, cloud cover, soil moisture, precipitation, rainfall forecast (exponential model), variability in local precipitation (GARCH model), and data from the CUSUM models (precipitation) and the output of the previous Logistic regression model (probability of the river flooding)} use a {Logistic regression model} to {predict the likelihood of a flood event for the City}.</strong></p><p>By synthesizing weather forecasts, sensor data, and river overflow probabilities, the city can generate a comprehensive, city-wide flood risk prediction score.</p><h3>Optimizing the City’s Response</h3><p>When the model signals a high probability of flooding, response teams must act quickly to minimize damage.</p><p><strong>If the Logistic regression model indicates a high probability of a flood event then:</strong><br><strong>Given {rainfall accumulation (from the sensors), forecasted rainfall, variability in local precipitation (GARCH model), city traffic data (identify which roads are more congested), active emergency request} build an {optimization model} to {determine where and if we should: build barricades, close roads, redirect traffic and how best to respond to active emergencies}.</strong></p><p>This <strong>optimization model</strong> helps departments decide how best to deploy workers, close roads, and manage traffic, ensuring critical areas are protected, and emergency services can operate effectively.</p><h3>Flood Prediction and Response System</h3><h3>Data Dictionary</h3><p>Key factors impacting rainfall and flood events include:</p><p><strong>Moisture Availability</strong></p><ul><li>Rainfall depends on atmospheric moisture, often sourced from oceans, lakes, or other large water bodies.</li><li>High humidity increases the probability of rain.</li></ul><p><strong>Air Temperature</strong></p><ul><li>Warm air can hold more moisture than cool air; as warm air cools, condensation leads to cloud formation and potential rainfall.</li><li>Temperature shifts between air masses can create precipitation along weather fronts.</li></ul><p><strong>Pressure Systems</strong></p><ul><li><strong>Low-pressure systems</strong>: Rising air cools and condenses, typically leading to rainfall.</li><li><strong>High-pressure systems</strong>: Sinking air warms, inhibiting cloud formation and reducing precipitation.</li></ul><p><strong>Cloud Formation</strong></p><ul><li><strong>Cumulonimbus clouds</strong>: Tall, dense clouds that often bring heavy rain or severe storms.</li><li><strong>Stratus clouds</strong>: Lower, uniform clouds that usually result in steady, light rain.</li></ul><p><strong>Hydrological Factors</strong></p><ul><li><strong>River discharge</strong>: The volume of water flowing through a river at a given point.</li><li><strong>Groundwater levels</strong>: The depth at which soil and rock are saturated with water.</li><li><strong>Wetlands and natural buffers</strong>: Their loss diminishes the landscape’s ability to absorb and slow water flow, increasing flood risk.</li></ul><p><strong>Urbanization</strong></p><ul><li><strong>Concrete and asphalt</strong>: Impermeable surfaces boost runoff, straining drainage systems.</li><li><strong>Deforestation</strong>: Reduces vegetation that would otherwise absorb water, increasing runoff into rivers.</li></ul><p>By harnessing IoT sensor data, cloud computing, and advanced analytics, the Town of Cary has crafted a powerful flood prediction and response system. From applying triple exponential smoothing to forecast rainfall, to leveraging CUSUM models for detecting abrupt changes and GARCH for understanding storm variability, each step builds a clearer picture of flood risk.</p><p>This holistic approach — capped by logistic regression to predict city-wide flood events — provides officials with real-time insights and guides practical, on-the-ground decision-making. Cary’s initiative demonstrates how smart city projects can use technology and data science to enhance public safety and bolster community resilience.</p><p><em>This project was part of a class assignment at </em><strong><em>Georgia Tech</em></strong><em>, designed to explore how data-driven solutions can address real-world urban challenges.</em></p><h3>References</h3><ul><li><a href="https://www.sas.com/en_us/customers/townofcary-flood-prediction.html">Town of Cary Flood Prediction (SAS)</a></li><li><a href="https://gpm.nasa.gov/resources/faq/how-does-climate-change-affect-precipitation">NASA GPM: How Does Climate Change Affect Precipitation?</a></li><li><a href="https://open-meteo.com/en/docs">Open-Meteo: Weather Forecast API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e2ac91e91fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Have you ever wondered how online retailers seem to know exactly which products to recommend?]]></title>
            <link>https://medium.com/@jtlowry2/have-you-ever-wondered-how-online-retailers-seem-to-know-exactly-which-products-to-recommend-91314c7f61cb?source=rss-cd086484a362------2</link>
            <guid isPermaLink="false">https://medium.com/p/91314c7f61cb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Tate Lowry]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 16:01:34 GMT</pubDate>
            <atom:updated>2025-01-27T16:01:34.713Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered how online retailers seem to know exactly which products to recommend? Behind those recommendations lies a powerful analytical approach called <em>association rule mining</em>. Recently, while working on a homework assignment, I developed an algorithm to implement this exact technique. It opened my eyes to how we can uncover meaningful patterns from transactional data, like determining which products customers tend to buy together.</p><p>In this article, I’ll break down the concepts behind association rule mining, share key metrics like support and confidence, and explain how algorithms like the one I coded can be used to extract valuable insights from data.</p><h4>Association Rule Mining: The Problem</h4><p>The fundamental question association rule mining seeks to answer is: <strong>Which items commonly co-occur?</strong> For instance, if customers frequently purchase rice and beans together, we might write an association rule as:</p><p>This rule implies that customers buying rice are likely to buy beans. The goal is to quantify this likelihood using statistical measures.</p><h4>Formalizing the Problem</h4><p>We start with a dataset of transactions, where each transaction is an itemset containing purchased items. For simplicity, assume that each item appears at most once per transaction. Our task is to:</p><ol><li>Identify all pairs of items .</li><li>Estimate the conditional probability , which represents the likelihood of purchasing given that was purchased.</li><li>Report pairs with probabilities above a certain threshold.</li></ol><h4>Key Metrics in Association Rule Mining</h4><ol><li><strong>Support</strong>: Measures the joint probability of and . Here, is the count of transactions containing both and , and is the total number of transactions. Support indicates the popularity of an itemset.</li><li><strong>Confidence</strong>: Estimates the conditional probability of given . High confidence means that when appears, often appears as well.</li><li><strong>Lift</strong>: Measures the strength of the association by comparing the observed co-occurrence to what would be expected if and were independent.</li></ol><ul><li>Lift &gt; 1: Positive correlation.</li><li>Lift = 1: No correlation.</li><li>Lift &lt; 1: Negative correlation.</li></ul><h4>Algorithm Design</h4><p>To compute support and confidence:</p><ol><li>Scan all transactions and count:</li></ol><ul><li>Occurrences of .</li><li>Occurrences of .</li><li>Co-occurrences of and .</li></ul><p>2. Calculate support and confidence for each pair.</p><p>This dynamic approach ensures we can handle datasets with unknown items.</p><h4>Tabulating Co-occurrence Counts</h4><p>We often use a <strong>contingency table</strong> to display frequencies for combinations of two items. This helps visualize the relationships between items.</p><h4>Pairwise Association Mining: A Focused Approach</h4><p>Pairwise association mining is a specific case of association rule mining that analyzes relationships between pairs of items. This approach is particularly useful in retail, where identifying co-purchase patterns can guide marketing and inventory decisions.</p><p><strong>Example Use Cases:</strong></p><ul><li>Customers who buy bread often also buy butter.</li><li>Customers who purchase chips frequently also buy soda.</li></ul><h4>Process and Algorithms</h4><ol><li><strong>Data Preparation</strong>:</li></ol><ul><li>Collect data in a transactional format (e.g., rows as transactions, columns as items).</li><li>Transform continuous variables into categorical ones if necessary.</li></ul><ol><li><strong>Frequent Itemset Generation</strong>:</li></ol><ul><li>Identify frequent 1-itemsets (items with minimum support).</li><li>Generate candidate 2-itemsets from frequent 1-itemsets.</li><li>Filter candidate 2-itemsets based on support threshold.</li></ul><p><strong>2. Evaluate Interestingness</strong>:</p><ul><li>Compute confidence and lift for frequent pairs.</li><li>Use thresholds to filter significant associations.</li></ul><h4>Final Thoughts</h4><p>Association rule mining and pairwise association analysis are powerful tools for uncovering relationships in data. By focusing on metrics like support, confidence, and lift, we can identify meaningful patterns that drive actionable insights. Whether you’re a retailer optimizing inventory or a data scientist exploring relationships, these techniques provide a structured way to make sense of co-occurring events in your datasets.</p><p>View my implementation of <a href="https://github.com/jrdnlwry/python-practice-problems/blob/main/pairwiseAlgo.py">this algorithm on my Github</a>.</p><h4>Additional Resources</h4><p>For a deeper dive, check out this video that explores association rule mining concepts in detail.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91314c7f61cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>