[Lign251] Bernoulli distribution in R

Roger Levy rlevy at ucsd.edu
Wed Oct 22 11:29:06 PDT 2008


Hi everyone,

I got a question about the d,p,q,r R functions for the bernoulli
distribution.  you can just use the *binom functions with a size
parameter 1 for this.  so for example, the following code generates 100
samples of a Bernoulli random variable with success parameter 0.7:

  rbinom(100,1,0.7)

Roger
-- 

Roger Levy                      Email: rlevy at ling.ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy



More information about the Lign251 mailing list