# Re: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8

From: Mao Jianfeng <jianfeng.mao_at_gmail.com>
Date: Thu, 28 Apr 2011 20:08:51 +0200

Thanks a lot for all your replies.

This may be a bad question. But, for me I was improved by asking this question.

Thanks,

Jian-Feng,

2011/4/28 David Winsemius <dwinsemius_at_comcast.net>

>
> 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.
>
>
> -------------------------------------------------------
>> Assistant Professor,
>> Division of Geriatric Medicine and Gerontology School of Medicine Johns
>> Hopkins University
>>
>> Ph. (410) 502-2619
>>
>>
>> -----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.
>>
>>
>> Best,
>> Jian-Feng,
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> 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
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> David Winsemius, MD
> West Hartford, CT
>
>

```--
Jian-Feng, Mao

the Institute of Botany,

[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help