Skip to contents

This function calculates the probability of a player returning on a given day. The probability decreases over time according to the following schedule:

  • 100% on day 0

  • 30% on day 1

  • Linear decrease from 30% to 10% from day 1 to day 3

  • Linear decrease from 10% to 5% from day 3 to day 7

  • Linear decrease from 5% to 2% from day 7 to day 14

  • Linear decrease from 2% to 0.05% from day 14 to day 30

  • 0.05% on all days after day 30

Usage

get_activity_probability(day)

Arguments

day

The day from start, indexed from 0, for which to calculate the probability (integer).

Value

The probability of a player returning on the given day (numeric).

Examples

get_activity_probability(0)  # 1
#> [1] 1
get_activity_probability(1)  # 0.3
#> [1] 0.3
get_activity_probability(3)  # 0.1
#> [1] 0.1
get_activity_probability(7)  # 0.05
#> [1] 0.1
get_activity_probability(14) # 0.02
#> [1] 0.05
get_activity_probability(30) # 0.0005
#> [1] 0.005
get_activity_probability(31) # 0.0005
#> [1] 5e-04