Proportional Trimmed Mean

Computes a proportional trimmed mean that resolves the integer truncation problem of base R's mean(..., trim). When k = trim * n is non-integer, a fractional discount (1 - delta) is applied to boundary observations, where delta = k - floor(k). The resulting estimator is continuous in alpha for any fixed n, syntactically identical to mean(..., trim), and compatible with the 'Statgraphics' implementation. See Gaviria Chaverra (2026) .


sgmean

sgmean computes the trimmed mean using a proportional discount method on the extremes, replicating the behavior of Statgraphics software.

Unlike R’s built-in mean(..., trim), which removes boundary values entirely, sgmean applies a weighted reduction — producing results consistent with Statgraphics.

Installation

You can install sgmean from GitHub with:

# install.packages("devtools")
devtools::install_github("jcarlosgaviria/sgmean")

Usage

library(sgmean)

x <- c(2, 4, 6, 8, 100)

# sgmean method (Statgraphics compatible)
sgmean(x, trim = 0.05)

# Base R method (different result)
mean(x, trim = 0.05)

Author

Juan Carlos Gaviria Chaverra

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("sgmean")

0.1.1 by Juan C. Gaviria-Chaverra, 2 months ago


https://github.com/jcarlosgaviria/sgmean


Report a bug at https://github.com/jcarlosgaviria/sgmean/issues


Browse source code at https://github.com/cran/sgmean


Authors: Juan C. Gaviria-Chaverra [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests knitr, rmarkdown, testthat


See at CRAN