<?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 Pedro Carvalho on Medium]]></title>
        <description><![CDATA[Stories by Pedro Carvalho on Medium]]></description>
        <link>https://medium.com/@pedromvilar?source=rss-502a7a6594aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*YriTFGXUSwT_Ls_dUs7dwg.png</url>
            <title>Stories by Pedro Carvalho on Medium</title>
            <link>https://medium.com/@pedromvilar?source=rss-502a7a6594aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:02:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pedromvilar/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[How to Use an Obscure Statistical Technique to Market Your Games]]></title>
            <link>https://medium.com/tech-at-wildlife-studios/how-to-market-your-games-c99c45b86fce?source=rss-502a7a6594aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c99c45b86fce</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[determine-ltv-of-customer]]></category>
            <category><![CDATA[wildlife-studios]]></category>
            <category><![CDATA[kalman-filter]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Pedro Carvalho]]></dc:creator>
            <pubDate>Wed, 06 May 2020 16:04:35 GMT</pubDate>
            <atom:updated>2020-10-28T15:10:31.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qRcR9K6f1NvnlNLWJ29Wfw.png" /></figure><p>One of the most important problems, or perhaps actually just <em>the single most important problem</em>, that a data scientist working with mobile gaming will want to try to solve is the problem of user lifetime value prediction.</p><p>First, it’s necessary for us to know what the actual profitability or size of the game <em>is</em>. A number of decisions within the company hinge on this: how many people to allocate to its continuous development, whether it was worth the investment, what kinds of features drive players the most in the game.</p><p>We should also think of the shareholders themselves: the people who have a very real stake in the success of the games and who want to see their investments give fruit. In the long term, they need to be able to have reliable figures to assess which projects to back and support.</p><p>Those reasons would probably be enough to at least give you pause. This blog post, however, focuses on the third great use for LTV prediction — namely, <em>user acquisition</em>, and, more specifically, how to use a modified Kalman Filter to generate those predictions for users that have yet to install our apps.</p><h3>User Acquisition</h3><p>You may create the single most interesting, entertaining, engrossing, and well-thought-out mobile game out there, but if you have no way to <em>tell</em> people about it then no one will play it. That’s where user acquisition — in the form of advertising — comes in. From the very first users to install your app to users who only downloaded it because they saw it on a ranking list, almost everything has come from someone having seen ads for it somewhere.</p><p>That’s all well and good, but what does that have to do with user lifetime value prediction, you might ask? Everything, dear reader.</p><p>There are many details of the user acquisition ecosystem that I will be eliding over now to explain this to you, but the fundamental connection between those things is quite simple: to show an ad somewhere, you need to pay someone, and to decide how much money you’re willing to spend on that ad, you need to know how much money that’s going to net you in return. That is a simplistic way to put it, but I do think it gets to the heart of it.</p><h3>Projected versus expected LTV</h3><p>It is perhaps not immediately clear, but upon some reflection, I think you will agree that user acquisition efforts need to know player LTV in a somewhat different way than shareholders or other people making resource allocation decisions. To acquire users through some medium you need to have some model of how much money <em>future users you’ve never interacted with before</em> are expected to give you. No such constraint applies to generating projections of game profitability, where you can in fact observe user behavior for a while and use that data to great effect in order to create those estimates.</p><p>Here at Wildlife Studios, we have different names for those two results:</p><ul><li>The projected lifetime value (pLTV) project aims to create very precise predictions of how much money our currently-existing user base is likely to spend on our game.</li><li>The expected lifetime value (eLTV) project tries to guess how much money we should <em>expect</em> to get from the average user we will acquire, in the future, from the various sources we work with.</li></ul><p>It’s straightforward to picture how one would go about generating our pLTV estimates. Even if you are not personally acquainted with predictive algorithms, I’m sure you can agree that there must be some amount of data plus buzzwords like “machine learning” and “regression” and “AI” that would allow one to infer the future from the past. And I don’t want to imply that that is not an interesting or difficult problem; <em>au contraire</em>, it is so interesting and difficult that I’m not even allowed to talk about it openly.</p><p>But when we’re talking about predicting the <em>unseen</em>, the revenue of users future, where to even begin?</p><h3>Underlying values and how to guess them</h3><p>Imagine, if you will, that you had an oracle of user LTV, but only after they installed your game. Equivalently, imagine your pLTV model is amazing and you trust it implicitly.</p><p>Then imagine that there’s some existing ad campaign you’ve been acquiring users with — it could be, say, some video that’s played on Facebook to a certain relevant demographic of users. And so, of course, you can use your oracle once they’ve downloaded your game to know exactly how much money each of those users will spend on it until they stop playing it.</p><p>Suppose one day 150 users download your game from that campaign, and they will spend, on average, $5 on your game before they stop playing (according to the oracle). The next day, 200 users download your game and they will spend an average of $4. The next day, 100 users with an average LTV of $4.50. What would you guess users on the fourth day would spend, on average?</p><ol><li>$0.50</li><li>$20</li><li>$4.50</li><li>$0</li></ol><p>Of course the fundamental answer is that you don’t <em>know for sure</em>. But you sure do have some intuition here, don’t you? Or, put it another way: you would be pretty surprised if you found out that the fourth-day users had an LTV of $50 on average, wouldn’t you?</p><p>Users who installed your game after seeing that specific video probably have something in common. It doesn’t really matter <em>what</em>, and it doesn’t even really matter whether Facebook had something to do with it. We could spend all day speculating about the psychology of users who are more interested in simplistic banners while playing sudoku versus those who will only be interested if they see five minutes of gameplay before a YouTube video. If you have reliable information about the average LTV of <em>past</em> users from a given segment, guessing that <em>future</em> users will be similar to them seems like a very safe bet.</p><h3>The Kalman Filter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yxKd3Q_MfsByVM-C0v8rRw.jpeg" /></figure><p>I am going to take a pause in the revenue chat to talk about a remote-controlled truck.</p><p>Imagine you own one. However, you don’t have a camera or anything like that; instead, you’re tracking it through GPS. Now, you of course need to actually <em>drive</em> that truck, turn when it needs to turn, etc. So it would be very useful to have an accurate idea of where this truck is at any given time.</p><p>The truck, at a given time <em>i</em>, is at position <em>xᵢ</em> and has velocity <em>vᵢ</em>. You have, of course, direct access to its initial position <em>xₒ</em> and its initial velocity <em>vₒ = 0</em>. You also have access to estimated position data from the three satellites currently tracking the truck, which you could call <em>gᵢ</em>, and your remote control, which applies some acceleration <em>aᵢ</em> to it.</p><p>There is also, of course, noise in all parts of the system. In particular, you could say the GPS estimates are normally distributed around the true value:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*A23IqpZ81vJDcCAE" /></figure><p>At any given instant, the velocity is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UVXJ4JCMjKZjzazI" /></figure><p>(Because there is some noise also in transmitting your acceleration to the truck). Finally, the (true) position is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WBmKQ3-PkPfi2qPu" /></figure><p>This very simple model is an example of what is known as the Kalman Filter.</p><p>In the literature and normal explanations you will find notation that I personally think is somewhat more obscure than the above, but it is still fundamentally the same: you have some hidden variable (such as, in our case, <em>xᵢ</em>) that you want to reason about, some way to noisily observe it (<em>gᵢ</em>), some way to control it (<em>aᵢ</em>), and some transition relation that turns all of those things at time <em>i - 1 </em>into the unobserved variable’s state at time <em>i</em>. And in the end, you can use all of that to find some posterior distribution for the unobserved variable, conditioning on your previous observations and control inputs.</p><h3>LTV as an underlying value</h3><p>The title of this section probably gives the whole game away: we can model LTV as a hidden variable we’re trying to infer based on our past observations using the Kalman Filter I just talked about. We will, however, simplify the model by a lot and then take a slight left turn somewhere else.</p><p>The two main simplifications are: 1. we do not assume we have any fine-grained control over LTV and 2. it has no terms of long-term trend or seasonality. These things imply that the evolution of a given segment’s LTV over time (in this case, each “instant” of the model is one day) is a random walk, with no control term and with the state transition matrix being the identity matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jRKn67Eg6VsFPm5s" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T1yoN67qa0hYb2hm" /></figure><p>This “underlying value”, however, is <em>not the same</em> as the observed LTV of a given segment on a given day. Rather, you should think of it as the “expected value of an average user from that cohort”. Another way to think about it is what that cohort’s LTV would be if it had contained infinite people.</p><p>For any given day that we have some users from some segment installing our game, a lot of stuff we might want to term “noise” may happen. So we could plausibly say that, actually, the observed LTV of each given specific user follows some distribution around this “true”, underlying value.</p><p>We run into a little bit of trouble here, though, because while I could maybe handwave something for the random walk that the LTV itself follows, it would be patently absurd to say that observed LTV is <em>normally</em> distributed around the true LTV — for one, a large number of users, probably a majority, will just never spend a single cent on the game.</p><p>Let’s take my aforementioned left turn here and think about the Central Limit Theorem: for a sufficiently large number of installs on a given day, <em>Nᵢ</em>, the <em>average</em> of all of those users’ LTVs <em>will</em> in fact be normally distributed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3y2PyRunQKpWzNYt" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uMkecOMXQh48egmX" /></figure><p>That lets us dodge one bullet, but there’s another one coming our way: we don’t <em>have</em> recent observed LTVs! We have only recent observations of average revenue per user (ARPU), and for a fairly low number of days since install at that! We can’t bid on users based on what recent users have spent on their <em>first day</em>, or if we’re charitable first <em>week</em>, of play.</p><p>But we do have something I mentioned earlier to save us: existing users’ <em>projected LTV</em>. We can do a similar Central Limit Theorem trick here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a5YeF5YaGhgDlanO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*31myJ0o_0T-PO4be" /></figure><p>And we can skip the middleman there and integrate the observed revenue right out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nX-nYz0jm7z-i2m4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7RsqJFk0MWxAkc2Q" /></figure><p>What we really want here, though, is not the underlying LTV for some cohort of <em>past</em> users who are <em>already</em> in our game; we want, instead, the LTV of <em>future</em> users. According to our model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6E5gNNgE1puj_dk5" /></figure><p>What we have is the sequence of projected LTVs. But then we can just do a little bit of maths here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XcSznV2K6vSeoDNf" /></figure><p>The step from the first to the second line there is straightforwardly a consequence of the conditional independence embedded into our model: tomorrow’s (true) LTV is independent from today’s projected LTV and yesterday’s projected LTV and so on when conditioned on today’s (true) LTV.</p><p>Now, entertain me for a second and pretend that the probability density function is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fZwxhIT4gin0bTqv" /></figure><p>is actually a normal distribution with some unknown mean and variance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VE8OTBvtma6CMW_j" /></figure><p>Then, it is actually pretty straightforward to show that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WLcbozmZmSINmK83" /></figure><p>So actually, our best guess for tomorrow’s true LTV… is the same as today! This, of course, follows trivially from our model definition as a random walk: if we have no further observations about tomorrow’s LTV and all that we know about it is that <em>today’s</em> expected LTV was <em>μₙ</em>, then, of course, that’s what we’ll think about tomorrow. So now all that’s left is to prove that that huge mess up there is actually normally distributed.</p><p>Spoilers: it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PloKAQCZZHz3Ga83" /></figure><p>The second term of the right-hand side there on the third line looks suspiciously like something we’ve seen before, doesn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ymDrAc7vDj4LebqB" /></figure><p>So we’ve come full circle, and discovered a recurrence relation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-OMOw0vJKk8_PYoj" /></figure><p>Let’s start this from 0, then. As sayeth Bayes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eJ_PaQKm5LMWKDew" /></figure><p>If we give our LTV sequence a prior, something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P38BCwO5F7atiKIp" /></figure><p>Then it follows immediately that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zp85_wHERsGdi1UH" /></figure><p>With the following definitions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y9L4xBa5LDagxX7T" /></figure><p>Something begins to take form! Now let’s go on to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6JE4__9O0UkYmpZP" /></figure><p>We can have our full definitions, then, for the recursive relation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kjnq2OtsxVdJq5ED" /></figure><p>With the definitions for the case where <em>i = 0</em> given above. And, of course, it follows that for the “future” LTV we’re estimating:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dLqcG-aFCgXpRDDX" /></figure><h3>This and more at a mobile gaming company near you</h3><p>At a higher abstraction level, something like the above result makes a pretty intuitive sense. As in the example I gave, we always expect that:</p><ol><li>Future users will be similar to past ones.</li><li>Cohorts with more installs provide more information than cohorts with fewer installs.</li><li>More recent cohorts are more relevant than ones further in the past.</li></ol><p>So this modified Kalman Filter can be interpreted as a sort of “moving average” that encodes those assumptions (plus some other more technical ones but anyway). That’s pretty pleasant both from a computational perspective and from a business logic perspective, as it resonates with what one would assume a priori.</p><p>Bonus points go for you not even needing <em>all</em> of it if you assume your user acquisition operation is risk-neutral and thus you are only interested in the expected values and not any tail risks.</p><p>This is just a small (but still quite central) part of the much larger revenue prediction project at Wildlife Studios, and it was entirely developed by data scientists. It’s the sort of work my colleagues and I do on a day-to-day basis, and I personally find it quite exciting. Who knows what we’ll do in the future?</p><p>(Me. I do. But I’m not telling. Shhh.)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F4k4fyv%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F4k4fyv&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/be68fcad6af7a9e5230f34fb0ef5c5ed/href">https://medium.com/media/be68fcad6af7a9e5230f34fb0ef5c5ed/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c99c45b86fce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tech-at-wildlife-studios/how-to-market-your-games-c99c45b86fce">How to Use an Obscure Statistical Technique to Market Your Games</a> was originally published in <a href="https://medium.com/tech-at-wildlife-studios">Wildlife Studios Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>