How to calculate arcsin(sgn(x)√|x|)?
r, transformation
Solution
x <- seq(-1, 1, length = 20)
asin(sign(x) * sqrt(abs(x)))
or as a function
trans.arcsine <- function(x){
asin(sign(x) * sqrt(abs(x)))
}
trans.arcsine(x)
Problem
I'm trying to arcsine squareroot data lying on `[-1,1]`. Using `transf.arcsine` from the `metafor` package produces `NaNs` when trying to squareroot the negative datapoints. Conceptually, I want to use `arcsin(sgn(x)√|x|)` i.e. square the absolute value, apply its previous sign, then arcsine transform it. The trouble is I have no idea how to begin doing this in R. Help would be appreciated.