Date: Wed, 3 Oct 2007 12:51:14 +0100 (BST)
From: stat stat <stat700004 at yahoo.co.in>
To: r-help at stat.math.ethz.ch
MIME-Version: 1.0
X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch
Content-Disposition: inline
Subject: [R] Sample selection problem
X-BeenThere: r-help at r-project.org
X-Mailman-Version: 2.1.9
List-Id: "Main R Mailing List: Primary help" <r-help.r-project.org>
List-Unsubscribe: <https://stat.ethz.ch/mailman/listinfo/r-help>,
<mailto:r-help-request at r-project.org?subject=unsubscribe>
<mailto:r-help-request at r-project.org?subject=subscribe>
Content-Transfer-Encoding: 7bit
X-MSSL-MailScanner-Information: Please contact the ISP for more information
X-MSSL-MailScanner: No virus found
X-MSSL-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.906, required 5,
BAYES_00 -4.90, FROM_ENDS_IN_NUMS 0.99)
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.
---------------------------------
Meet people who discuss and share your passions. Join them now.
[[alternative HTML version deleted]]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jennifer Barnes
PhD student: long range drought prediction
Climate Extremes Group
Department of Space and Climate Physics
University College London
Holmbury St Mary
Dorking, Surrey, RH5 6NT
Tel: 01483 204149
Mob: 07916 139187
Web: http://climate.mssl.ucl.ac.uk