[R] Normal distribution with R
Eik Vettorazzi
E.Vettorazzi at uke.uni-hamburg.de
Fri May 1 14:53:09 CEST 2009
Hi James,
(qnorm(.9)-qnorm(.1))
is the width of the 80% CI of a standard normal distribution. So its a
kind of standardization the other way round calculating sd from this.
The same holds for arbitrary p1 and p2. Without loss of generality
(since the normal distribution is symmetric), assume p2>p1.
So within the corresponding quantiles q1 and q2 are p2-p1 of the
probability mass, which relates to x*sd, where x is the related width of
the standard normal distribution (remember that sd is a scaling factor)
p1<-.412
p2<-.67777888
me<-4.3
sds<-2.7
q1<-qnorm(p1,me,sds)
q2<-qnorm(p2,me,sds)
sdc<-(q2-q1)/(qnorm(p2)-qnorm(p1)) #(qnorm(p2)-qnorm(p1))
So, with this known sd, its easy to calculate the mean with
meanc<-q1-qnorm(p1)*sdc
because with P(.) as CDF of a standard normal distribution it holds
P((q1-mean)/sd)=p1
inverting
P^(-1)(P(q1-mean)/sd))=(q1-mean)/sd=qnorm(p1)
hth.
guox at ucalgary.ca schrieb:
> Thanks.
> I just gave an example.
> If we know qnorm(.412,me,sd)and qnorm(.67777888,me,sd),
> what happens? Can you explain more why
> sd<-(q90-q10)/ (qnorm(.9)-qnorm(.1))
>
> Normal distribution function is given by an integral.
> If we know two results of the integral, we can find two unknows
> me and sd in the integral by solving the equations theorectically.
> I was wondering if there is a numeric way in R.
>
> -james
>
>> Hi James
>> its just simple calculus, since with
>> q90<-qnorm(.9,me,sd)
>> q10<-qnorm(.1,me,sd)
>>
>> mean<-(q90+q10)/2 # the normal distribution is symmetric around the
>> mean
>> sd<-(q90-q10)/ (qnorm(.9)-qnorm(.1)) # between 10th and 90th are
>> qnorm(.9)-qnorm(.1)=2.563103sds
>>
>> hth.
>>
>> guox at ucalgary.ca schrieb:
>>
>>> If we knew two pth quantiles for a normal distribution,
>>> is it possible that we can find mean and sigma for the normal
>>> distribution
>>> using R?
>>>
>>> Let x ~ norm(mean, sigma).
>>> Suppose that qnorm(0.9,mean,sigma) and qnorm(0.1,mean,sigma) are known.
>>> Can we find mean and sigma using R?
>>>
>>> Thanks,
>>>
>>> -james
>>>
>>> ______________________________________________
>>> 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.
>>>
>>>
>> --
>> Eik Vettorazzi
>> Institut für Medizinische Biometrie und Epidemiologie
>> Universitätsklinikum Hamburg-Eppendorf
>>
>> Martinistr. 52
>> 20246 Hamburg
>>
>> T ++49/40/42803-8243
>> F ++49/40/42803-7790
>>
>>
>>
>>
>
>
>
More information about the R-help
mailing list