Package 'sgmean'

Title: Trimmed Mean Compatible with 'Statgraphics' Method
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.
Authors: Juan Carlos Gaviria Chaverra [aut, cre]
Maintainer: Juan Carlos Gaviria Chaverra <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-03 18:43:45 UTC
Source: https://github.com/cran/sgmean

Help Index


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)