29.11.13

Model fail.. reasons unknown

Todays post is mainly just a summing up of model results following some recent analysis that has shook the foundations of my trust in my model.

As it turns out, when you have a complex model, analysing results can be complex and assigning blame to any particular parameter/process can be even more challenging.

I've been happily plodding along in the knowledge that I finally have my model churning out some decent results, with the right things happening at the right time in the right places. One final analysis has turned this on its head with the finding that territory sizes are not properly linked to food resources. I have suspected this has been the case for some time, but following the reduction of food resources outside of the protected area I find that male territories in the matrix are about 3/4 the size of territories inside the CBWS forest. Females surprisingly are the reverse, but I think this is mainly due to most females being driven out of CBWS due to avoidance of males. In the matrix it seems they are able to expand their territories and are not so constrained due to the presence of fewer males. The average size of their territories is also unfeasibly small inside CBWS and nowhere near the size that would be needed in the real world to maintain a single individual....

crap.

So it seems a pretty fundamental feature of my model is not working as it should and I am at a pretty big loss as to why this might be the case.

Looking at males, they are attracted to trails, and attracted to male pheromones on trails. This causes larger territory sizes as they move along trails, pop out further into the forest and create new areas to call their own. Individuals are seemingly not linked to any particular area and territories are completely transitory. I wonder whether this is the problem? Males, due to this feature, also exhibit larger territory sizes when there are more males around, presumably because they get drawn onto trails. However, having a process that allows males to move further along trails causes a population crash in pretty short time (i.e. around year 20 of the simulation). I'm not quite sure why, but I'm doing some tests to figure out if the number of moves makes any difference to the fate of the population.

Looks like I might have to go back to the drawing board.

This is not the news I wanted with 6 months left on my PhD!

What do I want:
Males move along trails where possible
Males follow other males along trails, for some suitable distance.
All individuals have larger territories outside of the protected area as they need to move more to consume sufficient food resources
Females avoid males but generally their territories are overlapped to a large extend by males
Males move much faster along trails
Males move much faster when following a female to mate
All individuals would prefer to be inside the protected area


21.10.13

Jaguar population model parameters

So I haven't updated this for a while... I've been busy re-doing most of what I've spent all of this year doing. VERY frustrating!

Basically, after finishing my PhD transfer report I showed my work (all the output from my jaguar population model) to my collaborators in Belize - researchers who have been working with jaguars for years, I found that some of the key outputs from the model were not close enough to realistic values for jaguar populations in the wild. Namely, territory sizes and the distances that individuals moved over time. Those things that seemed pretty critical to the emergence of a stable population size. In fact, upon initial attempts to increase territory sizes, my stable population became stable no longer. Hence, I've spent the last 3 months re-doing all the tedious trial and error work I did during the previous 3 months in trying to get a stable population size over time that exhibited more realistic individual behavioural characteristics.

I've just about finished doing all the work and getting all the output. Ive harnessed the power of 2 computers at the university to do the bulk of the simulation work which I have managed to get remote access to. This has made the whole thing a lot easier as I don't have daily access to the computers in person. This has also freed up my own computer to do some other work - the work I should have been doing over the past 3 months instead of re-doing the population model.

So, perhaps I am jumping the gun a bit here as I have yet to fully analyse the output or run it past my field collaborators, but these are the current model parameter settings. First is the least-cost model, and food availability:



 Next comes the agent parameters, dictating the agent behaviours and life history traits:


Then comes the interaction parameters:


In short, parameters I've changed are:
  • the *number of time steps per day* - from 4 to 10; 
  • the *number of cells males can move when trying to find a female to mate with* - from a maximum of 10 to a max of 25;
  • the *pheromone degrade rate* -  to 0.08;
  • the *cost of male pheromone to a female* - from p to 0.3*p;
  • the *cost of a male pheromone to another male, if the males are on a trail* - from p to -0.001*p;
  • *food availability* outside of Cockscomb protected reserve - reduced to 85% of the availability inside CBWS;
  • addition of a *post-model setup* period - the initial 10 years (including the 3-year startup period) describe a reduced mortality for all adults, allowing greater time for the population to find suitable territories.
Initial analyses give male territories from around 40 to 70km2 and females around 10-20km2. These seem much closer to realistic sizes. Population sizes also seem to settle around 70-120 in number which also seem pretty good for the location.

These settings also seem to generate larger numbers of individuals being captured by the static model camera traps. Original stats gave an average of around 5 per sampling period versus the 191 collected in the field which is pretty bad. The new settings don't give anything near 191 either, but closer to an average of around 20ish.

Some other points:
  • Females undergo typical reproductive rates, being available to mate only for the central third of their oestrus cycle;
  • sub-adults leave the mother aged 2 and undergo a single year of 'dispersal' during which time they can move freely within their mothers range, are reproductively inactive and experience a higher mortality rate;
  • dispersal is therefore an emergent feature of the model and not hard-coded.
We'll see what the final analysis looks like soon and take it from there.

3.7.13

Wife, mother and PhD student - the balance is possible

Up until now, I have remained quiet with news of my personal life having set up this blog to track and store useful information regarding the research subject of my PhD at the University of Southampton. However, there has been much debate on twitter (find me @ecologyWatkins) and in the news on the state of the integration of women in the top level of academic and science careers, and as I near the end of my PhD life, balancing a career with a family has never been more in the forefront of my mind.

I recently tweeted "Why postdoc life with young family is not an easy option MT:: in 6 years I have worked from 10 desks & moved internationally 4 times". 

I think this encapsulates the issues with pursuing an academic career if you already have settled, have a family and have ties to any particular location. Without the freedom to pursue national and international positions, finding funding and career opportunity as an early career academic seems flawed and particularly challenging. So how do you juggle, as a woman, a family life and a career? 

Unfortunately I do not yet have the answer, but no matter how relaxed I become of the situation and think that sexist traits can surely no longer exist in 2013 I get a nasty reminder. One academic, who shall remain nameless, recently admitted that he would not have appointed a female PhD student if he had known before hand that she had a young family, but would not have thought twice about appointing a male in the same position. How can this possibly be the case?

So today, I describe how life has changed for me since giving birth to my daughter almost one year ago and how it is possible to juggle a successful PhD with raising a family. 

Having been married for 3 years, my husband and I decided we wanted to start a family. My daughter arrived during my second year of PhD after I had already taken a 3-month suspension to pursue a policy placement secondment at the National Assembly of Wales. I took 5 months maternity leave (generously funded at full stipend rate by the University) and resumed my studies at the beginning of January of this year, 2013. Currently myself and my husband undertake full childcare duties between us whilst both undertaking full-time employment. Luckily my husband does shift work and has managed to squash his full-time hours into around 3 days a week and alternate weekends. I work from home mainly and manage to go into Southampton (which is a hour and a half trip each way from home) one day a week. I fit the rest f my work around my daughters naps and in the evening/weekend.

In real terms, with the knowledge that I don't have the liberty of time to waste I have found that I have never been more productive! My life is busy and full and I have forgotten what it is to be bored(!) but otherwise I have found the balance of childcare and work quite feasible. My daughter is now almost 1 year old and it is only now that we are considering some alternative childcare arrangements to allow me some extra time to make the final push in my last year and get my PhD done. In fact I am on track to hand-in my thesis early and have my viva and corrections submitted by the time my funding runs out at the end of May 2014.

I know of two other female students who have successfully managed to juggle motherhood and PhD life and in my experience, we tend to be the most organised, productive and committed students (although I know I can't say that definitively for all PhD students who are mothers). We no longer fall into the trap of being too absorbed by student life and social activities and in fact all three of us are probably in the top tier in terms of getting the thesis handed-in either in or before the deadline. In fact, of the 20 students in my PhD cohort (we are started a 4-year integrated PhD in the Doctoral Training Centre within the Institute for Complex Systems Simulation at Southampton in 2009), myself and the other 'mother' in the group also still manage to attend more group events and compulsory workshop sessions than many others who do not have such family and time commitments.

In short, I am as committed to my PhD as I was before I became a mother. I am still on track to submit my thesis early. I continue to attend conferences and have recently won runner-up oral presentation prize in a postgraduate conference and have had a recent paper acknowledged as a good example paper.

My answer therefore to those who baulk at the idea of employing a young mother in an academic career: judge us on our outputs, not on our inputs. Judge us on how we perform academically, judge us on our competence in our chosen field and judge us on our ability to conduct effective, robust and novel research. To judge us on anything else is to fail the women in our society. To judge us on anything else is just plain wrong.




20.6.13

Runner-up prize at University of Southampton Biology PostGrad Symposium 2013

Yesterday I presented my current work as part of the 2013 University of Southampton Biology Post-Grad Symposium. This event involved all third year PhD students presenting their work to other biology postgrad students and 2nd years presenting their work as posters. Participation was around 100 people.

Entitled "A spatially-explicit agent-based model of jaguar population dynamics", my presentation focused on the model I have just finished working on and submitted to the university as the latest chapter in the transfer report.

Aside form some technical problems which meant that I couldn't include a movie clip of my simulation in action, or some footage from a camera-trap of a jaguar at a kill, I think my talk went down quite well. Some examples slides can be seen below and the whole talk is on figshare:





As part of a small group of conservationists/ecologists within Southamptons Biology department, mine was the only talk that focused on a whole organism/ landscape-scale events. As such, I really struggled to keep up with most of the presentations and this was not made easier by the quality of talks. Most lost me with information that was too detailed and assumed too much background knowledge. Others, to be a bit harsh, had lazy structuring and I struggled to follow the progression of the talk.

Having said that, I was quite impressed by the level of work being done by PhDs at Southampton and some of the work had real potential application for disease control and treatment.

To cap it all off, I won runner-up for oral presentation!

Not bad considering I am really out of the biology 'loop'. Being based partly in Biology and partly in computer science I have never really felt at home in the mainstream biology department, but I really felt like the audience were receptive to my work and open to the idea of modelling as a useful tool for exploring population persistence issues.

All in all, I'm glad I took part and put a bit of effort into the talk and it gives me hope that my future similar talks at INTECOL2013 and ISEM2013 (hopefully) may be also well received. Talking to a room full of people has never been my strength and in the past I have really struggled with nerves so I am promoting the old adage of 'the more you practice, the better it gets'!





5.6.13

Conference season

Conference season is upon us again and I have 3/4 lined up already.


I'll be presenting the model as the southampton uni biology postgrad conference in 2 weeks, and the student conference on complexity science in august, as well as INTECOL2013 (where i originally proposed a poster and I got requested to present a talk instead!). I'm volunteering at this conference as well (which means free registration) so it should be an awesome event and hopefully a good networking opportunity. With only 11 months left on my PhD I have my eyes open and looking for jobs!



I've also submitted an abstract to ISEM2013 the Ecological Modelling conference being held in October in Toulouse and I should here back from them this month. I've opted to submit the paper for a special edition print of that journal so I'll also see if thats been selected. Fingers crossed!

The first spatially-explicit agent based model of jaguar population dynamics

The chapter is done! After over a year working on building and developing an agent-based model of jaguar population dynamics I have finally finished tinkering, got my results, analysed and interpreted and written up the chapter for my thesis. I officially handed it in over southampton uni's electronic tracker system yesterday and my relief was palpable!

The unofficial deadline I proposed to my supervisors back in January was 15th March(!). But of course delays and problems along the way have caused this deadline to overrun by a mere 3 months. This of course puts the rest of my thesis in a bit more jeaopardy but I feel like the last few months have been a massive learning curve and have been well worth the endless hair-pulling and 'throwing my computer out of the window' in frustration events. Sort of...

I now feel like I have a decent-ish model of the large scale population dynamics of jaguars. Territories are strongly correlated with population size which is a nice validation that things are working as expected. Territories are also pretty much the size that would be expected, although a little on the small side if truth be told. I have found it incredibly difficult to obtain a true territory-resource relationship so that territory sizes are not imbedded in the code of the model, but rather an emergent feature. I still think more work could be done here and I will continue to develop this further as time goes on and I get some more feedback from a larger variety of people.

Some results from my model are shown below. Population size is reduced within the first 10 years and then stabilises. 

Territory sizes of males (blue) and females (red) increases with smaller population sizes.

Territory sizes increase over the first 10-20 years and then stabilise. The decreasing trend correlates with the increasing trend in population size.

A snapshot of the simulation after the first 3 years showing clear territories of individuals (coloured areas - different colours equate to different individuals) - all shown on a habitat map of the area.


A full map of the landscape used can be seen below showing a range of different habitats, the outline of the protected area and the camera traps.



Validation of the model with field data was a bit iffy at first glance. Field data captured 191 jaguar sightings, the model captured an average of 5 per data collected period. But discrepancies are mainly due to the models inability to capture the fine-scale social-oriented movement of individuals. In the real world males are known for making 'information-gathering' expeditions along trails to find out who has been around and when, with sub-adult males known to follow older male for short periods. This has not been included in the model, but its generally thought to be a non-fitness function and not thought to affect territory dynamics or the contact/interactions between individuals.

I can't of course display all the results and discussion from the model outputs just yet as I'm currently trying to update the chapter for submission to a publication. Once its been submitted and reviewed I will then make it openly available! 

Open-source information for all.

27.2.13

The frustrating attempt at obtaining a stable population size

Todays post is summed up nicely by its title. Two weeks after 'finishing' model construction, I am still finding bugs in the code and still tearing my hair out at trying to get my simulation to generate a stable population size.

With my 'glass is half full' head on, I say to myself that this time has been good and constructive and I'm glad I've found these niggly gremlins now rather than in a month when I've done my analysis and handed in my transfer report. And yes, this is true, but my 'life sucks' head says, why have I been so stupid as to code in these bugs in the first place? Have I not had years of coding experience by now? Am I not a reasonable programmer? Perhaps not? So yes, these bugs are MY fault. I am THAT stupid and model verification is the bane of my existence!



Coding has to be the worlds best way to make you doubt your own abilities and really look hard at yourself. Inevitably I find that a few hours of brilliant genius coding effort leads to some very strong hair-pulling out tactics a few weeks later when the 'simple' changes have done strange and unpredictable things to my agents and the way they behave. So strange in fact that it frazzles my tiny little brain trying to understand why my model is behaving in the way it is.

Agent-based models, it seems, really DO reflect complex systems. Or is it just my bad coding? Only time will tell.

Yesterdays coding blunder, after frustratingly trying to figure out why my population get exploding after about 12 years, was that not all my agents were NOT under-going their 'lose some energy every time step' step. And that only the ones who were actually eating food were doing this, meaning those agents that chose not to eat were perfectly happy and never suffered any negative consequences from choosing to perform actions that denied them the potential to consume resources. This at least explains nicely why my male agents were choosing to move incredibly long distances along trails (that provided no food).

So yes, in essence I am happy I found this bug. But todays problem is finding a set of parameters values that now fixes the opposite problem - generate a population that doesn't fall to zero within about 10 years.

Oh, the joys of programming.




22.2.13

LaTeX

I have just become aware of the TeX tips handle on twitter which I have also just started following. As the name suggests it provides useful tips on using LaTeX.

A useful website it has just informed me of can be found here: /http://www.latextemplates.com/ revealing some very useful LaTeX templates: articles, books, presentations, lab notes, PhD thesis!

great tip. Thanks @TeXtip!

21.2.13

Repast demo and tutorial

I have gotten to the point in the current version of my model where sending a both run of simulations of to IRIDIS the southampton uni supercomputer is becoming more and ore necessary. I'm struggling to get a run of 20 years in my simulation at the moment to check for stability of population and territories etc and its taking ages.
One run, depending on the number of agents and amount of reproduction (hence new agents), can take anywhere from half an hour to about 2 hours. I'm also having problems with memory where the simulation breakdown at that start of a new run due to being out of memory. Am currently trying to fix this problem.

Anyway, on my way to discovering if its possible to export a repast batch and pass it to IRIDIS I have come across a nice Repast demo that I wish had been around two years ago when I was starting to think about potential agent based simulation software and 18 months ago when i was struggling with my first attempts with repast.

Demo is based on a population of 'bugs' that move around and eat food from the landscape. Coincidentally amazingly relevant to my own model. I might try the demo and see if I can steal any ideas for better coding/construction of the model/GUI.

Demo can be found here: http://code.google.com/p/repast-demos/wiki/StupidModel
and an output of the GUI:


13.2.13

Biological principles underpinning Jaguar ABM

After some careful consideration of the need for a good biological foundation to my ABM, my supervisors and I agreed to implement some well-known population dynamics theory into key processes of the way the model and the agents undertake tasks.

Key factors: the jaguars - how they decide when and how often to move, and how they consume food across the landscape, and the food itself - food represents prey species and how will this respond to consumption?

Some sample prey species shown here, armadillo, coati, kinkajou, white-lipped peccary.


 


For my agents (jaguars), the key factor governing the way they move in the model is energy. Starting from an initial maximum energy state, they 'use-up' energy in a similar way to calorific expenditure in real animals. Moving and simply existing causes a steady loss of energy. Agents however need energy to survive and so must replenish this lost energy by consuming food. In this respect, low energy creates a greater need for the agent to change location to find an alternative, and potentially greater, food source. But of course real predators suffer a density-dependent relationship with prey and so based on some estimate of attack rate, a, handling time, b, and prey density, N, agents consume food based on the Holling Type 11 response:



Prey must then respond to being consumed, and are considered to regenerate according to a standard logistic growth function:


where, r is the intrinsic growth rate, K is carrying capacity and N is current prey density. For simplification, all prey species have been combined into a single food source and evenly distributed across the landscape, with K varying only with habitat type.

20.1.13

Spatially-explicit agent-based model of jaguar movement - Overview of model

So my first week back at work after maternity leave has been spent getting re-acquainted with my model and preparing to write the next chapter for my thesis. I've found several articles which use ABMs to look at the response of populations to some form of landscape change, and whilst these are different to mine in key aspects, they nonetheless provide me a good overview of how others have gone about doing similar work.

Some papers to mention:

  • Parry et al (2007) Aphid population response to agricultural ;landscape change: A spatially-explicit, individual-based model. Ecological Modelling 199 451-463
  • Wang & Grimm (2007) Home range dynamics and population regulation: An individual-based model of the common shrew Sorex araneus. Ecological Modelling 205 397-409
  • Pitt et al (2003) An individual-based model of canid populations: modelling territoriality and social structure. Ecological Modelling 166 109-121
Grimm has been quite prolific in producing individual-based models in ecology and a great paper by Grimm (and plenty of others) outlines a standard procedure for describing these type of models, so I'll be sticking to this and following the seven elements they outline:
  1. Purpose,
  2. State Variables and Scales,
  3. Process and Overview and Scheduling,
  4. Design Concepts,
  5. Initialisation,
  6. Input, and
  7. Submodels.
Parry et al (2007) start from the protocol but provide information flow diagrams that make it easy to follow the model steps and simplify model procedures, so I've incorporated three flow diagrams into the Grimm protocol, as you can see below:

 Fig 1. Overview of model process

 Fig 2. Overview of agent process


Fig 3. Overview of movement process of agents


Fig 3 is undoubtedly quite complicated and probably subject to some change, but the current version of my model follows these steps quite literally. And I have to say it was quite difficult getting a fairly simplified(!) version of the movement process. A flow diagram is definitely the best way of presenting this information in my thesis chapter and hopefully will ease attempts at future publications as I'm following Ecological Modelling formats.