binompmf

From DavinciWiki
Jump to: navigation, search

Citation

1.10

Description

Probability mass function for the binomial distribution

Arguments and Return Values

Arguments: Numbers specifying the total number of trials (n) and the probability of success in each trial (p), and an array specifying the number of successes for which the probability is to be computed (k)

Return Value: The probability of having exactly k successes in n trials

If no arguments are input, binompmf() prints its description, as shown below.

Usage

Syntax: binompmf(n=n, k=k, p=p)

'n' - the total number of trials; must be integer and scalar (1x1x1)

'k' - the number of successes (must be integer); can be an array; if k is omitted, the function will use k = create(n + 1), which is [0, 1, 2, ... n-1, n]

'p' - the probability of success in any single trial (which is the same for all trials in a binomial distribution); p must be scalar, between zero and one; if p is omitted, the function will default to 0.5

So, to find the probability of getting exactly 6 heads when flipping a coin 10 times, use binompmf(n=10, k=6, p=0.5).

If k is an array, the return array will be the same size as k, with each element P_i giving the probability of exactly k_i successes.

The arguments don't have to be in a specific order, but they all MUST be passed by reference.

Examples

dv> binompmf()

Binomial distribution probability mass function
binompmf(p=p, n=n, k=k)
You MUST pass all arguments by reference (not by value)
n is the number of trials
k is the number of successes
p is the probability of success in each trial
n and k must be positive integers
p must be a real number 0 <= p <= 1
n and p must be scalar (1x1x1); only k can be an array
If p is omitted, this function will use p = 0.5
If k is omitted, the function will use k = [0, 1, 2, ... , n]
Returns the probability of exactly k successes in n trials
binompmf(n, k, p) = nCk*p^k*(1 - p)^(n - k)
S.Marshall 02-17-2008

0
dv> binompmf(n=10, k=6, p=0.5)
0.205078
dv> binompmf(n=10)
11x1x1 array of float, bsq format [44 bytes]
0.000976562     0.00976562      0.0439453       0.117188        0.205078        0.246094
0.205078        0.117188        0.0439453       0.00976562        0.000976562

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 02-19-2008
Modified On: 02-19-2008

Personal tools