1 | gk.sigmamu(x, c1 = 4.5, c2 = 3, mu.too = FALSE, ...)
|
x |
|
c1 |
|
c2 |
|
mu.too |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- 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, c1 = 4.5, c2 = 3, mu.too = FALSE, ...)
{
n <- length(x)
medx <- median(x)
sigma0 <- median(abs(x - medx))
w <- abs(x - medx)/sigma0
w <- ifelse(w <= c1, (1 - (w/c1)^2)^2, 0)
mu <- sum(x * w)/sum(w)
x <- (x - mu)/sigma0
rho <- x^2
rho[rho > c2^2] <- c2^2
sigma2 <- sigma0^2/n * sum(rho)
if (mu.too)
c(mu, sqrt(sigma2))
else sqrt(sigma2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.