1 | tmci(x, alpha = 0.05, tp = 0.25)
|
x |
|
alpha |
|
tp |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, alpha = 0.05, tp = 0.25)
{
n <- length(x)
up <- 1 - alpha/2
tmn <- mean(x, trim = tp)
ln <- floor(n * tp)
un <- n - ln
d <- sort(x)
if (ln > 0) {
d[1:ln] <- d[(ln + 1)]
d[(un + 1):n] <- d[un]
}
den <- ((un - ln)/n)^2
swv <- var(d)/den
rdf <- un - ln - 1
rval <- qt(up, rdf) * sqrt(swv/n)
tmlo <- tmn - rval
tmhi <- tmn + rval
list(int = c(tmlo, tmhi), tp = tp)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.