Reverse transformation in R to var continues with max = Inf

Asked

Viewed 44 times

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 have normal distribution and so I applied an inverse 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 reverse shows value Max. = Inf. I believe that for this reason, the qqnorm Plot for this transformed variable is not running. Displays 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?

1 answer

1

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

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

Note that the inverse of .Machine$double.eps can’t Inf.

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

If this doesn’t work, try sqrt(.Machine$double.eps).

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

See the help page ?.Machine.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.