Inverse transformation in R for continuous var whose max value = Inf

2

I have the following var continuous:

> summary(banco1$rac)
Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
0.000    5.077    6.694   17.380    8.728    4917.000  465 

This var does not present normal distribution and so I applied a reverse transformation:

inv.rac=1/banco1$rac
> summary(inv.rac)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
 0.0002  0.1146  0.1494     Inf  0.1970     Inf     465 

The inverse has Max. = Inf value. I believe that for this reason, the qqnorm plot for this transformed variable is not running. You receive the following error message:

> qqnorm(inv.rac, main="Q-Q Plot Inversa da rac", xlab="Quantis Teóricos", ylab= "Quantis Observados")
Error in plot.window(...) : need finite 'ylim' values

Does anyone know how to solve this problem?

    
asked by anonymous 11.09.2017 / 11:24

1 answer

1

You can try to add a very small value to zero. For example

inx <- which(banco1$rac == 0)
banco1$rac[inx] <- banco1$rac[inx] + .Machine$double.eps

Note that the inverse of .Machine$double.eps does not give Inf .

1/.Machine$double.eps
[1] 4.5036e+15

If this does not work, try sqrt(.Machine$double.eps) .

1/sqrt(.Machine$double.eps)
[1] 67108864

See the help page ?.Machine .

    
11.09.2017 / 13:51