Hidden Abilities, the Binomial Distribution, and Power

Hidden Abilities, the Binomial Distribution, and Power
Source from Bulbapedia

Pokemon is a video game for Nintendo handheld consoles that started in 1996. The basic idea of the main series is to catch Pokemon, the fantasy creatures, train them, battle with them, and beat the gym leaders and elite four.  Over each installment in the series, the games became increasingly deeper with new features added. One of these features introduced is called breeding, where a trainer can take a male and female pokemon to create more pokemon. I am oversimplifying the process, but that is the basic idea. Breeding is the best way to get competitive pokemon to us in online battling or championships. One of the desirable features to breed for are the pokemon’s ability. These abilities can help to give an edge in battle. Many pokemon have hidden abilities, which are usually more useful and rarer abilities to obtain.

Source from Bulbapedia
Source from Bulbapedia

When breeding for a Pokemon with a Hidden Ability, it can be a major challenge as it adds complexity to the breeding process. However, when breeding with a male and female Pokemon with the Hidden Ability, there appears to be some discrepancy in regards to the probability of the offspring having the Hidden Ability. IGN states that the probability is 80%, while sites such as Heavy state that the probability is 60%. Since there is not uniform consesis on this issue, this warrants our investigation. Thusly, we performed a statistical test (a more advanced one than what is typically seen in an introductory statistics course) to determine what the actual probability is. If you would like a simplified answer, please click here.

We collected the data ourselves from 2 Eevee’s with the hidden abilities.  While this differs from IGN’s article stating that only the mother needs the hidden ability, we will assume that also having the father with the hidden ability only increases the chances of the child having the hidden ability.  This is a fair assumption to make as IVs are passed down in a similar way.  (For those of you who do not know what IVs are, all you need to know is that they help determine the stats of that Pokemon.)  We used the blue XL Super Smash Brothers Edition of the Nintendo 3DS, and we did the breeding on an Alpha Sapphire version of Pokemon with the most up to date patch at the time.  We then bred the parents to obtain 100 offspring. We found that 63 had the hidden ability and the remaining had other abilities.

To perform a simple check to see which is correct, we will perform 2 hypothesis tests assuming in the first test that .60 is the null probability and .80 is the null probability for the second test. Thus, for the setup for the first test we have the following:

  H_0: p_0 = .60

  H_a: p_0 \neq .60

Using R, we found that the ideal rejection region to be 64 for the upper cutoff and 56 for the lower cutoff using . Since our data set only observed 63 and is not beyond the rejection region, we do not have evidence to reject the null. Addtionally, 63 has a pvalue of 0.6101, since this is not less than .05, this also means that we do not have evidence to reject the null. Thus, we have evidence that the true probability of an Eevee being born with both parents having the hidden ability is .60.

We will now perform the hypothesis test assuming that the null probability is .80. The setup is the following:

  H_0: p_0 = .80

  H_a: p_0 \neq .80

Using R, we found the upper and lower cutoff to be 89 and 71 using respectively. Since we found that the observed number of Eevee’s with the hidden ability was 63, we have evidence to reject the null. Alternatively, we found the pvalue for 63 to be less than 0.0000. Thus, we have evidence to reject the null. Therefore, we have evidence that the probability of obtaining an Eevee with its hidden ability when both parents have the hidden ability is not .8. (Note: We would technically need to perform a Bonferroni correction factor for this. However, to keep the analysis simpler, we will keep retain the method we performed because the anaylsis we would initially utilized would be covered next. In practice however, we would need to do a Bonferroni correction. If you do the correction yourself, you still should get the same answer.)

However, there is an alternative method to understanding this. To do this, we will create a table with the power values under the hypotheses constructed in the first test (ie p=.60). Power is the probability a test will be able to reject null if the alternative is true. In other words, it describes the how good the test is. Table 1 shows these results.

p .3 .4 .5 .6 .7 .8. .9
  P\big[ X \leq 64 \big] >0.0000 >0.0000 0.0033 0.2386 0.9201 0.9999 <1.0000
   P\big[ X \geq 56 \big] <1.0000 0.9996 0.9033 0.2365 0.0021 >0.0000 >0.0000
  \gamma \big( p \big) <1.0000 0.9996 0.9066 0.4751 0.9222 0.9999 <1.0000

Figure 1 shows the last row of Table 1. As we can see, if the actual null probability is .8, it will be 99.99% sure to reject the null. In other words, if we perform this test 10,000, we expect about 99,999 of the tests to reject the null. While we are not exactly sure if this is the 1 incorrect analysis or not, we can be fairly confident that our results are correct.

Power Plot
Figure 1: Power Plot of first hypothesis test

Additionally, we provide the pmfs of the binomial distributions for .6 and .8 in blue and red respectively. While part of the red pmf is covered, the green line is where the observed number from our data is. Since the binomial distribution is symmetric, we can see that 63 is at the tail end of the red distribution and fairly close the mean of the blue distribution.

Eevee Binomial Distributions
Figure 2: Binomial distribution of (.6, 100) and (.8,100) in blue and red respectively. The green line indicates where 63 falls.

The results of our study did indicate that the probability is more likely to be 60% when both parents have the hidden ability.  While it could be the case that the chance of obtaining offspring with the hidden ability is less when only the mother has the hidden ability, we simply do not know from this test.  However, we can safely assume that the chance does not increase when only the mother has the hidden ability.  So, IGN was probably incorrect. However, this study was only done by using Eevee’s. Therefore, we would need to assume that breeding probabilities are universal across all Pokemon capable of breeding. However, we do know that the gender proportions are not universal across Pokemon. Therefore, it is more liberal to state that all Pokemon have these proportions.  If we are being more careful in our assumptions, we cannot generalize for all Pokemon that the breeding probability is 60%. Therefore, I would suggest that we need to do more research in regards to this. However, I would not be surprised to find that it would be true that for all Pokemon the breeding percentage was 60.

We provide our code and data for the analysis we performed below.

For the Eevee HA Data – Click Here

library('ggplot2')
library('grid')
library("reshape2")
library("plyr")

#simple test

binom.test(64,100, p=.6, alternative='g') #pvalue=0.2386
binom.test(56,100, p=.6, alternative='l') #pvalue=0.2365
binom.test(63,100, p=.6, alternative='t') #pvalue=0.6101

binom.test(89,100, p=.8, alternative='g') #pvalue=0.1923
binom.test(71,100, p=.8, alternative='l') #pvalue=0.1891
binom.test(63,100, p=.8, alternative='t') #pvalue=8.053e-05



#doing binomial distributions in single plot
#creating data
p1<-dbinom(0:100, 100, .60)
p2<-dbinom(0:100, 100, .80)

#calculating probabilities
p1[64]
p2[64]

sum(p1[64:101])
sum(p1[0:18])

#creating matrix
eeveedata<-matrix(nrow=101, ncol=4)
eeveedata[,1]<-p1
eeveedata[,2]<-p2

eeveedf<-data.frame(eeveedata)

cnames<-c('p= .60','p=.80')
colnames(eeveedf)<-cnames

eeveemelt <- melt(eeveedf)

eeveemelt<-eeveemelt[1:202,]
mytheme<-theme(
	
	plot.title = element_text(lineheight=1.5, size=35, face="bold"),
	axis.text.x=element_text(size=23),
	axis.text.y=element_text(size=23),
	axis.title.x=element_text(size=28, face='bold'), 
	axis.title.y=element_text(size=28, face='bold'),
	strip.background=element_rect(fill="gray80"),
	panel.background=element_rect(fill="gray80"),
	axis.ticks= element_blank(), 
	axis.text=element_text(colour="black"),
	plot.margin = unit(c(27,13,27,13), 'mm')
	
	)

n<- c(0:100)

obs<-c(n,n)

obs<-data.frame(obs)

eeveemelt2<-cbind(eeveemelt, obs)

eeveemelt2<-data.frame(eeveemelt2)
	
E<- ggplot(data=eeveemelt2, aes(x=obs, y=value, fill=variable)) +
	geom_histogram(alpha=.7,stat="identity")+
	scale_x_continuous(limits=c(40,100))+
	scale_fill_manual(values=c("blue", "red"))+
	labs(fill="Binomial(p,n=100)")+
	geom_vline(xintercept =63, color="forestgreen", size =2.5)+
	geom_vline(xintercept =63, color="green", size =1)+
	mytheme

Ee<-E + ggtitle("Eevee Breeding Probabilities")+ 
		xlab("Observed Number with Hidden Ability")+
		ylab('Probability')
	
Ee


#creating power plot

binom.test(64,100, p=.3, alternative='g')
binom.test(64,100, p=.4, alternative='g')
binom.test(64,100, p=.5, alternative='g')
binom.test(64,100, p=.6, alternative='g')
binom.test(64,100, p=.7, alternative='g')
binom.test(64,100, p=.8, alternative='g')
binom.test(64,100, p=.9, alternative='g')

binom.test(56,100, p=.3, alternative='l')
binom.test(56,100, p=.4, alternative='l')
binom.test(56,100, p=.5, alternative='l')
binom.test(56,100, p=.6, alternative='l')
binom.test(56,100, p=.7, alternative='l')
binom.test(56,100, p=.8, alternative='l')
binom.test(56,100, p=.9, alternative='l')

pow<- c(1.0000, 0.9996, 0.9066, 0.4751, .9222, .9999, 1.000)
prob<- c(.3, .4, .5, .6, .7, .8, .9)

power.data<-cbind(pow, prob)
power.df<-data.frame(power.data)

pow.plot<- ggplot(data=power.df, aes(x=prob, y=pow))+
		   geom_point(size=4)+
		   geom_line(size=2)+
		   ggtitle("Power Plot")+
		   xlab("Values of p")+
		   ylab("Probability")+
		   mytheme