An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110428/6283ca8b/attachment.pl>
how to generate a normal distribution with mean=1, min=0.2, max=0.8
8 messages · Mao Jianfeng, Ravi Varadhan, Giovanni Petris +2 more
Surely you must be joking, Mr. Jianfeng. ------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Mao Jianfeng Sent: Thursday, April 28, 2011 12:02 PM To: r-help at r-project.org Subject: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8 Dear all, This is a simple probability problem. I want to know, How to generate a normal distribution with mean=1, min=0.2 and max=0.8? I know how the generate a normal distribution of mean = 1 and sd = 1 and with 500 data point. rnorm(n=500, m=1, sd=1) But, I am confusing with how to generate a normal distribution with expected min and max. I expect to hear your directions. Thanks in advance. Best, Jian-Feng, ______________________________________________ R-help at 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.
On Apr 28, 2011, at 12:09 PM, Ravi Varadhan wrote:
Surely you must be joking, Mr. Jianfeng.
Perhaps not joking and perhaps not with correct statistical specification. A truncated Normal could be simulated with: set.seed(567) x <- rnorm(n=50000, m=1, sd=1) xtrunc <- x[x>=0.2 & x <=0.8] require(logspline) plot(logspline(xtrunc, lbound=0.2, ubound=0.8, nknots=7))
David. > ------------------------------------------------------- > Ravi Varadhan, Ph.D. > Assistant Professor, > Division of Geriatric Medicine and Gerontology School of Medicine > Johns Hopkins University > > Ph. (410) 502-2619 > email: rvaradhan at jhmi.edu > > > -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org > ] On Behalf Of Mao Jianfeng > Sent: Thursday, April 28, 2011 12:02 PM > To: r-help at r-project.org > Subject: [R] how to generate a normal distribution with mean=1, > min=0.2, max=0.8 > > Dear all, > > This is a simple probability problem. I want to know, How to > generate a > normal distribution with mean=1, min=0.2 and max=0.8? > > I know how the generate a normal distribution of mean = 1 and sd = 1 > and > with 500 data point. > > rnorm(n=500, m=1, sd=1) > > But, I am confusing with how to generate a normal distribution with > expected > min and max. I expect to hear your directions. > > Thanks in advance. > > Best, > Jian-Feng, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. > > ______________________________________________ > R-help at 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. David Winsemius, MD West Hartford, CT
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110428/bc682537/attachment.pl>
Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke... Giovanni
On Thu, 2011-04-28 at 13:06 -0400, David Winsemius wrote:
On Apr 28, 2011, at 12:09 PM, Ravi Varadhan wrote:
Surely you must be joking, Mr. Jianfeng.
Perhaps not joking and perhaps not with correct statistical specification. A truncated Normal could be simulated with: set.seed(567) x <- rnorm(n=50000, m=1, sd=1) xtrunc <- x[x>=0.2 & x <=0.8] require(logspline) plot(logspline(xtrunc, lbound=0.2, ubound=0.8, nknots=7)) -- David.
------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu -----Original Message----- From:
r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org
] On Behalf Of Mao Jianfeng Sent: Thursday, April 28, 2011 12:02 PM To: r-help at r-project.org Subject: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8 Dear all, This is a simple probability problem. I want to know, How to generate a normal distribution with mean=1, min=0.2 and max=0.8? I know how the generate a normal distribution of mean = 1 and sd =
1
and with 500 data point. rnorm(n=500, m=1, sd=1) But, I am confusing with how to generate a normal distribution
with
expected
min and max. I expect to hear your directions.
Thanks in advance.
Best,
Jian-Feng,
[[alternative HTML version deleted]]
______________________________________________ R-help at 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. ______________________________________________ R-help at 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. David Winsemius, MD West Hartford, CT ______________________________________________ R-help at 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.
Giovanni Petris <GPetris at uark.edu> Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/
On Fri, 29 Apr 2011, Giovanni Petris wrote:
Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke...
Well, he is a lot better with English than I am with Mandarin. He seemed to like the truncated normal answers, so we'll let those be his answers. It is possible to choose parameters for a normal distribution with 500 observations such that the expected value of the maximum is .8 and the expected value of the minimum is .2. Obviously, the mean would be .5, not 1, but what would the variance then have to be to provide the correct expected max and min? That's another legitimate question. Mike
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Mao Jianfeng Sent: Thursday, April 28, 2011 12:02 PM To: r-help at r-project.org Subject: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8 Dear all, This is a simple probability problem. I want to know, How to generate a normal distribution with mean=1, min=0.2 and max=0.8? I know how the generate a normal distribution of mean = 1 and sd = 1 and with 500 data point. rnorm(n=500, m=1, sd=1) But, I am confusing with how to generate a normal distribution with expected min and max. I expect to hear your directions. Thanks in advance. Best, Jian-Feng,
On Apr 29, 2011, at 1:29 PM, Mike Miller wrote:
On Fri, 29 Apr 2011, Giovanni Petris wrote:
Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke...
Well, he is a lot better with English than I am with Mandarin. He seemed to like the truncated normal answers, so we'll let those be his answers. It is possible to choose parameters for a normal distribution with 500 observations such that the expected value of the maximum is .8 and the expected value of the minimum is .2. Obviously, the mean would be .5, not 1, but what would the variance then have to be to provide the correct expected max and min? That's another legitimate question.
You would need to specify an N since the expected first and last order statistic would decrease/increase with increasing N.
David. > > Mike > > >>>> -----Original Message----- >>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org >>>> ] On Behalf Of Mao Jianfeng >>>> Sent: Thursday, April 28, 2011 12:02 PM >>>> To: r-help at r-project.org >>>> Subject: [R] how to generate a normal distribution with mean=1, >>>> min=0.2, max=0.8 >>>> >>>> Dear all, >>>> >>>> This is a simple probability problem. I want to know, How to >>>> generate a normal distribution with mean=1, min=0.2 and max=0.8? >>>> >>>> I know how the generate a normal distribution of mean = 1 and sd >>>> = 1 and with 500 data point. >>>> >>>> rnorm(n=500, m=1, sd=1) >>>> >>>> But, I am confusing with how to generate a normal distribution >>>> with expected min and max. I expect to hear your directions. >>>> >>>> Thanks in advance. >>>> >>>> Best, >>>> Jian-Feng, David Winsemius, MD West Hartford, CT
On Fri, 29 Apr 2011, David Winsemius wrote:
On Apr 29, 2011, at 1:29 PM, Mike Miller wrote:
On Fri, 29 Apr 2011, Giovanni Petris wrote:
Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke...
Well, he is a lot better with English than I am with Mandarin. He seemed to like the truncated normal answers, so we'll let those be his answers. It is possible to choose parameters for a normal distribution with 500 observations such that the expected value of the maximum is .8 and the expected value of the minimum is .2. Obviously, the mean would be .5, not 1, but what would the variance then have to be to provide the correct expected max and min? That's another legitimate question.
You would need to specify an N since the expected first and last order statistic would decrease/increase with increasing N.
Right -- I chose N=500, as did the OP. I think the order statistics for the normal are pretty complex, but it wouldn't be hard to use the density for order statistics for the uniform to compute the appropriate values for a standard normal, then rescale. http://en.wikipedia.org/wiki/Order_statistic#The_order_statistics_of_the_uniform_distribution You'd have to multiply the beta density times the inverse normal cdf and get the weighted average for a set of points. It doesn't sound terribly difficult but I don't want to do it! ;-) Mike