简体   繁体   中英

Could anyone explain What is trim argument in mean

x <- c(0:2, 50)
mean(x,0.9)
#[1] 1.5
mean(x)
#[1] 13.25
mean(x,0.10)
#[1] 13.25
mean(x,0.50)
#[1] 1.5
mean(x,0.4)
#[1] 1.5
mean(x,0.3)
#[1] 1.5
mean(x,0.2)
#[1] 13.25

Could anyone explain in detail how trim argument work in R functions

'trim'指定从数据的两侧删除的元素的分数...删除这些元素后,计算平均值...此处元素的数量为4,如果我们删除0.1的4的分数,则意味着我们要删除0.1 * 4的数组....此数字小于1,因此我们不会删除任何项目...当我们将'trim'分配给0.5时,这意味着我们将删除0.5 * 4的数据,此函数将计算出剩余元素的平均值

"Values of trim outside that range are taken as the nearest endpoint."

I think it might be performing winsorization to the values which fall outside the trim boundary. Then using those winsored values plus the regular values which were inside the trim boundry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM