Last data update: 2014.03.03

R: Simulating Binomial Distribution
bino.genR Documentation

Simulating Binomial Distribution

Description

Function that generates and displays m repeated samples of n Bernoulli trials with a given probability of success.

Usage

bino.gen(samples, n, pi)

Arguments

samples

number of repeated samples to generate

n

number of Bernoulli trials

pi

probability of success for Bernoulli trial

Value

simulated.distribution

Simulated binomial distribution

theoretical.distribution

Theoretical binomial distribution

Author(s)

Alan T. Arnholt

Examples

bino.gen(1000, 20, 0.75)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PASWR)
Loading required package: e1071
Loading required package: MASS
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PASWR/bino.gen.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bino.gen
> ### Title: Simulating Binomial Distribution
> ### Aliases: bino.gen
> ### Keywords: distribution
> 
> ### ** Examples
> 
> bino.gen(1000, 20, 0.75)
$simulated.distribution
Successes
    0     1     2     3     4     5     6     7     8     9    10    11    12 
0.001 0.018 0.071 0.146 0.212 0.174 0.172 0.103 0.066 0.023 0.012 0.001 0.001 

$theoretical.distribution
    0     1     2     3     4     5     6     7     8     9    10    11    12 
0.003 0.021 0.067 0.134 0.190 0.202 0.169 0.112 0.061 0.027 0.010 0.003 0.001 
   13    14    15    16    17    18    19    20 
0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>