pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
62 stars 18 forks source link

Back Transform Squareroot transformed data #75

Closed hjwood closed 4 years ago

hjwood commented 4 years ago

Hi,

I've been trying to backtransfrom my squareroot transformed data in visreg but I can't find the right command for trans=. In your guidance you only discuss using trans=exp to backtransform log transformed data. How do I specify I want to square the values using trans=.

Heather.

pbreheny commented 4 years ago

Hi Heather,

If you want a transformation function that doesn't exist, you'll have to define it yourself. For example:

library(visreg)
fit <- lm(sqrt(Ozone) ~ Wind + Temp, airquality)
f <- function(x) x^2
visreg(fit, 'Wind', trans=f)

# Or as a one-liner
visreg(fit, 'Wind', trans=function(x) x^2)