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.


        [[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.

Reply via email to