Jump to content

True stat averages


zahlman
 Share

Recommended Posts

I was bored, so I made a calculator for stat averages that takes the effect of caps into account. Basically, the cap means that you can't end up equally as blessed as you could be screwed, so the real average stat will be lower than what you get from (base + (growth * levels)). The effect is minor: even for someone like Lilina and her MAG, the real stat isn't ever off by even a full point. But at least having the code means we can see how minor the effect is.

This is designed for games with up to 2 tiers of stats and the same growth rate for each tier.

from math import factorial


def binomial_pdf(probability, successes, trials):
failures = trials - successes
combinations = factorial(trials) / factorial(successes) / factorial(failures)
return probability ** successes * (1 - probability) ** failures * combinations


def average_stat_1tier(base, growth, levels, cap):
return sum(
	binomial_pdf(growth, i, levels) * min(cap, base + i)
	for i in xrange(levels + 1)
)


def average_stat_2tiers(base, growth, first_levels, first_cap, promotion_bonus, second_levels, second_cap):
return sum(
	average_stat_1tier(min(min(first_result, first_cap) + promotion_bonus, second_cap), growth, second_levels, second_cap) *
	binomial_pdf(growth, first_result - base, first_levels)
	for first_result in xrange(base, base + first_levels + 1)
)

Ex. We want to know Lilina's true average Mag at 20/12 (when she first "caps" it on the chart). Her base is 5 and her growth is 0.75 (75%). We put her through 19 levels in the first tier (you don't get stat-ups for lv 1, lol) with a cap of 20, then gets 3 more upon promotion, and gains 11 more levels with a cap of 30.

>>> average_stat_2tiers(5, 0.75, 19, 20, 3, 11, 30)
29.252780804944297

Edited by zahlman
Link to comment
Share on other sites

Is this a Python program?

Also, you should make a chart that gives us the probability of having each stat at each level... something to that extent. Hard coding a growth/base level/etc chart isnt a bad idea, either, since you have the basic framework of certain things down. The average by itself is fairly useless from my POV.

Link to comment
Share on other sites

Is this a Python program?

Also, you should make a chart that gives us the probability of having each stat at each level... something to that extent. Hard coding a growth/base level/etc chart isnt a bad idea, either, since you have the basic framework of certain things down. The average by itself is fairly useless from my POV.

This is basically what we need.

Link to comment
Share on other sites

I'm sure I could whip up a mathematica program if I had the time or energy (and/or skill, since I have just an extremely primitive knowledge of it), but nobody here uses Mathematica :/ We could probably make use of excel somehow instead of worrying about some complicated python program.

Edited by Mercenary Vergil
Link to comment
Share on other sites

This is basically what we need.

It would work something like this:

def PSL(t1_level, t2_level, base, growth, bonus, cap, base_level)

> #set t1_level to 1 for prepromotes, t2_level to 1 for unpromoted units

> levels = t1_level + t2_level - base_level - 1

> for i in range(1,levels):

>> stat = base + i

>> if t1_level =! 1 and t2_level =! 1:

>>> stat += bonus

>> if stat > cap:

>>> stat = cap

>> prob = (factorial(levels)/(factorial(i)*factorial(levels - i)) * (growth)^i * (1-growth)^(levels - 1)

>> print stat, prob

But it only works for one individual level, and isn't formatted very well.

Edited by Baldrick
Link to comment
Share on other sites

Is this a Python program?

Also, you should make a chart that gives us the probability of having each stat at each level... something to that extent. Hard coding a growth/base level/etc chart isnt a bad idea, either, since you have the basic framework of certain things down. The average by itself is fairly useless from my POV.

http://fea.fewiki.net/

Click on the individual stats from the character's page to see those charts. It's a bit out of date, though.

For the most part, the expected value (growth x level + base) tends to be more relevant than the actual data mean. The percentages are nice to have, though.

Edited by Othin
Link to comment
Share on other sites

Is this a Python program?

It's some Python code, yeah. I didn't write a user interface or anything, it's just functions I can call at the interpreter prompt.

This is basically what we need.

Easy. I assume you mean "at least this stat". So basically that's just the CDF.

Yeah, the mean value isn't so useful in general, but having a true mean lets you do one vaguely neat thing I can think of: discount the value of a statbooster to take the chance of capramming into effect.

Like (this is probably a shitty example) let's say my lv 11 Lyn is speed-screwed, with a speed of 13 vs the average 15. I'm considering giving her Zoldam's Speedwings.

If I don't, her expected spd outcome at, say, 20/6 (because I like her enough to try to use her in endgame) is

>>> average_stat_2tiers(13, 0.6, 9, 20, 0, 5, 30)
21.319378432000004

Since she's expected to capram in first tier, we might guess that the speedwings are worth quite a bit less than +2 in the final stats, even if they make a difference now:

>>> average_stat_2tiers(15, 0.6, 9, 20, 0, 5, 30)
22.604981760000005

So they're worth about +1.3 to how she turns out... part of that is explained "directly" by the capramming by looking at the charts (she "averages" 20 speed at lv 20 unpromoted, where she'd get 20.4 without a cap), but there's also some additional effect due to what I was talking about in the first post.

But yeah that isn't nearly as useful as knowing how likely you are to double the Xs in chapter Y at level Z, agreed. Especially since people really only talk about average stats for two reasons: tiering (where "how likely you are to double the Xs in chapter Y at level Z" is the only thing people will care about) and for perspective on their blessed/screwed characters (where precision isn't super-important anyway).

Edited by zahlman
Link to comment
Share on other sites

http://fea.fewiki.net/

Click on the individual stats from the character's page to see those charts. It's a bit out of date, though.

For the most part, the expected value (growth x level + base) tends to be more relevant than the actual data mean. The percentages are nice to have, though.

Oh no, I perfectly know those and all the theory behind it. It's outdatedness and being a bit mechanical with its formatting is the reason why I'd prefer a program to a look up table.

And no, I wouldn't want a cdf or a pdf because those are density functions. I actually would want both a pmf and cmf, possibly something that spits out multiple values according to what the user wants. Something flexible, like "probability of having between these two stats". Once gain, and while the python is nice (they were a dark time in my life, intro comp sci 1 was dumb but an easy A), excel is almost universally better for this thing because of multiple charts that can be used per character as well as universal access.

But you know what? Keep it up, you'll probably form something greater either way, since you at least know the basic statistics you need.

Is there a statistician on this site? I'm wondering if np (n being level) or sum of np (n being the stat number) is the most valid way to do these expected values, because I don't see how one is preferred over the other (despite yielding different results), because each stat roll IS independent (yet somehow becomes dependent in a really weird way later on)...

Edited by Mercenary Vergil
Link to comment
Share on other sites

Oh no, I perfectly know those and all the theory behind it. It's outdatedness and being a bit mechanical with its formatting is the reason why I'd prefer a program to a look up table.

And no, I wouldn't want a cdf or a pdf because those are density functions. I actually would want both a pmf and cmf, possibly something that spits out multiple values according to what the user wants. Something flexible, like "probability of having between these two stats". Once gain, and while the python is nice (they were a dark time in my life, intro comp sci 1 was dumb but an easy A), excel is almost universally better for this thing because of multiple charts that can be used per character as well as universal access.

But you know what? Keep it up, you'll probably form something greater either way, since you at least know the basic statistics you need.

Is there a statistician on this site? I'm wondering if np (n being level) or sum of np (n being the stat number) is the most valid way to do these expected values, because I don't see how one is preferred over the other (despite yielding different results), because each stat roll IS independent (yet somehow becomes dependent in a really weird way later on)...

I have to agree with this. Having an excel spreadsheet with the functions saved where you put in the level in one column, then the bases and growths and it calculates for each stat would probably be the best. Honestly, I can't say I know the math behind this, which is really sad, but if I did, or if someone's willing to tell me it, I'd be willing to make one up and post it, or at least help with it.

Also, I like python :(: well at least more than java.

Edited by bottlegnomes
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...