scale_to_01.Rd
This function scales a numeric vector to a range between 0 and 1. Primarily intended for processing output from Pseudorandom Number Generators (PRNGs), this scaling transforms values into a standardized range, facilitating downstream analysis and comparative studies.
scale_to_01(x)
A numeric vector where each element is rescaled to fall within the range [0, 1]. If all values in `x` are identical, the function returns a vector of zeros of the same length.
The formula used for rescaling each element \(x_i\) in the vector \(x\) is: $$x_{scaled} = \frac{x_i - \text{min}(x)}{\text{max}(x) - \text{min}(x)}$$
This method of normalization ensures values are linearly scaled, and is commonly used in probabilistic modeling, machine learning, and simulations to transform data into a uniform range [0, 1]. Note that the method may produce NaN values if `x` is a constant vector, which is handled as a special case.
- StackOverflow. (2011). Scale a series between two points. Retrieved from https://stackoverflow.com/questions/5468280/scale-a-series-between-two-points - Wikipedia contributors. (2023). Feature scaling. In *Wikipedia, The Free Encyclopedia*. Retrieved from https://en.wikipedia.org/wiki/Feature_scaling