![]() ![]() We now compare the observed frequencies to the expected frequencies to see whether the two differ significantly. # expected relative frequencies and (absolute) frequenciesĭf # Girls Expected_relative_freq Expected_freq Labs(title = "Binomial distribution Bi(x, n = 5, p = 0.5)") P <- ggplot(df, aes(x = Girls, y = Expected_freq)) The expected frequencies assuming a probability of 0.5 of having a girl (for each of the 5 children) are as follows: # create expected frequencies for a binomial distributionĮxpected_relative_freq = dbinom(x, size = 5, prob = 0.5)ĭf$Expected_freq <- df$Expected_relative_freq * 100 # *100 since there are 100 families In order to compare the observed frequencies to a binomial distribution and see if both distributions match, we first need to determine the expected frequencies that would be obtained in case of a binomial distribution. The p-value is 0.806 so, at the 5% significance level, we do not reject the null hypothesis that the proportions of small and big flowers are the same.Īn alternative is the ggpiestats() function from the package can also be used for a Chi-square goodness of fit test: # plot with statistical results ![]()
0 Comments
Leave a Reply. |