Skip to content

Instantly share code, notes, and snippets.

@christophergandrud
Created July 22, 2014 10:29
Show Gist options
  • Save christophergandrud/4b6ac56c10e4b8b58ae8 to your computer and use it in GitHub Desktop.
Save christophergandrud/4b6ac56c10e4b8b58ae8 to your computer and use it in GitHub Desktop.
Simple function to transform a dependent variable that in [0,1] rather than (0, 1) to beta regression. Suggested by Smithson & Verkuilen (2006).
#' Simple function to transform a dependent variable that in [0,1] rather than
#' (0, 1) to beta regression. Suggested by Smithson & Verkuilen (2006).
#'
#' @param y vector of the dependent variable that is in [0, 1].
svTransform <- function(y)
{
n <- length(y)
transformed <- (y * (n-1) + 0.5)/n
return(transformed)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment