[R] Sample selection problem
Gustaf Rydevik
gustaf.rydevik at gmail.com
Wed Oct 3 13:55:56 CEST 2007
On 10/3/07, stat stat <stat700004 at yahoo.co.in> 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
More information about the R-help
mailing list