[R] dnorm and qnorm

David Winsemius dwinsemius at comcast.net
Fri Nov 12 23:46:18 CET 2010


On Nov 12, 2010, at 5:35 PM, Edwin Sun wrote:

>
> Hello all,
>
> I have a question about basic statistics.  Given a PDF value of  
> 0.328161,
> how can I find out the value of -0.625 in R? It is like reversing  
> the dnorm
> function but I do not know how to do it in R.
>
>> pdf.xb <- dnorm(-0.625)
>
>> pdf.xb
> [1] 0.328161
>
>> qnorm(pdf.xb)
> [1] -0.444997
>
>> pnorm(pdf.xb)
> [1] 0.628605
>

Since only at the mode of dnorm will there be a unique solution, you  
will need to decide on which side of zero you want to work, apparently  
the negative side from the expected answer. Then you can use optim or  
optimize to minimize the difference between dnorm() and 0.328161 for  
arguments over an appropriate range:
 > f <- function (x,a) (dnorm(x)-a)^2
 > xmin <- optimize(f, c(-1, 0), tol = 0.0001, a =0.328161)
 > xmin
$minimum
[1] -0.6250044

$objective
[1] 8.71397e-13




David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list