Re: [R] dnorm and qnorm

2010-11-14 Thread Edwin Sun
Thank you all for the great help. I think the optimize function and approach solves my problem well. Edwin Sun -- View this message in context: http://r.789695.n4.nabble.com/dnorm-and-qnorm-tp3040427p3041962.html Sent from the R help mailing list archive at Nabble.com.

[R] dnorm and qnorm

2010-11-12 Thread Edwin Sun
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

Re: [R] dnorm and qnorm

2010-11-12 Thread David Winsemius
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

Re: [R] dnorm and qnorm

2010-11-12 Thread Peter Langfelder
Not sure if there's a pre-defined function for it, but use your basic math skills: the normal distribution is dnorm(x) = 1/(sqrt(2*pi)) * exp(-x^2/2), so the inverse function (on the interval [0, infinity] is f = function(x) {sqrt( -2*log(sqrt(2*pi) * x)) } Since the dnorm function is not

Re: [R] dnorm and qnorm

2010-11-12 Thread Bert Gunter
There is no reversing the dnorm function -- dnorm is many to one in general (in the normal case, 2 to 1 except for the mean). How would you reverse dunif, for example?! However, with that understanding you could do a simple one dimensional search within the range you want via optimize(), as in