Wednesday, October 7, 2015

Unexpected Benefits of the Random Sample


When putting together a condition assessment, there are two basic approaches: 1) take a random sample of your system of interest within a relevant geographic area, or 2) start with the best and worst wetlands during one year and fill in the gap during subsequent sampling years.  I opted for the first approach because that’s the way the agency that funds my research rolls and I wanted as many years of data as possible on all sites.  Plus, who’s got the time to organize a group of other people to decide where the best and worst places are (hint: not graduate students).  I randomly selected 50 emergent wetlands located below the high meander line of the Great Salt Lake and stratified my sample by impoundment status and region in order to capture the widest range of conditions around the Lake. 
My 50 emergent wetland sites.  Fifty is a crazy number I chose out of the guidelines from my funders.  Only one or two people actually told me that number might be a bit ambitious.  
The sampling strategy has hopefully provided a lot of high quality data (and adequate degrees of freedom), but there were some other, more practical implications of my random sample. 
  •   Randomly selected sites might be right next to a road or two miles away.  I’ve developed really strong hip flexors slogging over 290 miles of walking to and from my wetlands over the last four summers (a conservative estimate that doesn’t count in-site travel or time spent lost). 
  • Random samples have no sense of land ownership, so I also got to go on many, many miles of awesome boat rides!
Out on my favorite marsh.  It's a beautiful wetland and I get to take a boat there.  And the hunting guide that helps me is great. 
  • Some randomly selected sites had to be dropped due to safety and accessibility concerns.  Sometimes sites were dropped because a manager could email me something like, “I can tell you right now that you aren’t accessing the new site by vehicle or airboat.  It is some really nasty tall and thick Phrag out there.”  Or they might say “We can’t let you access a site between the east- and west-bound lanes of I-80 because you’d have to park on the freeway.”  
  •  Or they might say, “Do whatever you’d like,” and I’d find myself panicking underneath a canopy of 20-foot tall Phragmites.  The Phrag is really scary, perhaps the place I've felt the most un-safe in my whole life.
  •  Including un-impounded wetlands in my sample meant that I got to hike out to places the wetland managers had never been because there’s not much management to be done in places with no water control. This is exciting.
Wandering out into the unknown has been the most logistically challenging part of my work, but also the most rewarding.  It’s been really fun to share what I’ve found with the people that manage my wetlands (and validating when they say, “Oh my gosh, you walked all the way out there?”  Yes, yes I did.  It was hard.).  Out in these unknown places I’ve found the coolest plant species and the strangest hydrology. 

Sesuvium verucosum - one of my absolute favorites.  Seasonal water levels in a bunch of un-impounded wetlands - so cool!
But really, the best part has been gathering my collection of flotsam decoys.  Long ago, these decoys broke loose of their anchors and floated into the emergent vegetation, where they remained hidden until a random sample required this crazy grad student to wander out there.  


It’s just like discovering buried treasure, because they were once worth money and they’re usually buried in the vegetation to some degree.  The decoys have been in the marsh long enough to become waterlogged and most have lost their eyes and a lot of their paint.  


Those decoys that found their way into the Phragmites fared the best, as they were well protected from the elements.  I discovered almost all of my decoys in places where hunting is not allowed, so there’s an illicit feel to the whole thing. 


 I’m done with field work now, so I think my collection is complete.  I’ve placed them all - the mallards, teal, and blue-bill - on a shelf where they can cheer me on as I write.  Random sampling is awesome!

Thursday, September 3, 2015

Trust Me, Coding in R is Just Like Rock Climbing

My goal for this post is to defend a statement that on the surface seems bonkers, but upon deeper inspection is 100% true:

Creating R code is just like rock climbing.

Rock climbing, according to www.dictionary.com, is “…the sport of climbing sheer rocky surfaces on the sides of mountains, often with the aid of special equipment.”  An activity that allows you to summit and safely descend the most beautiful places in the world!  Climbing gear and techniques are constantly evolving to create access to cliffs and peaks thought un-climbable a decade ago.  With know-how and practice, your rock climbing options are endless. 

R, according to www.r-project.org, “…is a free software environment for statistical computing and graphics.”  It’s a single place for analyzing and plotting data!  R experts are constantly coming up with new packages to allow for cutting edge, sophisticated analyses and beautiful figures.  The options for analyses in R are endless. 

The elation of meeting a new challenge.  The dejection of running up against an insurmountable obstacle.  The problem solving component.  It’s all there in both coding and climbing. And I love both of them.  Nothing beats the satisfaction of successfully executing a beautiful, concise piece of code with no errors, except perhaps summiting a challenging climb whose difficulty matches my current skill.  Few things are worse than being stuck hanging in your harness on a challenging route and facing retreat, except the frustration of receiving the same inscrutable R code error 50 times. 

I just can't even....
R is amazing, rock climbing is amazing.  With a properly arranged dataset and seven lines of code I can create 150 separate graphs plotting water level over time in under two seconds.  Just like that.  Ctrl + Enter.  Boo yah.  Learning how to create a loop changed my life.  With the right climbing partner and a full rack of gear I’ve also stood on top of the Gossips formation in Arches, a tower that I’ve been intrigued with since I was 10 years old.  Seriously, I was on top of it. 

And the angel's started singing....
Rock climbing and R were both revelations to me.  Prior to rock climbing I spent hours walking to the top of mountains, frequently turning back from awesome adventures because I didn’t have the gear or knowledge to get to the summit; it was often tedious and disappointing.  Then some friends taught me how to climb stuff and now I can get directly to the top of desert towers with minimal wasted energy and maximum safety!  Before courses required me to use R for data analysis I spent months of my life entering, sorting and graphing data in Excel.  The analyses I could do were severely limited, usually requiring the creation of new datasheets for each analysis, and my efforts were constantly hampered by missing and misplaced data.  Now that I know how to use my rock climbing gear and R I have all the free time I could ever want!

You shall not pass!
Both climbing and coding require extensive experimentation and tinkering.  Even when the path forward seems obvious, like I’ve used that R package before or the line to the top of a climb is a single, clear crack in the rock, progress forward requires a lot of tinkering.  Most of the climbing tinkering is with regard to hand and foot placement, body position, and gear placement, while R tinkering is remembering variable names, a lot of spelling mistakes, and proper use of symbols.  In both cases it goes like this: nope, Nope, NOPE, YEAHHHH!  

Protecting 5 feet of a 100 foot climb

Adding a title to a graph
In between breakthroughs you may feel utterly useless, like a turd.  The best course of action, when the code just won’t work and you’ve reached a climbing plateau is to step away before you throw something.  It’s OK to go cry, just don’t break your computer or sell all your climbing gear because this pursuit is stupid.  That time away is critical to seeing the larger picture that tunnel vision blocks. Come back to the challenge with clear eyes and an open.  And maybe coffee. 

I don't even know where to go from here....
Powerful forearms are a must.  In climbing your forearm muscles control your grip strength, the power that keeps you hanging on the rock.  Creating and executing code requires finger dexterity, muscle endurance, and for me, the strength to highlight code with my right hand and type “Ctrl + Enter” with my left hand repeatedly.  It’s a work out. 

Progress in either pursuit can only be achieved by understanding the tools at your disposal, misusing those tools is dangerous.  The best and newest climbing gear in the world can’t replace know-how or protect crumbling, incompetent rock.  Similarly, using the latest and greatest R packages to generate figures won’t fix flaws in bad data or misunderstanding of statistical assumptions (this is an area I’m still working through myself). 

The best tools are often the simplest...
Finally, both hobbies have their own language that makes communication between practitioners easier.  Rock climbing lingo is a bit more bro-ish than R language, but delve too deeply into either and most people won’t know what you’re talking about.  A good rule for both climbing and coding is to utilize online forums (www.mountainproject.org, www.stackoverflow.com) without delving too much into the comments section; get the information you need to successfully execute your plan, leave helpful feedback, don’t call the other dirt bags names. 

Really the only differences I can see between climbing and coding are the importance of footwork and ropes in rock climbing.  What you do with your feet isn't all the critical when coding.

Monday, May 18, 2015

Getting Lucky


Most people, myself included, will tell you science is successful due to lots and lots of hard work.  For any given question I start by learning everything possible about the subject (two days of reading the top results from a Google Scholar search should be good), then I apply that knowledge in field observations or an experiment, gather data thoroughly and objectively, and finally arrive at answer.  What you don’t hear often enough is the role of luck in getting science done.  All the hard work and preparation in the world still won’t prevent unexpected issues from coming up.  In fact, often graduate school feels like a succession of unexpected obstacles foiling my best laid plans.  But being in graduate school has also made me lucky enough to be in contact with people who have better, fresher perspectives on things I’m struggling with.  It’s really the only way I ever complete anything. 

Bad luck, Becka.  Monitoring well melted by a controlled burn.
After an unlucky week of field work I’m particularly aware of how far good luck goes in getting a project successfully completed.  In the last few days rain has prevented me from flying the drone I really needed to get in the air, a fox flushed the birds I was trying to record with the drone one of the few times I could fly, and someone burnt down one of my monitoring wells.  Plus I lost my favorite ruler running away from lightning.  But I’ve had some good luck too, and that’s what I’d like to talk about here.  My winding journey in life and work has been a series of fortunate encounters and experiences.  There has certainly been an inordinate amount of tears shed, blood drawn, and stuff lost, but more importantly, I’ve gotten to meet interesting and inspiring people who have facilitated my work doing basically whatever I want.  Any breakthrough I’ve had has been 70% toil and 30% luck in talking to the right person at the right time.  As idealistic and optimistic as all of this sounds, ultimately having to rely on luck is frustrating because I have no control over it.  However, if graduate school has taught me anything, it’s to celebrate the lucky moments.  Below is an example of struggle and luck that played out this last semester
The goal of my PhD research project is to understand the impact of water management on wetland health and one of the best ways to measure health is by looking at what plants are present in each wetland.  Every summer from July 15 to August 15 you can find me hunched over looking at plants all over the eastern shore of the Great Salt Lake.  When I find a plant I’m not sure the identity of, I pull a sample, press it, and identify it later in my office.  Plant identification seems straightforward on the surface, it involves following dichotomous keys (a series of choices between two options) that will lead you to the correct plant.  However, following a series of decisions is only doable if important identification features (like flowers or seeds) are present on the specimen you gather and if you have the appropriate plant guide.  Anyone who tells you plant ID is easy is lying.  Sure, the rules for plant identification are clear, but that does not mean they're easy to follow.  And they change all the time.  

Botanizing isn't easy, it requires a special plant identification dictionary almost all the time, two or more floras, and a microscope.  Not pictured: Google Images, USDA Plants
Over the course of my work I’ve gathered more than 300 plant samples identified to 109 species, but one species in particular, found in one of my 50 sites, has caused me more grief than all the rest.  It’s difficult to tally the amount of time I’ve wasted just reading through the descriptions of each plant family this species might belong to, but with no luck. 

Mystery mudflat plant, 2012.
Here is what I know about the plant:
  •          small flowers are white to pink with five petals fused at the base
  •           leaves are oppositely arranged with small glands or salt crystals
  •           woody at the base of the stem, annual
  •           found on seasonally exposed mudflats near the airport
With all of that information I should have been able to identify this plant, but none of the descriptions I read matched.  Lucky for me, I complain about plant identification a lot to anyone who will listen.  One day last year I was talking with Christine, another graduate student in my lab, about the afternoon I had spent identifying plants and she was telling me about her afternoon spent tending a seedbank study.  We quickly figured out that we might both be stumped about the same plant, even though neither of us had a good picture of said plant.  We discussed it later while actually looking at the sample I had pulled from the field and still couldn’t figure out what it was, but I felt better knowing someone else, someone who is really bright, was also stumped by that silly plant.  The subject came up again in January of this year and Christine had the idea to read through a new plant ID guide she had.  A couple of hours later this email came through and no other email I received this semester has made me anywhere near as happy. 


How amazing and lucky is that?  We both had the same unknown plant, we talked to each other about it, and then she found it AND let me know about it!  After all the times I’ve read through the plant books I had, I’d still never have identified that plant because Frankenia pulverulenta wasn’t listed in the book I used most (unlucky for me, it’s listed in an old Utah Flora that I don’t look at closely).  For all of the hard work on my part, credit for the breakthrough goes to Christine and I just count myself really lucky to work with her.  It would be easy to blow this off as just a fluke, but moments like that happen regularly enough that I feel confident in my statement that science is 30% luck.   For example, hiring the most wonderful technician ever happened because my advisor knew someone who knew David and he applied for the job.  Marsh llama has been the saving grace of my entire project, and I only saw it because I was lost.  Upwards of 40% of my success in R has been due to lucky Google searches and someone else having the same problem. 

The flip side of all of this, of course, is that bad luck is also a major component of science.  But since luck isn’t something you can build into an experiment, I think the lesson is to avoid fretting as much as possible (because I just can’t control the weather), work hard, and make sure to say thank you to the people you’re lucky enough to know.  Oh! And ask lots of questions, other people are nice and know so many things I don’t. 

The ever-lucky Marsh Llama
For a long example of some bad luck, see this story.

Friday, January 9, 2015

Keeping Wetlands Wet

I've got to start my first publication post with a confession: I am not good at thinking of titles.  I didn't think of the title for the first chapter of my master's thesis (or the thesis itself), my master's advisor, Joanna, did because she's great at titles.  The paper "Keeping wetlands wet in the western United States: adaptations to drought in agriculture-dominated human-natural systems" is a comparative case study of the paper water and wet water acquired by three federal wildlife refuges in the Bear River watershed.  In the western U.S., the right to use water is allocated under the rules of prior appropriation.  Every water user must apply for the right to use water and that right comes with restrictions on what water can be used for, how much can be used, and when it can be used.  During periods of drought, a relatively common even in the arid and semi-arid West, senior water right holders (those who applied for their rights first) get their whole water allocation while junior water right holders (those who applied for their rights most recently) will have their allocation cut off.  There are lots and lots of intricacies of within the law, based on 150 years of court cases, many state constitutions, and inter-state water compacts, but the statement "first in right, first in time" is still the clearest way to summarize the law.
Bear Lake National Wildlife Refuge
Water law goes way back to the California gold rush, but appreciation for wetlands is a relatively recent development (coming in the 1970s).  How have wetlands, a thirsty ecosystem defined by the presence of water, persisted in watersheds like the Bear River, where agricultural users have acquired almost all the available water?  It depends (every ecologist's favorite answer).  Every water user must apply for the right to use water, but the strategy for acquiring those rights varies  based on where the wetland is located within the watershed (near the top or the bottom) and relative to senior water rights holders (upstream, downstream, or near a storage reservoir).  The federal wildlife refuges in the Bear River Basin, Bear River, Bear Lake, and Cokeville Meadows, have each pursued their own strategy, detailed in the paper linked here.
Once a refuge has acquired access to water through applications, diligence claims, shares in canal companies, or purchases of rights with land, the water must be managed to buffer wetlands against fluctuations in water supply.  Such management takes a context-specific approach that recognizes the opportunities unique to each refuge.
Bear River discharge above three wildlife refuges.