• R: code to assess spatial independence of residuals of a model

This code is useful to check if the assumption of (spatial) independence between residuals of a model is met.

Useful because it can be applied to the residuals of any model we run

It generates a plot of bubbles located according to the X-Y coordinates of the corresponding residuals. The size of the bubbles represents the magnitude of the residuals, while the color indicates if they are positive or negative. If there is spatial independence of the residuals, no pattern should be observed in the disposition of the bubbles. NOTE: requires “sp” package

library(sp)                                                     #Load the sp package
Residuals<-resid(model)                          #Generates a vector with the residuals from the model
mydata <- data.frame(Residuals, RawData$XCooords, RawData$YCoords)    # Generate a data frame with the residuals and corresponding coordinates (obtained from the dataset in which the model was ran)
colnames(mydata)<-c(“Residuals”,”X”, “Y”)                   #Assign names to the columns
coordinates(mydata) <- c(“X”,”Y”)                                    #Identify which columns correspond to the coordinates

bubble (data, “Residuals“, col = c(“black”,”grey”), xlab = “X-coordinates”, ylab = “Y-coordinates”)   #Plot the bubbles

exBubbles

 

  • ArcGIS: Iterator option in Model Builder

This option allows to run the same function over all the files contained inside a folder, freeing the user from doing repetitive tasks.

ex_iterator

 

Radiotelemetry is a common tool for studying animal movement, consisting of attaching a radio tag to an individual and tracking it either remotely with a GPS system or at shorts distances using hand-held antennas.
Until recently, hummingbird movement patterns hadn’t been able to be studied due to lack of transmitters small enough to be carried by such a light animal. The development of miniaturized radio-telemetry devices changed this. Using them, Hadley & Betts were able to conduct a translocation experiment in 2008, while I, in 2012, gathered information on natural (within the home range) movement patterns. This information consisted in time-stamped location points, which seemed perfect for the application of spatio-temporal statistics. In particular, I wanted to see if certain characteristics of the observed movement paths (speed, turning angle) could be used to assess behavioral changes associated to characteristics of the terrain (presence of forest).
As my previous posts show, I was unsuccessful in doing this, as none of the tools or analyses I tried showed evidence of pattern, neither in space or time. It is possible that due to the very high flight speed of these birds (average= 30 mi [48 km]/ hour), we weren’t able to keep up with them while tracking them, leading to un-realistic speed estimates (1.2km/hour).
Even when my data doesn’t have enough precision to answer point-level questions the information on general movement rates of the individuals can still give an insight on how behavior can be affected by the context in which the animals are moving. The advantage of the lack of temporal and spatial correlation between the data points is that I will be able to use traditional statistics to run these analyses.
I also explored a new tool for analyzing telemetry data points: the Dynamic Brownian Bridge Model (dBBMM). This model predicts the areas probably used by the individuals based on their overall movement paths, taking into account not only the location of points but also the sequence in which they took place, incorporating temporal autocorrelation in their calculations. The dBBMM also estimates a parameter (“Brownian motion variance”) that can be used to evaluate the existence heterogeneous behavior along the tracks. High values of Brownian motion variance would indicate more complex paths (and consequent more active behavior), while low values would indicate less variation in the way the individual is moving. I tried to apply this model to my data, but wasn’t able to find a way of estimating the Brownian motion variance. What I was able to do though was generating rasters showing the probability distribution of individuals in space, that’s to say, the areas where it as likely for the birds to be present.

exdBBMM

Figure 1. Map showing the probability of observing a particular individual in space, based on data points obtained through radio-telemetry. This particular bird seems to have two centers of activity, joined by a transit area

The code to run this model (in R) can be found at http://www.computational-ecology.com/main-move.html.

I have worked on plotting the observed values of speed and turning angle for each bird versus the time of the day, to see if any of the patterns observed in the Incremental Autocorrelation plots can be traced back to relationships between the individual points. As far as I can see, there doesn’t seem to be none. I am attaching the output for four of my birds, including also an image of the area where they have been moving (where green is forest and pink is agricultural land).

(Note: The point plots correspond to a single day of observations, while the autocorrelation ones were made using all the observation days. I couldn’t run the analysis with the data from single days because they weren’t enough to meet the minimum required by the tool. )

606 606minimap

509 509minimap

626 626minimap

531 531minimap

495 495minimap

I am thinking that I should do the same type of plot using distance in the X axis rather than time, because there’s not a strict direct relationship between distance moved between two points and time taken to move that distance. Thus, a 30-second time interval between two points could either be reflecting 10 meters or 100 meters.

My new dilemma is that I am not sure what that distance on the X axis should represent. The distance of all points to an arbitrary point (e.g.: site of capture)? The distance along a movement path defined by joining consecutive points? Suggestions are welcome!

My objective was to see if the displacement of the birds showed particular patterns. For this, I decided to analyze the distribution of speed and rotation angles in space. Speed at a particular point is calculated as distance to previous point over time taken to move between points. Rotation angle refers to the angle between two consecutive movement lines (i.e., lines joining point A to B and B to C).
I first tried the Spatial Autocorrelation function, which indicated a clustered distribution of the values.

Example of output of the Spatial Autocorrelation tool applied to rotation angles.

These results weren’t meaningful for me though, as I was interested in the variability within the observations. Studies on different animals species have shown that the analysis of variability within movement patterns can be used to infer behavioral patterns. I expected the birds would show varying speeds and rotation angles in response to the habitat where they were living (e.g., move slower inside the forest and quicker between forest patches; straighter movement lines in non-forest habitat). Thus, I decided to apply the Incremental Spatial Autocorrelation function, as this tool would indicate if the spatial clustering of values varied in the study area.

The results show mixed responses from each bird, with no clear interpretation for the observed patterns.

Example of output of the Incremental Spatial Autocorrelation tool applied to speed.
Example of output of the Incremental Spatial Autocorrelation tool applied to rotation angles.

Most of them have non-significant z-scores, and those that do have no clear relationship to any environmental factor.  Hot spot analyses don’t show a particular concentration of values at any point either.

Example of output of the Hot Spots tool as applied to rotation angles.

 

In conclusion, speed and rotation angles are either A) not affected by the disposition of forest or B) bad indicators of behavioral changes associated to space use.

 

 

I am working with hummingbird location points obtained through radiotelemetry, and want to figure out their patterns of space use and how they are affected by forest fragmentation.

I need to find ways of assessing which areas are preferred by the birds as well as the movement patterns they follow.

The points were recorded within a short time period, so they are not independent. Autocorrelation functions will help me evaluate the degree of this dependence in space and time. Rather than a problem, the autocorrelated nature of my data presents an opportunity to study activity patterns of the birds.

TOOL: Generate Network Spatial Weights

URL: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005p0000001z000000

Toolset: Modeling Spatial Relationships

Summary: This tool allows the analysis of the spatial relationship between features whose connections are restricted to a network. This means that the movement between two points can only take place through specific routes. Consequently, if one wants to analyze the shortest distance between two points, the Euclidean (straight-line) might not be the appropriate measurement.

The Generate Network Spatial Weights generates a spatial weight matrix which quantifies the relationship between features based on their neighboring relationships and under the restriction of a network dataset.

 

TOOL: Linear Directional Mean

URL: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005p00000017000000

Toolset: Measuring Geographic Distributions

Summary: This tool measures the trend of a set of lines to identify their mean direction, length, and geographic center. It can calculate mean direction and/or mean orientation. In the first case, the start and end points of the lines matter; in the second, they don’t.

The output of the Linear Directional Mean is a single line centered on the calculated mean center, length equal to the mean length and direction (or orientation) equal to the mean direction (or mean orientation) all input vectors.

 

VIDEO: Performing Proper Density Analysis

http://video.arcgis.com/watch/401/performing-proper-density-analysis

Duration: 12:11min

Summary: The purpose of this video is to explain importance of user-decisions (such as input parameters) when performing a density analysis and generate awareness of the existence of subjective aspects of the results.