On 20/07/2012 8:28 AM, carol white wrote:
Thanks Rui.
I changed my scripts to the followings and I think that it still is not correct.

You haven't told us clearly what you are trying to achieve, and you don't tell us what is wrong with what you have. How do you expect anyone to help?

Duncan Murdoch


See also the attached file.

Thanks for your help,


  tmp
  [1]  2.502519  1.828576  3.755778 17.415000  3.779296  2.956850  2.379663
  [8]  1.103559  8.920316  2.744500  2.938480  7.522174 10.629200  8.552259
[15]  5.425938  4.388906  0.000000  0.723887 11.337860  3.763786


  tmp.p =2*pnorm(abs(scale(tmp)),lower.tail=FALSE)
>  tmp.qnorm = qnorm(tmp.p/2,lower.tail=FALSE)
>  tmp.qnorm = qnorm(tmp.p/2,lower.tail=FALSE)*sign(tmp)
> equal(tmp, tmp.qnorm)
[1] FALSE
> par(mfrow = c(1,3))
> hist(tmp)
> hist(tmp.p)
> hist(tmp.qnorm)



________________________________
  From: Rui Barradas <ruipbarra...@sapo.pt>
To: carol white <wht_...@yahoo.com>
Cc: r-help <r-help@r-project.org>
Sent: Friday, July 20, 2012 2:02 PM
Subject: Re: [R] function for inverse normal transformation
Hello,

No it's not correct, you are computing a what seems to be a
     two-tailed probabiity, so the inverse should account for it. Look
     closely: you take the absolute value, then the upper tail
     probability, then multiply 2 into it. Reverse these steps to get the
     correct value.

# Helper function
equal <- function(x, y, tol=.Machine$double.eps^0.5) all(abs(x -
     y)  < tol)

m <- rnorm(5)
p <- 2*pnorm(abs(m), lower.tail=FALSE)
m2 <- qnorm(p/2, lower.tail=FALSE)*sign(m)

equal(m, m2)

(The helper function is just to test floating point values computed
     differently for equality.)

Hope this helps,

Rui Barradas


Em 20-07-2012 12:36, carol white escreveu:

Thanks for your reply. So to derive it from a given data set, is the following correct to do? 
my_data.p =2*pnorm(abs(my_data),lower.tail=FALSE) my_data.q = qnorm(my_data.p) Cheers, 
________________________________ From: Duncan Murdoch <murdoch.dun...@gmail.com> Cc: 
"r-h...@stat.math.ethz.ch" <r-h...@stat.math.ethz.ch> Sent: Friday, July 20, 2012 
1:23 PM
Subject: Re: [R] function for inverse normal transformation On 12-07-20 6:21 
AM, carol white wrote:
>Hi,
What is the function for inverse normal transformation?
>qnorm Duncan Murdoch
>Thanks, Carol     [[alternative HTML version deleted]] 
______________________________________________ R-help@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.
>[[alternative HTML version deleted]]
>
>
>______________________________________________ R-help@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.


______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to