if you want to simulate from normal you only need median (which is
also the mean) and one quantile since you only need to find the
standard deviation, e.g.,
q1 <- qnorm(0.25, sd = 5.12)
######################
sigma <- function(sd, q, p, mean){
p - pnorm(q, mean, sd)
}
sd <- uniroot(sigma, c(.Machine$double.eps^0.25, 100), q = q1, p =
0.25, mean = 0)$root
# then
x <- rnorm(100, 0, sd)
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Dr. Takashi Kikuchi" <mhs208@bangor.ac.uk>
To: <s-news@lists.biostat.wustl.edu>
Sent: Thursday, May 04, 2006 4:02 PM
Subject: [S] Generate random numbers knowing median and
inter-quartiles only
Dear S-Plus users
Dose anyone have S-plus codes to generate random numbers knowing
median and inter-quartiles only. Let's assume a normal distribution
for the samples.
Regards,
Takashi
--
mhs208@bangor.ac.uk
--
Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi,
gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig
gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y
neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar
unwaith a dilëwch y neges. Os na fwriadwyd anfon y neges atoch chi,
rhaid i chi beidio â defnyddio, cadw neu ddatgelu unrhyw wybodaeth a
gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i
hanfonodd yn unig ac nid yw o anghenraid yn cynrychioli barn
Prifysgol Cymru, Bangor. Nid yw Prifysgol Cymru, Bangor yn gwarantu
bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau
neu
100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn
nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract
rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa
Cyllid Prifysgol Cymru, Bangor. www.bangor.ac.uk
This email and any attachments may contain confidential material and
is solely for the use of the intended recipient(s). If you have
received this email in error, please notify the sender immediately
and delete this email. If you are not the intended recipient(s),
you
must not use, retain or disclose any information contained in this
email. Any views or opinions are solely those of the sender and do
not necessarily represent those of the University of Wales, Bangor.
The University of Wales, Bangor does not guarantee that this email
or
any attachments are free from viruses or 100% secure. Unless
expressly stated in the body of the text of the email, this email is
not intended to form a binding contract - a list of authorised
signatories is available from the University of Wales, Bangor
Finance
Office. www.bangor.ac.uk
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu
with
the BODY of the message: unsubscribe s-news
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
|