### Install reflimR Package Source: https://github.com/reflim/reflimr/blob/main/README.md Use this command to install the reflimR package from CRAN. Ensure you have R installed. ```r install.packages("reflimR") ``` -------------------------------- ### Basic Usage of reflimR Source: https://github.com/reflim/reflimr/blob/main/README.md Demonstrates a basic example of using the reflimR package to estimate reference intervals. This includes generating sample data and applying the reflim function. ```r library(reflimR) x <- c(rnorm(800, 100, 10), rnorm(100, 70, 15), rnorm(100, 125, 15)) reflim(x, targets = qnorm(c(0.025, 0.975), 100, 10)) ``` -------------------------------- ### Load reflimR Package Source: https://github.com/reflim/reflimr/blob/main/README.md Load the reflimR package into your R session after installation to make its functions available. ```r library(reflimR) ``` -------------------------------- ### View reflimR Package Documentation Source: https://github.com/reflim/reflimr/blob/main/README.md Access the full documentation for the reflimR package, including all help files, using this command in R. ```r help(package = reflimR) ``` -------------------------------- ### Explore livertests dataset Source: https://context7.com/reflim/reflimr/llms.txt Demonstrates loading, filtering, and visualizing the livertests biomarker dataset. ```r library(reflimR) # Dataset structure str(livertests) # 612 obs. of 11 variables: # Category: "reference" or "patient" # Age, Sex # ALB (albumin), ALT, AST, BIL (bilirubin), CHE, CREA, GGT, PROT # Summary statistics summary(livertests) # Filter by category or sex controls <- subset(livertests, Category == "reference") female_ast <- livertests$AST[livertests$Sex == "f"] male_che <- livertests$CHE[livertests$Sex == "m"] # Visualize distribution of controls vs patients che_ref <- livertests$CHE[livertests$Category == "reference"] che_pat <- livertests$CHE[livertests$Category == "patient"] hist(livertests$CHE, breaks = 20, col = "white", main = "Cholinesterase") hist(che_ref, breaks = 20, col = rgb(0, 1, 0, 0.5), add = TRUE) hist(che_pat, breaks = 20, col = rgb(1, 0, 0, 0.5), add = TRUE) # Estimate reference interval for specific subgroup reflim(male_che, main = "CHE (male)", xlab = "kU/L") ``` -------------------------------- ### Visualize reference intervals with ri_hist Source: https://context7.com/reflim/reflimr/llms.txt Creates histograms with density curves and optional traffic-light coloring for target comparisons. ```r library(reflimR) # First compute statistics using reflim components x <- livertests$CHE trunc_result <- iboxplot(x, plot.it = FALSE) qq_result <- truncated_qqplot(trunc_result$trunc, plot.it = FALSE) # Create histogram with reference interval overlay ri_hist(x, lognormal = trunc_result$lognormal, stats = qq_result$result[1:2], # mean/sd or meanlog/sdlog limits = qq_result$result[3:4], # lower and upper limits perc.norm = trunc_result$perc.norm, # % normal values main = "Cholinesterase", xlab = "kU/L") # With target comparison (adds traffic-light coloring) ri_hist(x, lognormal = TRUE, stats = c(2.0, 0.25), limits = c(5.0, 12.0), perc.norm = 85, targets = c(4.9, 11.9), # Target reference interval main = "CHE Reference Interval", xlab = "kU/L") ``` -------------------------------- ### reflim - Main Reference Limit Estimation Function Source: https://context7.com/reflim/reflimr/llms.txt The `reflim()` function is the primary entry point for reference interval estimation. It performs distribution type detection, iterative truncation of pathological values, and extrapolation of reference limits from Q-Q plot regression. It returns comprehensive statistics including estimated limits, confidence intervals, and tolerance ranges. ```APIDOC ## reflim - Main Reference Limit Estimation Function ### Description Estimates reference intervals from laboratory data using a three-step procedure: distribution type detection, iterative truncation of outliers, and extrapolation from a truncated Q-Q plot. It provides estimated limits, confidence intervals, and tolerance ranges. ### Method `reflim(x, main, xlab, targets, plot.all, n.min)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **x** (numeric vector) - The input data for reference interval estimation. - **main** (string, optional) - Main title for plots. - **xlab** (string, optional) - Label for the x-axis. - **targets** (numeric vector, optional) - Target reference limits for comparison. - **plot.all** (boolean, optional) - If TRUE, displays all four diagnostic plots. - **n.min** (integer, optional) - Minimum sample size required. ### Request Example ```r library(reflimR) # Basic usage x <- livertests$BIL result <- reflim(x) # Advanced usage with labels and target verification ast_female <- livertests$AST[livertests$Sex == "f"] result <- reflim(ast_female, main = "AST (female)", xlab = "U/L", targets = targetvalues[3, 3:4], plot.all = TRUE, n.min = 150) ``` ### Response #### Success Response (200) - **stats** (list) - Contains mean, sd, n.total, n.trunc. - **lognormal** (boolean) - TRUE if data is lognormal, FALSE otherwise. - **limits** (list) - Contains lower.lim, upper.lim, with tolerance ranges. - **confidence.int** (list) - 95% confidence intervals for the limits. - **interpretation** (string) - Comparison with targets: "within tolerance", "slightly decreased/increased", "markedly decreased/increased". - **perc.norm** (numeric) - Estimated percentage of normal values. #### Response Example ```r # Accessing specific results result$limits[1:2] # Lower and upper reference limits result$interpretation # Interpretation against targets result$perc.norm # Estimated percentage of normal values result$confidence.int # 95% confidence intervals ``` ``` -------------------------------- ### Accessing Target Intervals Source: https://context7.com/reflim/reflimr/llms.txt Retrieve specific reference interval bounds from the targetvalues dataset for clinical comparison. ```R targetvalues[1, 3:4] # Albumin female: lower=35, upper=52 targetvalues[3, 5:6] # AST male: lower=10, upper=50 ``` -------------------------------- ### Estimate Reference Intervals with reflim() Source: https://context7.com/reflim/reflimr/llms.txt The reflim() function performs the full estimation process. Use it for basic estimation or advanced scenarios involving target verification and diagnostic plotting. ```r library(reflimR) # Basic usage with built-in liver test data x <- livertests$BIL result <- reflim(x) # Output shows: # $stats: mean, sd, n.total, n.trunc # $lognormal: TRUE/FALSE # $limits: lower.lim, upper.lim, with tolerance ranges # $confidence.int: 95% CI for both limits # Advanced usage with labels and target verification ast_female <- livertests$AST[livertests$Sex == "f"] result <- reflim(ast_female, main = "AST (female)", xlab = "U/L", targets = targetvalues[3, 3:4], # Target limits from reference plot.all = TRUE, # Show all 4 diagnostic plots n.min = 150) # Minimum sample size # Access specific results result$limits[1:2] # Lower and upper reference limits result$interpretation # Comparison with targets: "within tolerance", # "slightly decreased/increased", "markedly decreased/increased" result$perc.norm # Estimated percentage of normal values result$confidence.int # 95% confidence intervals # Simulated data with known reference interval for validation set.seed(123) x <- c(rnorm(800, 100, 10), # Reference population rnorm(100, 70, 15), # Low pathological values rnorm(100, 125, 15)) # High pathological values reflim(x, targets = qnorm(c(0.025, 0.975), 100, 10)) # Expected: lower ~80, upper ~120 (theoretical: 80.4, 119.6) ``` -------------------------------- ### Calculate 95% Confidence Intervals with conf_int95 Source: https://context7.com/reflim/reflimr/llms.txt Calculate 95% confidence intervals for estimated reference limits, with calculations adjusted for sample size and distribution type (normal or log-normal). ```r library(reflimR) # Calculate confidence intervals for estimated limits # Parameters: n (sample size), lower.limit, upper.limit # Example with bilirubin reference limits ci <- conf_int95( n = 500, lower.limit = 3.0, upper.limit = 22.0, lognormal = TRUE ) ci # lower.lim.low lower.lim.upp upper.lim.low upper.lim.upp n # 2.49 3.66 18.25 26.51 500 ``` ```r # Normal distribution example (albumin) ci <- conf_int95( n = 300, lower.limit = 35, upper.limit = 52, lognormal = FALSE, apply.rounding = TRUE ) ``` ```r # Effect of sample size on CI width conf_int95(n = 100, lower.limit = 10, upper.limit = 50, lognormal = TRUE) # Wider CI conf_int95(n = 1000, lower.limit = 10, upper.limit = 50, lognormal = TRUE) # Narrower CI ``` -------------------------------- ### Performing Automatic Comparison Source: https://context7.com/reflim/reflimr/llms.txt Execute the reflim function to compare laboratory test results against established target reference intervals. ```R reflim(livertests$ALB[livertests$Sex == "m"], main = targetvalues[1, 1], # "ALB" xlab = targetvalues[1, 2], # "g/L" targets = targetvalues[1, 5:6]) # Male reference interval ``` -------------------------------- ### Calculate permissible uncertainty Source: https://context7.com/reflim/reflimr/llms.txt Computes tolerance intervals for reference limits without rounding. ```r tol <- permissible_uncertainty(lower.limit = 2.96, upper.limit = 22.24, apply.rounding = FALSE) ``` -------------------------------- ### Calculate Medical Tolerance Limits with permissible_uncertainty Source: https://context7.com/reflim/reflimr/llms.txt Calculate permissible uncertainty ranges around reference limits, useful for comparing estimated limits against external target values according to clinical laboratory guidelines. ```r library(reflimR) # Calculate tolerance limits for reference interval tol <- permissible_uncertainty(lower.limit = 35, upper.limit = 52) tol # lower.lim.low lower.lim.upp upper.lim.low upper.lim.upp # 32.96 37.04 49.27 54.73 # Interpretation: # - Lower limit 35 is acceptable if within [32.96, 37.04] ``` -------------------------------- ### truncated_qqplot - Q-Q Plot Regression for Limit Extrapolation Source: https://context7.com/reflim/reflimr/llms.txt Generates a normal quantile-quantile plot from truncated data and extrapolates reference limits using linear regression on the central 90% of points. ```APIDOC ## truncated_qqplot - Q-Q Plot Regression for Limit Extrapolation ### Description Creates a normal quantile-quantile plot from truncated data and extrapolates reference limits using linear regression on the central 90% of points. The slope and intercept derived from the regression are used to calculate the mean and standard deviation, from which reference limits (mean ± 1.96×SD) are computed. ### Method Not explicitly defined, but involves data plotting and linear regression. ### Endpoint Not applicable (R function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r library(reflimR) # First truncate the data trunc_data <- iboxplot(livertests$BIL, plot.it = FALSE)$trunc # Create Q-Q plot and extrapolate reference limits result <- truncated_qqplot(trunc_data, main = "Bilirubin Q-Q Plot") # With explicit distribution type and custom parameters result <- truncated_qqplot(trunc_data, lognormal = TRUE, perc.trunc = 2.5, n.min = 100, apply.rounding = TRUE) ``` ### Response #### Success Response (200) - **result$result** (data.frame) - Contains regression results including `meanlog`, `sdlog`, `lower.lim`, and `upper.lim`. - **result$lognormal** (logical) - Indicates if limits were back-transformed from log scale. #### Response Example ```json { "result": { "meanlog": 2.087, "sdlog": 0.478, "lower.lim": 2.96, "upper.lim": 22.24 }, "lognormal": true } ``` ``` -------------------------------- ### conf_int95 - 95% Confidence Intervals for Reference Limits Source: https://context7.com/reflim/reflimr/llms.txt Calculates 95% confidence intervals for estimated reference limits, with calculations performed on the log scale for lognormal distributions. ```APIDOC ## conf_int95 - 95% Confidence Intervals for Reference Limits ### Description Calculates 95% confidence intervals for estimated reference limits. The width of these intervals is inversely related to the sample size; larger samples yield narrower intervals. For lognormal distributions, the calculations are conducted on the log scale and then back-transformed to the original scale. ### Method Not explicitly defined, but involves statistical calculations for confidence intervals. ### Endpoint Not applicable (R function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r library(reflimR) # Calculate confidence intervals for estimated limits # Parameters: n (sample size), lower.limit, upper.limit # Example with bilirubin reference limits (lognormal) ci <- conf_int95(n = 500, lower.limit = 3.0, upper.limit = 22.0, lognormal = TRUE) # Normal distribution example (albumin) ci <- conf_int95(n = 300, lower.limit = 35, upper.limit = 52, lognormal = FALSE, apply.rounding = TRUE) # Effect of sample size on CI width conf_int95(n = 100, lower.limit = 10, upper.limit = 50, lognormal = TRUE) # Wider CI conf_int95(n = 1000, lower.limit = 10, upper.limit = 50, lognormal = TRUE) # Narrower CI ``` ### Response #### Success Response (200) - **lower.lim.low** (numeric) - Lower bound of the confidence interval for the lower limit. - **lower.lim.upp** (numeric) - Upper bound of the confidence interval for the lower limit. - **upper.lim.low** (numeric) - Lower bound of the confidence interval for the upper limit. - **upper.lim.upp** (numeric) - Upper bound of the confidence interval for the upper limit. - **n** (integer) - The sample size used in the calculation. #### Response Example ```json { "lower.lim.low": 2.49, "lower.lim.upp": 3.66, "upper.lim.low": 18.25, "upper.lim.upp": 26.51, "n": 500 } ``` ``` -------------------------------- ### View targetvalues dataset Source: https://context7.com/reflim/reflimr/llms.txt Displays the target reference intervals for biomarkers. ```r library(reflimR) # View all target values targetvalues # analyte unit ll.female ul.female ll.male ul.male ``` -------------------------------- ### Calculate Bowley Skewness Coefficient Source: https://context7.com/reflim/reflimr/llms.txt Compute Bowley's quartile skewness coefficient to measure distribution asymmetry. This robust measure is resistant to outliers and useful for comparing original and transformed data. ```r library(reflimR) # Calculate skewness for different distributions bowley(livertests$ALB) # ~0.02 - nearly symmetric bowley(livertests$ALT) # ~0.21 - right-skewed bowley(livertests$GGT) # ~0.30 - strongly right-skewed ``` ```r # Compare original vs log-transformed data x <- livertests$BIL bowley(x) # Original: right-skewed bowley(log(x)) # Log-transformed: more symmetric ``` ```r # Custom alpha for different quantile ranges (default 0.25) bowley(livertests$CREA, alpha = 0.10) # Use 10th and 90th percentiles bowley(livertests$CREA, alpha = 0.25) # Use 25th and 75th percentiles (default) ``` -------------------------------- ### Extrapolate Reference Limits with truncated_qqplot Source: https://context7.com/reflim/reflimr/llms.txt Create a Q-Q plot from truncated data to extrapolate reference limits using linear regression. This function can handle explicit distribution types and custom parameters for truncation and rounding. ```r library(reflimR) # First truncate the data trunc_data <- iboxplot(livertests$BIL, plot.it = FALSE)$trunc # Create Q-Q plot and extrapolate reference limits result <- truncated_qqplot(trunc_data, main = "Bilirubin Q-Q Plot") ``` ```r # Access regression results result$result # meanlog sdlog lower.lim upper.lim # 2.087 0.478 2.96 22.24 result$lognormal # TRUE - limits were back-transformed from log scale ``` ```r # With explicit distribution type and custom parameters result <- truncated_qqplot(trunc_data, lognormal = TRUE, perc.trunc = 2.5, n.min = 100, apply.rounding = TRUE) ``` ```r # Validate Q-Q linearity - curved ends indicate residual pathological values # Check total protein which may have overlapping pathological fraction trunc_prot <- iboxplot(livertests$PROT[livertests$Sex == "f"], plot.it = FALSE)$trunc truncated_qqplot(trunc_prot, n.min = 100) # Deviation from linearity at upper end indicates incomplete truncation ``` -------------------------------- ### bowley - Bowley Skewness Coefficient Source: https://context7.com/reflim/reflimr/llms.txt Calculates Bowley's quartile skewness coefficient, a robust measure of distribution asymmetry. ```APIDOC ## bowley - Bowley Skewness Coefficient ### Description Calculates Bowley's quartile skewness coefficient, which measures the asymmetry of a distribution. Values close to 0 indicate symmetry, positive values indicate right-skewness, and negative values indicate left-skewness. This coefficient is robust to outliers as it is computed using quartiles. ### Method Not explicitly defined, but involves quartile calculation and formula application. ### Endpoint Not applicable (R function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r library(reflimR) # Calculate skewness for different distributions bowley(livertests$ALB) # ~0.02 - nearly symmetric bowley(livertests$ALT) # ~0.21 - right-skewed bowley(livertests$GGT) # ~0.30 - strongly right-skewed # Compare original vs log-transformed data x <- livertests$BIL bowley(x) # Original: right-skewed bowley(log(x)) # Log-transformed: more symmetric # Custom alpha for different quantile ranges (default 0.25) bowley(livertests$CREA, alpha = 0.10) # Use 10th and 90th percentiles bowley(livertests$CREA, alpha = 0.25) # Use 25th and 75th percentiles (default) ``` ### Response #### Success Response (200) - **bowley_coefficient** (numeric) - The calculated Bowley skewness coefficient. #### Response Example ```json { "bowley_coefficient": 0.21 } ``` ``` -------------------------------- ### Detect Distribution Type with lognorm() Source: https://context7.com/reflim/reflimr/llms.txt The lognorm() function evaluates whether data is normal or lognormal by comparing Bowley skewness coefficients. It supports custom thresholds and can be run without plotting for programmatic workflows. ```r library(reflimR) # Symmetric distribution (normal) - albumin data result <- lognorm(livertests$ALB, main = "Albumin", xlab = "g/L") result$lognormal # FALSE - symmetric distribution result$BowleySkewness # normal: ~0.02, lognormal: ~-0.02, delta: ~0.04 # Right-skewed distribution (lognormal) - ALT data result <- lognorm(livertests$ALT, main = "ALT", xlab = "U/L") result$lognormal # TRUE - right-skewed, better fit after log-transform result$BowleySkewness # normal: ~0.21, lognormal: ~0.04, delta: ~0.17 # Custom skewness threshold result <- lognorm(livertests$GGT, cutoff = 0.10, plot.it = TRUE) # Use without plotting for programmatic access dist_type <- lognorm(livertests$CREA, plot.it = FALSE)$lognormal ``` -------------------------------- ### permissible_uncertainty - Medical Tolerance Limits Source: https://context7.com/reflim/reflimr/llms.txt Calculates permissible uncertainty ranges around reference limits, defining acceptable variation according to clinical laboratory guidelines. ```APIDOC ## permissible_uncertainty - Medical Tolerance Limits ### Description Calculates permissible uncertainty ranges around reference limits, adhering to clinical laboratory guidelines. These tolerance intervals specify the acceptable variation when comparing estimated reference limits against target values from external sources. They are crucial for assessing the consistency and comparability of laboratory results. ### Method Not explicitly defined, but involves calculation of tolerance intervals. ### Endpoint Not applicable (R function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r library(reflimR) # Calculate tolerance limits for reference interval tol <- permissible_uncertainty(lower.limit = 35, upper.limit = 52) # Interpretation: # - Lower limit 35 is acceptable if within [32.96, 37.04] # - Upper limit 52 is acceptable if within [49.27, 54.73] ``` ### Response #### Success Response (200) - **lower.lim.low** (numeric) - The lower bound of the permissible uncertainty range for the lower reference limit. - **lower.lim.upp** (numeric) - The upper bound of the permissible uncertainty range for the lower reference limit. - **upper.lim.low** (numeric) - The lower bound of the permissible uncertainty range for the upper reference limit. - **upper.lim.upp** (numeric) - The upper bound of the permissible uncertainty range for the upper reference limit. #### Response Example ```json { "lower.lim.low": 32.96, "lower.lim.upp": 37.04, "upper.lim.low": 49.27, "upper.lim.upp": 54.73 } ``` ``` -------------------------------- ### lognorm - Distribution Type Detection Source: https://context7.com/reflim/reflimr/llms.txt The `lognorm()` function determines if data follows a normal or lognormal distribution using Bowley quartile skewness. It is robust against outliers as it uses quartiles from the central 50% of the data. ```APIDOC ## lognorm - Distribution Type Detection ### Description Determines if a dataset follows a normal or lognormal distribution by comparing Bowley quartile skewness coefficients before and after log-transformation. A difference exceeding a specified threshold suggests a lognormal model. ### Method `lognorm(x, main, xlab, cutoff, plot.it)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **x** (numeric vector) - The input data. - **main** (string, optional) - Main title for plots. - **xlab** (string, optional) - Label for the x-axis. - **cutoff** (numeric, optional) - Custom threshold for skewness difference (default 0.05). - **plot.it** (boolean, optional) - If TRUE, plots the results. ### Request Example ```r library(reflimR) # Symmetric distribution (normal) result <- lognorm(livertests$ALB, main = "Albumin", xlab = "g/L") print(result$lognormal) # Expected: FALSE # Right-skewed distribution (lognormal) result <- lognorm(livertests$ALT, main = "ALT", xlab = "U/L") print(result$lognormal) # Expected: TRUE # Custom skewness threshold and plotting result <- lognorm(livertests$GGT, cutoff = 0.10, plot.it = TRUE) # Programmatic access without plotting dist_type <- lognorm(livertests$CREA, plot.it = FALSE)$lognormal ``` ### Response #### Success Response (200) - **lognormal** (boolean) - TRUE if a lognormal distribution is recommended, FALSE otherwise. - **BowleySkewness** (numeric) - The calculated Bowley skewness coefficient(s). #### Response Example ```r # Accessing distribution type result <- lognorm(livertests$ALB) if (result$lognormal) { print("Lognormal distribution detected") } else { print("Normal distribution detected") } ``` ``` -------------------------------- ### Interpret reference limits Source: https://context7.com/reflim/reflimr/llms.txt Compares estimated reference limits against target values and provides traffic-light color coding for deviations. ```r library(reflimR) # Compare estimated limits against target reference interval estimated_limits <- c(34, 53) # Estimated from reflim() target_limits <- c(35, 52) # From textbook/manufacturer result <- interpretation(estimated_limits, target_limits) # Color coding for visualization result$col.lim # RGB colors for lower and upper limit comparison result$dev.lim # Text interpretation # lower.limit upper.limit # "within tolerance" "slightly increased" # Full output includes tolerance intervals result$tol.lim # Tolerance around estimated limits result$tol.tar # Tolerance around target limits # Use with reflim() for automatic interpretation x <- livertests$ALB[livertests$Sex == "f"] reflim(x, targets = targetvalues[1, 3:4], main = "Albumin (female)")$interpretation ``` -------------------------------- ### Adjust decimal places Source: https://context7.com/reflim/reflimr/llms.txt Determines appropriate rounding precision based on the magnitude of the input values. ```r library(reflimR) # Automatic digit determination based on value magnitude adjust_digits(45.7) # digits = 1 (values ~10-100) adjust_digits(0.85) # digits = 2 (values ~0.1-1) adjust_digits(1250) # digits = 0 (values ~1000+) adjust_digits(0.0034) # digits = 4 (very small values) # Returns both rounded value and digit count result <- adjust_digits(123.456) result$x.round # 123 result$digits # 0 ``` -------------------------------- ### iboxplot - Data Truncation and Analysis Source: https://context7.com/reflim/reflimr/llms.txt The iboxplot function truncates pathological values from data and provides estimates for reference limits, distribution type, and percentage of normal values. ```APIDOC ## iboxplot - Data Truncation and Analysis ### Description This function truncates pathological values from a dataset and provides estimates for reference limits, distribution type, and the percentage of normal values. It is useful for cleaning data before further analysis, such as Q-Q plotting or limit extrapolation. ### Method Not explicitly defined, but implies data processing and statistical estimation. ### Endpoint Not applicable (R function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r # Example using livertests dataset result <- iboxplot(livertests$PROT, perc.trunc = 5, plot.it = TRUE) result <- iboxplot(livertests$CHE, lognormal = TRUE, apply.rounding = FALSE) ``` ### Response #### Success Response (200) - **result$trunc** (vector) - Vector of truncated (non-pathological) values. - **result$truncation.points** (vector) - Rough estimate of reference limits. - **result$perc.norm** (numeric) - Estimated % of normal values. - **result$lognormal** (logical) - Indicates if a lognormal distribution was assumed. #### Response Example ```json { "trunc": [569, 1.10, 66.5, ...], "truncation.points": [24.8], "perc.norm": 84.5, "lognormal": false } ``` ``` -------------------------------- ### iboxplot - Iterative Boxplot Truncation Source: https://context7.com/reflim/reflimr/llms.txt The `iboxplot()` function iteratively removes pathological outliers using a modified boxplot algorithm. It progressively narrows truncation thresholds until convergence and returns the truncated dataset, truncation points, and the estimated percentage of normal values. ```APIDOC ## iboxplot - Iterative Boxplot Truncation ### Description Iteratively removes pathological outliers from a dataset using a modified boxplot algorithm. It progressively narrows truncation thresholds and returns the truncated dataset, truncation points, and the estimated percentage of normal values. ### Method `iboxplot(x, main, xlab)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **x** (numeric vector) - The input data. - **main** (string, optional) - Main title for plots. - **xlab** (string, optional) - Label for the x-axis. ### Request Example ```r library(reflimR) # Truncate bilirubin data to remove pathological values x <- livertests$BIL result <- iboxplot(x, main = "Bilirubin", xlab = "µmol/L") # View truncation progress print(result$progress) ``` ### Response #### Success Response (200) - **truncated.data** (numeric vector) - The dataset after removing outliers. - **trunc.points** (list) - The truncation thresholds used in each iteration. - **perc.norm** (numeric) - The estimated percentage of normal values in the original dataset. - **progress** (data.frame) - A table showing the number of data points, minimum, and maximum values at each iteration. #### Response Example ```r # Accessing truncated data and progress result <- iboxplot(livertests$BIL) truncated_data <- result$truncated.data print(truncation_progress <- result$progress) ``` ``` -------------------------------- ### Truncate Outliers with iboxplot() Source: https://context7.com/reflim/reflimr/llms.txt The iboxplot() function iteratively removes pathological outliers using a modified boxplot algorithm until convergence. It returns the cleaned dataset and metadata regarding the truncation process. ```r library(reflimR) # Truncate bilirubin data to remove pathological values x <- livertests$BIL result <- iboxplot(x, main = "Bilirubin", xlab = "µmol/L") # View truncation progress through iterations result$progress # n min max ``` -------------------------------- ### Truncate Data with iboxplot Source: https://context7.com/reflim/reflimr/llms.txt Use iboxplot to truncate data, optionally specifying a custom truncation percentage or distribution type. The function returns various results including truncated values and estimated limits. ```r result <- iboxplot(livertests$PROT, perc.trunc = 5, plot.it = TRUE) ``` ```r result <- iboxplot(livertests$CHE, lognormal = TRUE, apply.rounding = FALSE) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.