Skip to content

Instantly share code, notes, and snippets.

@mtkd
Created August 6, 2010 17:51
Show Gist options
  • Save mtkd/511686 to your computer and use it in GitHub Desktop.
Save mtkd/511686 to your computer and use it in GitHub Desktop.
truncated mean in Ruby
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