This function logit.m is used to transform proportional data between 0-1 to for statistical analysis such as regressions. The logit transform of x is defined as follows:
logit(x) = log(x/(1-x))
This function transforms the proportions between 0-1 into real numbers between -Inf and +Inf for use in regression analysis
This function uses an epsilon method to truncate the proportion data if there are occurrences of 0 and/or 1 values where epsilon is half of the lowest non-zero value of x (if there are 0 values but not 1 values) or epsilon is half of the difference between 1 and the highest non-one value of x (if there are 1 values but not 0 values) or the min of half of the lowest non-zero value of x and half of the difference between 1 and the highest non-one value of x (if there are 0 and 1 values but not 0 values) and epsilon is substituted for the zero values and 1-epsilon is substituted for the 1 values to truncate and maintain symmetry and shape of the logit distribution.
This function uses the following two other custom matlab functions by Jan Gläscher that are also in the mathworks file exchange repository named "NaN Suite" (available at https://www.mathworks.com/matlabcentral/fileexchange/6837-nan-suite):
- nanmin2 find the minimum value from a vector or array that may contain nan values
- nanmax2 find the maximum value from a vector or array that may contain nan values
引用格式
Gregory Pelletier (2024). logit function to transform proportional data for regression (https://www.mathworks.com/matlabcentral/fileexchange/131509-logit-function-to-transform-proportional-data-for-regression), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2023a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!