Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do an inverse log transformation in R?

Tags:

math

r

logarithm

I would like to do an inverse log transformation on R.

I am familiar with regular log transformations:

DF1$RT <- log(DF1$RT)

but I don't know how to do an inverse one.

Can anyone please help?

like image 220
Yash Avatar asked Dec 24 '18 12:12

Yash


People also ask

What is the inverse transformation of a log function?

inverse function. In this case it refers to solving the equation log (y) = x for y in which case the inverse transformation is exp (x) assuming the log is base e. (In general, the solution is b^x if the log is of base b. For example, if log10 (y) = x then the inverse transformation is 10^x .) Thanks for contributing an answer to Stack Overflow!

How to perform a logarithm transformation in R?

Log transformation in R is accomplished by applying the log () function to vector, data-frame or other data set. Before the logarithm is applied, 1 is added to the base value to prevent applying a logarithm to a 0 value.

How to find the inverse of a log or exponential function?

The inverse of a log or exponential function is given by : An inverse log transformation in the R programming language can be exp (x) and expm1 (x) functions. exp ( ) function simply computes the exponential function, whereas the expm1 ( ) function computes exp (x) – 1 accurately also for |x| << 1.

How do you interpret a graph of log transformation?

Looking at the graph, there are a few aspects of the function we notice immediately: These are the effects of log transforming your variables — small values become more spread out, and large values become closer together. Another caveat is that you cannot take the log of a negative number. Also, log (1) =0 and log (e) =1.


1 Answers

The term inverse can be used with different meanings. The meanings are:

  1. reciprocal. In this case the inverse of log(x) is 1/log(x)

  2. inverse function. In this case it refers to solving the equation log(y) = x for y in which case the inverse transformation is exp(x) assuming the log is base e. (In general, the solution is b^x if the log is of base b. For example, if log10(y) = x then the inverse transformation is 10^x.)

like image 135
G. Grothendieck Avatar answered Sep 23 '22 23:09

G. Grothendieck