| Title: | Trimmed Mean Compatible with 'Statgraphics' Method |
| Version: | 0.1.0 |
| Description: | Computes the trimmed mean using a proportional discount method on the extremes, replicating the behavior of 'Statgraphics' software. Unlike R's built-in mean() with trim, this method applies a weighted reduction to boundary values rather than removing them entirely. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 8.0.0 |
| URL: | https://github.com/jcarlosgaviria/sgmean |
| BugReports: | https://github.com/jcarlosgaviria/sgmean/issues |
| Suggests: | knitr, rmarkdown |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-05-30 20:55:07 UTC; Personal |
| Author: | Juan Carlos Gaviria Chaverra [aut, cre] |
| Maintainer: | Juan Carlos Gaviria Chaverra <jcarlos.gaviria@udea.edu.co> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-03 14:10:02 UTC |
Trimmed Mean Compatible with Statgraphics
Description
Computes the trimmed mean using a proportional discount method on the extremes, replicating the behavior of Statgraphics software. Unlike the built-in mean() with trim, this method applies a weighted reduction to boundary values rather than removing them entirely.
Usage
sgmean(x, trim = 0.05)
Arguments
x |
A numeric vector. Does not need to be pre-sorted. |
trim |
Trim fraction between 0 and 0.5 (default 0.05 for 5%). |
Value
A single numeric value with the trimmed mean.
Examples
x <- c(2, 4, 6, 8, 100)
sgmean(x, trim = 0.05)
mean(x, trim = 0.05)