Ecological datasets are often filled with structure that needs to be handled during the modelling process. This can include sampling that’s different between groups, different means, variances and effects across groups, etc. Before deciding what type of model to fit, and how to structure the parameters, it is important to visually explore the data to get a feel for what the structure is. This can help guide the modelling process.
With this in mind, we will explore data that were collected by Roulin and Bersier (2007) to explore whether the sex of the parent influenced how much nestling barn owls begged for food. To collect these data they set up cameras in 27 barn owl (Tyto alba) nests and studied the begging behaviour of nestlings in response to the presence of the father and of the mother. The main response variable we will be looking at is ‘NegPerChick’, which is the number of counted calls coming from a nest in the 30-s interval before the arrival of the parent, divided by the number of nestlings in that nest. The explanatory variables we will be working with in these data are:
In this Practical you will:
These data will be used again in Practical 05 when we explore model fitting, selection, and model averaging. Our goal right now is dive into these data to get a feel for their structure so we know how to approach the modelling process. You are asked to complete the following exercises and submit to Canvas before the deadline. In addition to the points detailed below, 5 points are assigned to the cleanliness of the code and resulting pdf document. Only knit documents (.pdf, .doc, or .html) will be accepted. Unknit .Rmd files will not be graded.
One of the first things to do when you start working with a new dataset is plot all of the potential predictors against the response(s) in order to get a feel for what the relationship is going to be. This can also be a useful process for identifying whether the relationship is non-linear and should be modeled as e.g. a polynomial (but we will not explore that here). Let’s look at negs per chick versus arrival time, food treatment, the sex of the parent, and Nest ID.
The next thing to do when you get your hands on some data is to understand how balanced/unbalanced the sampling was. This is especially true for nested data (no pun intended). If certain groups are over represented, there is a chance that they can outweigh others and vice versa for underrepresented groups. Mixed effects models can, to some extent, handle unbalanced designs, but it is good to know about this a priori. For example, if 95% of the data were to have come from 1 nest, then this can result in a number of challenges.
table()
function.
These data are nested, or hierarchical in nature and there are some balancing issues. At this stage it is useful to check and see if the response variable differs across the sampling groups to get a feel for how balancing might influence the modelling process. This can help tell us whether or not we will need to worry about fitting mixed-effect models to our data, and how partial shrinkage might come into play. For example if a heavily over sampled nest also has a higher number of negs per chick than any other nest, it can pull the regression towards itself. In our initial inspection above, there were some potential imbalances related to the various treatments/sampling groups. Let’s explore this further.
aggregate()
function is useful here). Visually, do you see a cause for concern? Fit
a simple linear model to confirm. – 1 point(s)Remember that when fitting multiple regression models, correlations between predictor variables can bias results. Before analysing a dataset it’s important to check for any potential correlations and/or relationships between the predictor variables. Here we have i) arrival time, a continuous variable; ii) the sex of the parent, a factor with two levels; and iii) the food treatment, a factor with two levels.
The whole point of generating all of these visual diagnostic plots was to figure out how we would build a model identifying the factors influencing begging behaviour of nestling owls.