Last active
March 24, 2018 06:45
-
-
Save derekpowell/758ef0223832464b821d323974e329a6 to your computer and use it in GitHub Desktop.
rescale variable on open interval (0, 1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rescale_beta <- function(x, lower, upper) { | |
# rescales onto the open interval (0,1) | |
# rescales over theoretical bounds of measurement, specified by "upper" and "lower" | |
N <- length(x) | |
res <- (x - lower) / (upper - lower) | |
res <- (res * (N - 1) + .5) / N | |
return(as.vector(res)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rescale variable onto (0, 1) for beta regression. Based on Smithson & Verkuilen (2006), see http://dx.doi.org/10.1037/1082-989X.11.1.54.supp