Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Binomial test
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==In statistical software packages== Binomial tests are available in most software used for statistical purposes. E.g. * In [[R (programming language)|R]] the above example could be calculated with the following code: ** <syntaxhighlight lang="r" inline>binom.test(51, 235, 1/6, alternative = "less")</syntaxhighlight> (one-tailed test) ** <syntaxhighlight lang="r" inline>binom.test(51, 235, 1/6, alternative = "greater")</syntaxhighlight> (one-tailed test) ** <syntaxhighlight lang="r" inline>binom.test(51, 235, 1/6, alternative = "two.sided")</syntaxhighlight> (two-tailed test) * In [[Java (programming language)|Java]] using the [[Apache Commons]] library: ** <syntaxhighlight lang="java" inline>new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.LESS_THAN)</syntaxhighlight> (one-tailed test) ** <syntaxhighlight lang="java" inline>new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.GREATER_THAN)</syntaxhighlight> (one-tailed test) ** <syntaxhighlight lang="java" inline>new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.TWO_SIDED)</syntaxhighlight> (two-tailed test) * In [[SAS (software)|SAS]] the test is available in the Frequency procedure<syntaxhighlight lang="sas"> PROC FREQ DATA=DiceRoll ; TABLES Roll / BINOMIAL (P=0.166667) ALPHA=0.05 ; EXACT BINOMIAL ; WEIGHT Freq ; RUN; </syntaxhighlight> * In [[SPSS]] the test can be utilized through the menu ''Analyze'' > ''Nonparametric test'' > ''Binomial''<syntaxhighlight lang="text"> npar tests /binomial (.5) = node1 node2. </syntaxhighlight> * In [[Python (programming language)|Python]], use [[SciPy]]'s [https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.binomtest.html binomtest]: ** <syntaxhighlight lang="python" inline>scipy.stats.binomtest(51, 235, 1.0/6, alternative="greater")</syntaxhighlight> (one-tailed test) ** <syntaxhighlight lang="python" inline>scipy.stats.binomtest(51, 235, 1.0/6, alternative="two-sided")</syntaxhighlight> (two-tailed test) * In [[MATLAB]], use [http://www.mathworks.com/matlabcentral/fileexchange/24813-binomial-test myBinomTest], which is available via Mathworks' community File Exchange website. myBinomTest will directly calculate the p-value for the observations given the hypothesized probability of a success. <syntaxhighlight lang="matlab" inline>[pout]=myBinomTest(51, 235, 1/6)</syntaxhighlight> (generally two-tailed, but can optionally perform a one-tailed test). * In [[Stata]], use bitest. * In [[Microsoft Excel]], use Binom.Dist. The function takes parameters (Number of successes, Trials, Probability of Success, Cumulative). The "Cumulative" parameter takes a boolean True or False, with True giving the Cumulative probability of finding this many successes (a left-tailed test), and False the exact probability of finding this many successes.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)