Created
August 6, 2010 17:51
-
-
Save mtkd/511686 to your computer and use it in GitHub Desktop.
truncated mean in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ndrop = v.length/10 | |
nkeep = v.length - 2*ndrop | |
trunc_mean = v.sort[ndrop,nkeep].sum/(1.0*nkeep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment