wilcox.test()
DescTools
, modeest
, robustbase
c("DescTools", "modeest", "robustbase")
wants <- wants %in% rownames(installed.packages())
has <-if(any(!has)) install.packages(wants[!has])
c(17, 30, 30, 25, 23, 21)
age <-mean(age)
[1] 24.33333
c(0.6, 0.6, 0.3, 0.2, 0.4, 0.6)
weights <-weighted.mean(age, weights)
[1] 23.7037
library(DescTools)
Gmean(age)
[1] 23.86509
library(DescTools)
Hmean(age)
[1] 23.38384
c(11, 22, 22, 33, 33, 33, 33)
vec <-library(modeest)
mfv(vec)
[1] 33
mlv(vec, method="mfv")
Mode (most likely value): 33
Bickel's modal skewness: -0.4285714
Call: mlv.default(x = vec, method = "mfv")
median(age)
[1] 24
mean(age, trim=0.2)
[1] 24.75
library(DescTools)
Winsorize(age, probs=c(0.2, 0.8))) (ageWins <-
[1] 21 30 30 25 23 21
mean(ageWins)
[1] 25
library(robustbase)
huberM(age)
hM <-$mu hM
[1] 24.33333
library(DescTools)
HodgesLehmann(age, conf.level=0.95)
est lwr.ci upr.ci
23.99998 20.99997 27.50005
8
N <- rnorm(N, 100, 15)
X <- rnorm(N, 110, 15)
Y <-wilcox.test(X, Y, conf.int=TRUE)$estimate
difference in location
-13.78561
try(detach(package:modeest))
try(detach(package:DescTools))
try(detach(package:robustbase))
R markdown - markdown - R code - all posts