The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Nov 8,2025The Ssarkartrim package provides a robust trimmed-k mean
estimator for numeric data. It is designed to reduce the influence of
outliers by removing the k smallest and k
largest values before computing the mean. This vignette walks through
installation, usage, and interpretation of the function.
To install the package from source:
```r
install.packages(“Ssarkartrim_1.0.0.tar.gz”, repos = NULL, type = “source”)
library(Ssarkartrim)
kTrimMean()kTrimMean(dat, k)
dat : A numeric vector.
k : Number of smallest and largest values to trim.
Returns the trimmed-k mean of the data. If 2k >= length(dat), the function returns NA with a warning
set.seed(5400)
dat <- rexp(20, rate = 0.5)
kTrimMean(dat, k = 2)
[1] 1.592987
This trims the 2 smallest and 2 largest values from dat
and computes the mean of the
remaining 16 values.
mean(dat)
median(dat)
kTrimMean(dat, k = 2)
This shows how kTrimMean() provides a middle ground:
mean() is sensitive to outliers.
median() is robust but may ignore distribution
shape.
kTrimMean() trims extremes while preserving central
tendency.
small_dat <- c(1, 2, 3, 100, 200)
kTrimMean(small_dat, k = 1)
This trims the the lowest and largest values
short_dat <- c(5, 10)
kTrimMean(short_dat, k = 1)
[1] NA
Warning message:
Not enough data to trim k smallest and largest values.
This shows the function’s built-in safeguard when trimming exceeds available data.
Robust estimation in small samples
Outlier-resistant summary statistics
Teaching robust statistics in coursework
Comparing estimators in simulation studies
This package was built using:
devtools::create()
Roxygen2 for documentation
document() to generate .Rd files
R CMD build and R CMD check –as-cran for validation
Rd2pdf to generate the manual
usethis::use_vignette() to create this vignette
The Ssarkartrim package offers a simple, reproducible, and pedagogically useful implementation of the trimmed-k mean.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.