Ordination in 3D

I am working on some multivariate data; the ordination required 3 dimensions as the stress was too high. I wanted to see all three at once. In particular, I wanted to see the hull (a polygon enclosing all points) for each site. In our case we have sites with repeated measures, hence site being the grouping variable. Searched on stackoverflow etc, found code to plot more than one hull (https://stackoverflow.com/questions/41145959/picture-convex-hull-in-3d-scatter-plot).  Code for the following below.



Continue reading

NZ wetlands & the Ramsar convention (& maps)

Earlier this year I attended the National Wetland Trust’s annual wetland symposium, which brings together wetland managers (both paid and volunteer), government,  local body university and research wetland scientists along with students and interested lay people.  My involvement this year was through my work on two wetlands that are recognised as being internationally significant under the Ramsar convention.

Continue reading

visualising model predictions with 3D graphs

Parts of the interweb seem to equate 3D graphs with killing statistical kittens (*). And they’re verboten in ggplot2 for visualisation philosophy reasons. But sometimes other options (splitting one continuous variable into a factor, facetting, or using colour and or size) aren’t adequate; sometimes someone higher up the food chain than you has requested one; sometimes you have to live dangerously.

(*) interest in poor practice piqued? More bad graphs here.

Provided you know how to predict from your model (and if not, see the “model_prediction” R markdown file or pdf here) it’s not very hard. But I’ve had a couple of requests for sample code, so I reproduce it here too.

Continue reading

Running an R seminar series: lessons from the front line

Sometimes, you can combine two problems and create a solution. I’m on the student post-graduate committee for the School of Biology at the University of Canterbury, and we were aware that senior postgraduate students were seeking more teaching opportunities.  We knew students in the school had a variety of experience both in statistics and in R, which is a statistics programme commonly used in ecology.

Continue reading

RDA in ggplot2

Updated: small fix of the “mult” arrow multiplier, thanks to Laura Barrero

A friend requested an RDA version of plotting ordinations in ggplot.  I found a Q&A on the ggplot2 mailing list, but they had had some issues.  So, I post the code here that I wrote up, using the dune dataset which is in vegan.  Clearly we would not be plotting all of this in such a hot mess of a plot, but add and subtract the elements you need/want/like.

This script will print and plot a lot of the results as it goes along, so you can see what you are building.

Continue reading

Data Camp, NC: highlights

North Carolina, my first taste of America out of LAX. Warm, of course, coming from mid-winter New Zealand.  Shuttle driver, kind, talkative and living the American dream.  And the noises! The soundscape was the biggest reminder of the distance from home.  The deathbirds I’d previously only heard on Bones when they find dead bodies: everywhere. Discomfiting, a little. Frogs, especially in the evenings, although obnoxiously shy. And aircon, all the time, by necessity.

Continue reading

2013 ends: with conferences, fieldwork and tramping

I spent most of 2013 pushing to finish my masters, then a hectic period securing funding and planning for an upgrade to a PhD – all of which entailed serious desk time.   That all changed beginning with the EcoTas13 conference in Auckland.  Student Day kicked it off with a mix of student presentations and workshops on science communication, publishing and careers.  Baby students got to present on their planned research, others used it as an opportunity to polish their main conference presentations (like my newly minted Dr friend Tarryn Wyman), and I used it as a chance to try the 5-minute format on a completely different topic (“Mega-Ornaments and Succession: the futility of bird perches for restoration”) to my main talk. Continue reading