Function for phylogeny resolution

Author  Scott Chamberlain

UPDATE: Yeah, so the treeresstats function had a problem in one of the calculations. I fixed that and added some more calulcations to the function.

I couldn't find any functions to calculate number of polytomies, and related metrics.

Here's a simple function that gives four metrics on a phylo tree object:

Here's output from the gist above:

$trsize_tips
[1] 15

$trsize_nodes
[1] 13

$numpolys
[1] 1

$numpolysbytrsize_tips
[1] 0.06666667

$numpolysbytrsize_nodes
[1] 0.07692308

$proptipsdescpoly
[1] 0.2

$propnodesdich
[1] 0.9230769

And an example with many trees:

trsize_tips trsize_nodes numpolys numpolysbytrsize_tips numpolysbytrsize_nodes proptipsdescpoly propnodesdich
20 13 4 0.20 0.31 0.7 0.69
20 7 3 0.15 0.43 0.9 0.57
20 11 6 0.30 0.55 1.0 0.45
20 13 4 0.20 0.31 0.7 0.69
20 9 5 0.25 0.56 1.0 0.44

Posted in  R ape phylogenetics

Author  Scott Chamberlain

Moving from blogger and wordpress to jekyll

Author  Scott Chamberlain

Recology used to be hosted on Blogger, and my personal website was hosted on Wordpress. Neither platform was very satisfying. Blogger is very limited in their layouts, unless you use dynamic views, which suck because they don't allow javascript snippets to render GitHub gists. Wordpress is just limited all around as you can't put in hardly anythig excep text and some pictures. They both have their place, but not so much for content that requires syntax highlighting, references, etc.

Jekyll powered sites on GitHub are an awesome alternative. You do have to write the code yourself, but you can copy any number of templates on GitHub with a simple git clone onto your machine, edit the text a bit, push it up to GitHub, and that's it.

On Blogger and Wordpress you can't see the code behind why different blogs/sites look different. But on Jekyll/GitHub you can see the code behind each site (see here for a list of Jekyll/GitHub sites and their source code), which makes learning so easy.

Here is a video on YouTube that explains in some detail Jekyll/GitHub sites:

A great point in the video above is that a Jekyll site allows a workflow that is great not only for code-junkies, but for scientists. What is the most important thing about science? That it is reproducible of course. Documenting your code and sharing with everyone on GitHub or SVN, etc. is great for science in facilitating collaboration and facilitating transparency. Having your website/blog on Jekyll fits right in to this workflow (that is, pull down any changes - write/edit something - commit - push to GitHub). Although this sort of worklow isn't necessary for a blog, it is nice for scientists to use this workflow all the time.

Here's how to get started:

  1. Install git
  2. Get a free GitHub account and configure GitHub. If you are afraid of the command line, there is a great GitHub app here.
  3. git clone a jekyll template to your machine. There are hundreds of these now. Look here for your favorite, and git clone it. ***
  4. Edit the template you have cloned, and commit and push to GitHub. That's it. It will take just a bit to render.

There is more to it than that, but that is how you can get started. If you want to add comments, Disqus is a great option. Once you fork someones jekyll site, make sure to change all the personal/site specific information to your information, including the RSS feed.

*** Note: You can name your repo for your site/blog as yourgithubname.github.com if you want your URL for the site to be http://yourgithubname.github.com. Or you can name your repo whatever you want, e.g., disrepo, then the URL will be http://yourgithubname.github.com/disrepo.

Posted in  thoughts blogger wordpress jekyll

Author  Scott Chamberlain

Presenting results of logistic regression

Author  Scott Chamberlain

So my advisor pointed out this 'new' (well, 2004), way of plotting results of logistic regression results. The idea was presented in a 2004 Bulletin of the Ecological Society of America issue (here). I tried to come up with a solution using, what else, ggplot2. I don't have it quite all the way down - I am missing the second y-axis values for the histograms, but someone smarter than me can figure that part out (note that Hadley doesn't want to support second y-axes in ggplot2, but they can probably be hacked on).

Here's the code:

Here's a few examples using datasets provided with the ggplot2 package:

loghistplot(mtcars[,c("mpg","vs")])

mtcars plot

loghistplot(movies[,c("rating","Action")])

movies plot

And two examples of the logpointplot function:

logpointplot(mtcars[,c("mpg","vs")])

mtcars point plot

logpointplot(movies[,c("rating","Action")])

movies point plot

Posted in  ggplot2 gridExtra R

Author  Scott Chamberlain

Testing twitterfeed

Author  Scott Chamberlain

Does this work on twitterfeed?

Posted in 

Author  Scott Chamberlain

Testing new website

Author  Scott Chamberlain

Test post on new Jekyll hosted website...

Posted in 

Author  Scott Chamberlain

Fork me on GitHub