Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Switch to median instead of mean #242

Closed
sydneyg opened this Issue Jul 12, 2017 · 8 comments

Comments

Projects
None yet
4 participants

sydneyg commented Jul 12, 2017 edited

@Microbiology Hi can you please add an option to make a median of the subsampled OTU tables instead of the mean?

Contributor

gavinsimpson commented Jul 12, 2017

Which functions did you have in mind for this?

sydneyg commented Jul 12, 2017

sorry, I've never written an issue before, this is the avgdist.Rd function.

Contributor

gavinsimpson commented Jul 12, 2017

This seems trivial to add.

@Microbiology --- as you committed this function, do you have any input on whether this is a useful feature to add (& also #243)? (I'm not expecting you to implement it of course!)

Contributor

jarioksa commented Jul 13, 2017 edited

The avgdist function does not find the mean of OTU tables, but it calculates the dissimilarities for each subsampled OTU table and returns the average of these dissimilarities. In principle, it could return the median of these dissimilarities, but you were not suggesting this? (And this means having a new trick to calculate such a median).

Contributor

jarioksa commented Jul 13, 2017 edited

Replacing the line

findist <- Reduce("+", distlist)/length(distlist)

with

findist <- apply(do.call(rbind, distlist), 2, meanfun, ...)

and having new argument meanfun = mean would allow user-selected function to find mean, and having those dots (...) allows mean functions that take extra arguments (such as trim).

Contributor

Microbiology commented Jul 13, 2017

Thanks @sydneyg for the issue and the feedback (I had suggested this and the other issue be created in a previous conversation).

I will work on adding this in to the avgdist function, using the info from @jarioksa as well. :)

Contributor

Microbiology commented Jul 29, 2017 edited

I added this functionality and created a pull request to incorporate it (#244).

Also it looks like I am unable to close this issue myself. I think @sydneyg might have to be the one to close it, provided this all looks okay.

Contributor

jarioksa commented Aug 7, 2017

Closed with PR #244

@jarioksa jarioksa closed this Aug 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment