On 10/3/07, stat stat <[EMAIL PROTECTED]> wrote:
> I want to get a sample of some arbitrary size from a population having only 
> two values 0 and 1 with replacement, but with different probability for 
> selection. For example 0 will be selected with probability 0.4 and 1 with 
> 0.6. I could use sample function i.e. sample(c(0,1), 30, T) to get this, 
> however here, selection of either 0 or 1 has equal probability here. I am 
> looking for a function which can do the same thing but with different 
> probabilities.
>

either ?sample (see "prob" argument), or ?rbinom

/Gustaf

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to