# [R] function for inverse normal transformation

Bert Gunter gunter.berton at gene.com
Fri Jul 20 21:45:46 CEST 2012

```The nature of her inquiries suggests to me that Carol strongly needs
to consult a local statistician rather than fooling around with this
list.

-- Bert

On Fri, Jul 20, 2012 at 11:56 AM, John Fox <jfox at mcmaster.ca> wrote:
> Dear Carol,
>
>> -----Original Message-----
>> From: carol white [mailto:wht_crl at yahoo.com]
>> Sent: July-20-12 2:45 PM
>> To: John Fox
>> Subject: Re: inverse normal transformation
>>
>>
>> The purpose of applying inverse normal transformation is to reduce the
>> impact of outliers and deviations from normality on statistical
>> analysis.
>
> In other words, you're forcing the variable to follow a normal distribution
> and making the units of measurement uninterpretable. I'll assume that this
> somehow makes sense.
>
>>
>> Indeed, it includes the steps that you went through. However, I don't
>> know why you calculated  (rank - 0.5)/20 to get the p-value. Then, how
>> could we convert the quantiles (Q) into normal deviates?
>
> They *are* quantiles on the standard normal scale -- that's what qnorm()
> provides (with the default mean of 0 and standard deviation of 1). The
> cumulative probabilities (not p-values) are calculated from the order
> statistics of your data, where subtracting 0.5 avoids cumulative
> probabilities of 0 or 1. This (or something close to it) is standard for
> computing comparison quantiles.
>
> I'm copying this message to r-help (with the original subject line) since
> the discussion there continues.
>
> Best,
>  John
>
>>
>> Many thanks,
>>
>> Carol
>>
>>
>> ________________________________
>>
>> From: John Fox <jfox at mcmaster.ca>
>> To: 'carol white' <wht_crl at yahoo.com>
>> Sent: Friday, July 20, 2012 4:43 PM
>> Subject: RE: inverse normal transformation
>>
>>
>> Dear Carol,
>>
>> Like the people on r-help list who tried to help you, I have no idea
>> why you
>> want to do this. If you're trying to get the corresponding standard
>> normal
>> quantiles for your data, as for a QQ plot (and why else you might want
>> them
>> isn't clear to me), you can simply compute
>>
>> rank <- rank(tmp)
>> P <- (rank - 0.5)/20
>> Q <- qnorm(P)
>>
>> Then, the QQ plot is
>>
>> plot(Q, tmp)
>>
>> Best,
>> John
>>
>> --------------------------------
>> John Fox
>> Senator William McMaster
>>   Professor of Social Statistics
>> Department of Sociology
>> McMaster University
>> http://socserv.mcmaster.ca/jfox
>>
>>
>>
>>
>> > -----Original Message-----
>> > From: carol white [mailto:wht_crl at yahoo.com]
>> > Sent: July-20-12 9:08 AM
>> > To: jfox at mcmaster.ca
>> > Subject: inverse normal transformation
>> >
>> > Dear John,
>> >
>> >
>> > Are the following scripts correct to get the inverse normal
>> > transformation of a data set?
>> >
>> >
>> > Thanks for your help,
>> >
>> >
>> > Carol
>> > -----------------------------------------------
>> >
>> >  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)
>> >
>> > > par(mfrow = c(1,3))
>> > > hist(tmp)
>> > > hist(tmp.p)
>> > > hist(tmp.qnorm)
>> >
>>
>>
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.

--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website: