I would like help with R code to estimate theta for the Inverse Hyperbolic Sine Transformation. This transformation is useful to transform skewed data that contain negative values or zeros.
There are a couple of related posts that discuss the IHS and suggest there is a maximum likelihood approach to estimating theta but I can't work out how to apply it. These related posts are:
Please see example code below. I've made skewed data by using the inverse of the IHS. Now, given the skewed data, and no prior knowledge of theta, how can I work out what theta should be? I would be most grateful for R code to undertake this analysis.
# Define the IHS transformation and its inverse
IHS <- function(x, theta){ # Inverse IHS transformation
(1/theta)*asinh(theta * x)
}
Inv.IHS <- function(x, theta){ # IHS transformation
(1/theta)*sinh(theta * x)
}
set.seed(1)
# generate some normal data
x <- rnorm(1000)
hist(x, breaks='FD')
# skew it by applying the Inverse of the IHS transformation
xt <- Inv.IHS(x, theta=2)
hist(xt, breaks='FD') # yep this is skewed. How could we estimate theta?