to01: to01 - function to convent any variable to the [0,1] range

View source: R/utils.r

to01R Documentation

to01 - function to convent any variable to the [0,1] range

Description

to01 - function to convent any variable to the [0,1] range

Usage

to01(x, na.rm = TRUE, squeeze = FALSE, prior = 0.5, type = "both")

Arguments

x

A numeric vector.

na.rm

Logical, should missing data be excluded when calculating min/max

prior

Numeric, a prior probability for squeezing from [0,1] to (0,1) where the square bracket indicates inclusion of endpoints and parentheses excludes the endpoints. See the references.

type

Character. Options are "both" which squeezes from [0,1] to (0,1), "floor" which squeezes from [0,1] to (0,1], and "ceiling" which squeezes from [0,1] to [0,1).

Author(s)

Stephen Tueller Stueller@rti.org

References

Smithson, M., & Verkuilen, J. (2006). A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables. Psychological Methods, 11(1), 54.

Examples

set.seed(4269)
x <- rnorm(100)
summary(to01(x))
summary(to01(x, squeeze=TRUE))
summary(to01(x, squeeze=TRUE, type="floor"))
summary(to01(x, squeeze=TRUE, type="ceiling"))

ICTatRTI/PersonAlytics documentation built on Dec. 13, 2024, 11:06 p.m.