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 E
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
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 t
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.
> >
I just realized that I had misread what was wanted -- the code I wrote was
for mean=0, sd=1, not for mean=1. So for mean=m, and sd=s, lower limit L
and upper limit U, this approach will work:
n <- 1000
m <- 1
s <- 1
L <- .2
U <- .8
p_L <- pnorm(L, mean=m, sd=s)
p_U <- pnorm(U, mean=m, sd=s)
Good point. It would be absurdly inefficient if the upper and lower
limits on the interval of interest were, say, 0.2 and 0.201 instead of 0.2
and 0.8. Here's what I think is probably the best general approach:
Compute the CDF for the upper and lower limits of the interval and
generate unifo
That method (creating lots of samples and throwing most of them away) is
usually frowned upon :-).
Try this: (I haven't, so it may well have syntax errors)
% n28<- dnorm(seq(.2,.8,by=.001),mean=1,sd=1)
% x <- sample(seq(.2,.8,by=.001), size=500,replace=TRUE, prob=n28)
And I guess in retrospe
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
>
> On Apr 28, 2011, at 12:09 PM, Ravi Varadhan wrote:
>
> Surely you must be joking, Mr. Jianfeng.
>>
>>
> Perhaps not joking and
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=5, m=1, sd=1)
xtrunc <- x[x>=0.2 & x <=0.8]
r
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: rvarad...@jhmi.edu
-Original Messa
10 matches
Mail list logo