Turnip for the Books: Part II

Using data to make good choices in the Stalk Market.
Posted on Apr 2, 2020

Read part 1 here.

Since posting this, the wonderful site https://turnipprophet.io has come to my attention. This is honestly the best way to track turnip prices.

Well, my data collection plea went answered. Some excellent folks on the ACTurnips subreddit engaged in a brilliant effort to catalogue the patterns present in the game. Their results can be found here, with their interactive spreadsheet here. The tool is simply excellent, letting you narrow down which pattern you’re in simply by typing in the results you’ve seen so far.

However, there’s a caveat. It tells you which patterns you could be in, but it doesn’t tell you anything about their relative likelihood. This is important to know if you want to make good investment decisions, so let’s explore that a little further.

The Patterns

The spreadsheet lists a total of 72 possible patterns, grouped into four distinct categories:

  • Random: The random patterns are broadly, well, random. The implication seems to be (from how they’ve categorised them) that it’s not truly random, however, but designed so that they’re random within certain ranges, the order of which vary a lot. There are 56 different random patterns.
  • Decreasing: There is only one decreasing pattern, in which the value of turnips decreases every time.
  • Small Spike: The small spike patterns are characterised by slowly decreasing prices, followed by two prices between 90 and 140, followed by three prices between 140 and 200, followed by more, very low prices. There are eight of these patterns.
  • Large Spike: Large spike patterns are exactly the same as the decreasing pattern, except for five consecutive values, where the price goes 90-140, 140-200, 200-600, 140-200, 90-140. There are seven of these patterns.

One additional point to note is that in the decreasing, small spike, and large spike patterns, the small decreases at the beginning and end are always 3-5 bells.

Bayesian Updating

When we type some numbers into this model, how do we know which patterns are more likely? Well, we don’t, really. We don’t have good priors about which patterns are more likely than others to begin with.

Let’s do some Bayesian updating anyway, starting with the following assumptions (which seem reasonable to me):

  • All of the subpatterns are equiprobable (so the eight small spike patterns are equally likely, for example).
  • If a range is defined, the game selects a number from that range uniformly; a range from 60-80 has a $\frac{1}{21}$ chance of picking the number 72 (it doesn’t matter in most cases whether or not this is true).

Let’s also define some notation: let pr, pd, pss, pls denote the total probabilities of the random patterns, of the decreasing pattern, of the small spike patterns, and of the large spike patterns respectively (a case can be made for assuming these are all equal to $\frac{1}{4}$, but I don’t think this is known).

Bayes’ Theorem is a way of updating prior probabilities based on new evidence. Specifically, if we see a piece of evidence E, and have hypotheses H1Hn, then we have:
$$P[H_k | E] = \frac{P[E | H_k] \cdot P[H_k]}{\sum_{i=1}^{n}(P[E | H_i] \cdot P[H_i])}$$

Say we see that those absolute madlads, Timmy and Tommy, are selling turnips for 88 bells on Monday morning. Using the spreadsheet, we get that there are 7 of each of the spike patterns possible, and the decreasing pattern as well. What are the relative likelihoods?
$$P[E | p_r] \cdot p_r=0\space$$

$$P[E | p_d] \cdot p_d=\frac{1}{6} \cdot p_d\space$$

$$P[E | p_{ss}] \cdot p_{ss}=\frac{7}{8} \cdot \frac{1}{51} \cdot p_{ss}=\frac{7}{408}\cdot p_{ss}$$

$$P[E | p_{ls}] \cdot p_{ls}= \frac{1}{6} \cdot p_{ls}$$

Assuming for a second that we have pr = pd = pss = pls = 0.25 (which I don’t think is all that unreasonable, although I really wish pattern frequencies were known), then our posteriors are the following:
$$p_r = 0\space$$

$$p_d = \frac{\frac{1}{6} \cdot \frac{1}{4}}{\frac{143}{1632}} = \frac{68}{143} \approx 0.476\dots$$

$$p_{ss} = \frac{\frac{7}{408} \cdot \frac{1}{4}}{\frac{143}{1632}} = \frac{7}{143} \approx 0.049\dots$$

$$p_{ls} = \frac{\frac{1}{6} \cdot \frac{1}{4}}{\frac{143}{1632}} = \frac{68}{143} \approx 0.476\dots$$

While the spreadsheet in this case makes it seem as though you could just as well be in a large as a small spike, the observation of 88 bells as the first price actually lends for more credence to the pattern being a large spike or a decreasing pattern.

Final Thoughts

Our knowledge of the patterns available to the game matters a great deal. That being said, it is important to remember that narrowing the patterns down using the spreadsheet doesn’t meant that one is not far more likely than another. You often don’t even need to perform the Bayesian updating by hand, just a look to see what the possible ranges were and how many patterns there are for each should suffice.

I’ll finish this with a few observations about optimal turnip strategy:

  • If you know you are in the Random series of patterns, then there are exactly 7 prices between 90 and 140 bells. It’s random, so the values are (likely) independent of each other - to maximise your expected price you should use the Odds Algorithm from the previous part on the prices during the week that fall between 90 and 140, and set s = 3.
  • If you are in either the Decreasing pattern or the Large Spike, the longer you do not observe the spike, the less likely there is to be one.
  • In terms of expected value, the large spike is the best, followed by the small spike, the random patterns, and finally the decreasing pattern.
  • If there is more than one of you, the odds of the patterns are independent and you can simply multiply them together. Remember, you can simply take the best pattern of the group - this will improve your yield greatly.
  • If you start with a price of under 80 bells, and it decreases steadily, you are almost certainly in the small spike pattern.
    • If you start with a price of under 60 bells you are certainly in the small spike pattern.
  • If you’re entering the three prices in the small spike pattern that are between 140 and 200 bells:
    • You should sell on price 1 if the price is above 182 bells.
    • You should sell on price 2 if the price is above 170 bells.
    • Otherwise sell on the third price.
  • Keep in mind that the frequencies of the various patterns aren’t known, and that the assumption that they are equiprobable is just that.