rbayesianmixed-models

How to Phi^-1 transform a variable in R?


I'm trying to create a Bayesian mixed linear model for my master thesis but having trouble with heteroscedasticity. So my supervisor suggested to Phi^-1 transform my dependent variable (since it's a continous variable between 0 an 1). Since I just started learning R, I don't really know how to do this.

My model looks like this:

model <- stan_lmer(y ~ x + (1+x|z), data = mydata)

I know that a log transformation would look like this:

model <- stan_lmer(log(y) ~ x + (1+x|z), data = mydata)

But I can't find the function, that I need to Phi^-1 transform it...

All I found is the Phi_inv() function from the BayesianFROC package, which is no longer supported with the current version of RStudio. Maybe I'm also using the wrong search terms but I'm not that deep into statistics either (only 3 semesters).

Any suggestions? Thank you already!


Solution

  • The Phi_inv() function is the inverse of the Gaussian CDF. This is already implemented in the qnorm() function in the stats package. Likewise, Phi(), the CDF of the Gaussian distribution, is implemented in the pnorm() function in the stats package. You can see as much in the online help file for Phi_inv(). Likewise, in the code, you can see how they are defined:

    Phi <- function(x) {
      y <- stats::pnorm(q=x)
      return(y)
    }
    

    and

    Phi_inv <- function(x) {
      y <- stats::qnorm(x)
      return(y)
    }