Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
171
9.1 IntroductionGyrfalcons have specialized feeding habits and feed primarily on one
or two species of ptarmigan (Nielsen 2003, Potapov and Sale 2005,Potapov 2011, Chapter 3 this volume). Gyrfalcon and ptarmigan have cou-pled predator-prey oscillations in some areas (Nielsen 1999) so it isessential for any study on Gyrfalcon populations to have an index thatreflects ptarmigan abundance in the study area. Here we build on Chapter8, which describes methods for estimating prey abundance, and offer a sta-tistical method that can detect joint trends across multiple time series tocreate a quantitative representation of a joint abundance index. Weacknowledge that there are many other methods for population abun-dance estimation, but a full treatment of these methods is beyond thescope of this chapter. Instead we present here a descriptive statisticalapproach that is non-parametric, such that no functional form is pre-sumed for the trends.
Our example data were collected by one of us (ÓKN) as a part of a Gyr-falcon and prey population study (Nielsen 1986). The data are springdensities of territorial Rock Ptarmigan (Lagopus muta) males on six plotssurveyed since 1981 in northeast Iceland (for methods see Nielsen 1996and 2004). Ptarmigan numbers can be quantified using different methods,but we recommend that anyone starting afresh adopt Distance sampling(see Chapter 8, this volume). Count data like those collected in northeast
CHAPTER 9
Estimating trends in ptarmigan numbers
Jenný Brynjarsdóttir and Ólafur K. Nielsen
Brynjarsdóttir, J. and Ó. K. Nielsen. 2017. Estimating trends in ptarmigan numbers.Pages 171–182 in D.L. Anderson, C.J.W. McClure, and A. Franke, editors. Appliedraptor ecology: essentials from Gyrfalcon research. The Peregrine Fund, Boise, Idaho,USA. https://doi.org/10.4080/are.2017/009
Iceland can be used for purposes other than to study predator-prey rela-tionships. For instance, these data along with auxiliary ptarmigan datacollected by the same field crew, including age ratios in spring and latesummer, and regional hunting statistics (total harvest, age composition,number of hunters), have been used to model and reconstruct the RockPtarmigan population (Magnússon et al. 2004, Sturludóttir 2015). In thischapter we will focus on detecting time-trends in the count data.
9.2 Analysis
9.2.1 DataWe want to obtain an estimate of the changes in ptarmigan abundance
over time. For the analysis we use Rock Ptarmigan densities from six plotsin northeast Iceland (Nielsen et al. 2004 and unpubl. data). The layout ofthe data table is illustrated in Table 9.1, and Fig. 9.1 shows the six observedtime-series. The average density of cocks varied between these six areas, e.g.,the density was generally much higher at Holl than Hafurstadir. However,there was clearly a common temporal trend. The six time-series oscillatedin synchrony over time, although the magnitude of the oscillations varied.It is therefore reasonable to treat these six areas as observations of a singlepopulation of Rock Ptarmigan on the Gyrfalcon study area in northeastIceland (Nielsen 2011). Further, a logarithmic transformation of the datastabilizes the variation in oscillation magnitudes (Fig. 9.2), so on a loga-rithmic scale the time series can be assumed to have the same temporaltrend but shifted up or down depending on area. In the following we referto data transformed by the natural logarithm as “log-transformed” data.
9.2.2 Generalized additive modelling of count dataLet Yit be the observed density of cocks (number per km2) in area i and
year t. We consider the following model for our data:
(1) ln(Yit) = ai + s(t) + eit i = 1, …,6, t = 1981, …,2016.
The ai term is a site effect, representing the difference in average log-transformed density numbers between areas, s(t) is a common trendfunction over time, and eit is a random error term. Our main objective isto estimate the s(t) function, a function that represents the overall trendof Rock Ptarmigan abundance in northeast Iceland. There are manyoptions for what form the function can take; here we want a non-paramet-ric curve that is neither too smooth (not informative enough) nor toowiggly (too informative to be predictive), as well as a measure of confi-dence shown as error bars.
172 Brynjarsdóttir and Nielsen
Chapter 9 | Trends in ptarmigan numbers 173
Table 9.1 The first three years of the data table showing density of RockPtarmigan (Lagopus muta) males on six census plots in northeast Iceland1981–2016. The data are stored as a comma separated values file (csv) wherethe rows represent observations and columns are the variables Area, Year, andobserved density of male ptarmigans.Area Year Cock DensityBirningsstadir 1981 4.211Burfellshraun 1981 2.400Hafursstadir 1981 1.625Hofstadaheidi 1981 3.111Holl 1981 7.083Laxamyri 1981 4.865Birningsstadir 1982 4.386Burfellshraun 1982 4.800Hafursstadir 1982 1.875Hofstadaheidi 1982 4.444Holl 1982 12.500Laxamyri 1982 8.378Birningsstadir 1983 3.684Burfellshraun 1983 4.000Hafursstadir 1983 4.125Hofstadaheidi 1983 6.222Holl 1983 19.583Laxamyri 1983 12.703
ll llll ll
ll
ll
ll
llll
llll
llll
llll ll
ll
ll
ll llll
ll llll
llll
llll
llll
ll
ll llll
ll
llll
llll
ll
ll
ll
ll
ll
ll
ll
ll ll ll llll
llll
ll
ll
llll
llll ll
ll
ll ll
ll llll
ll llll
llll ll
ll ll
ll
ll
llll ll
llll ll
llll ll ll
llll
ll
ll
llll ll
ll ll
llll
llll
ll
ll ll
llll ll
ll ll llll
ll
ll ll
ll
ll
llll ll
ll
ll
llll ll ll ll ll
ll
ll ll llll
ll
ll
ll ll
ll
ll
ll ll
ll ll ll
llll
ll
ll
ll
ll ll ll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll
llll
ll
ll
ll ll
ll ll
ll
ll
ll
ll
llll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll llll
ll
ll
ll ll
ll
ll
llll
ll
llll ll
ll
ll
llll ll
ll
ll
ll
ll
llll
llll
llll
ll
ll ll
ll
0
10
20
30
1980 1990 2000 2010Year
Num
ber
of c
ocks
per
km
2
Areall
ll
ll
ll
ll
ll
BirningsstadirBurfellshraunHafursstadirHofstadaheidiHollLaxamyri
Figure 9.1 Density of Rock Ptarmigan (Lagopus muta) males on six censusplots in northeast Iceland 1981–2016.
174 Brynjarsdóttir and Nielsen
l l
l l
l
l
l
l
l
l
l
l
l
l
ll
l
l
ll
l
l l
l
l
l
l
l
l
l
l
ll
ll
l
l
l
l
l
l
l
l
l
l
l
l l l
l
l
l
l
l
l
l
l
l
l
l
l
l l
ll
l
l
l
l
l
l
l
l
l
l
l
l
l l
l
ll
l
l l
l
l
l
l
l
l
l
l
l
l
l
l
l
l
l
l l
l
l l
ll l
l
l
ll
l
l
ll l
l
l
l
ll
l
l l
l
l
l
l
l
l
l
ll
l
l
ll
ll
l
l
l
l
l
l
l l l
ll
l l
l
l
l
l
l
l
ll
l
l
l l
l l
l
l
l
l
ll
l
l
ll
l
l
l
l
l
l ll
l
l
l l
l
l
l
l
l
l
l l
l
l
l
l l
l
l
l
l
l
l
ll
l
l
l
l l
l l
l
l
l
l
l
ll
llllll ll
llll
llllll
ll
llllll
llllll
ll
ll
llllll
llllll ll
llllll
llllll
llllllll
llllllllllllllll
llllllll
lllllllll
ll
ll
llllllll llll
lll
l
ll
ll
ll
lll
lll
l
ll
ll
ll
ll
ll
ll
lllll
ll
lll
llllll
lll
lll lll
lllll
l
lll
ll
llllll
ll
lll
l
ll
lll
lllll
llll
ll
lll
l
lll
llll
ll
ll
ll
ll
ll
lll
ll llll ll
ll
llllllllllll
ll
ll
ll
lll
ll
ll
llllll
ll
lll
ll
ll ll
lllllll
lllllll
lll
lll
ll
ll
lll
ll
ll
lllllll
lllllll
ll
llll ll
ll
lllll
ll
ll ll
ll
lllllllll
ll
ll
lllllll
llllllllll
llll
llllllll
ll
ll
llllllllllllllll
ll
ll
ll
ll
ll
llllllll ll
ll
ll ll
llllllll
ll
lllllllll
llll
ll
lll
llllllllll
ll ll
ll
ll
ll
llll
lllllllllll
ll
lll
ll
lllllllll
ll
ll
ll
lll
lllll
llllllllll
llllllllllll
lllll
lllllllllll
ll
ll
llll
ll
ll ll ll
llll
ll ll
ll
ll
ll
ll
ll
ll
llll
ll
ll
ll ll
ll ll
ll
ll
ll
ll
llll
ll
ll
llll
ll
ll
l
ll
ll
ll llll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll
ll ll
ll
ll
ll
ll ll
ll
ll
ll
ll
lllllllll
llll
ll
ll
ll
ll ll
ll
ll
l
l
ll
l
ll
ll
l
l
l
ll
l
lll
ll
l
llll
ll
ll
ll
l
l
ll
l
l
−1
0
1
2
3
1980 1990 2000 2010earYYear
umbe
r of
coc
ks p
er
log
nkm
2
llllll
ll
lll
ll
lllllll ll
ll
lllllllll
ll
llll
llll
ll
llll
l
Areall
ll
ll
ll
ll
ll
ningsstadirBiraunellshrBurf
HafursstadirHofstadaheidiHoll
iyrLaxam
l ll l
l
l
l
ll
ll
l
l
ll l
l
l
l ll
l ll
ll
ll
ll
l
l ll
l
l
l
ll
l
l
l
l
l
l
l
l l l l
l
ll
l
l
l
l
ll l
l
l l
l l
l
l l
l
l
l l
l l
l
l
l
l l
l
l l
ll l l
ll
l
l
l
l l
ll
l
ll
l
l
l l
ll l
l l ll
l
ll
l
l
ll l
l
l
ll l l
l l
l
ll
ll
l
l
ll
l
l
ll
l l l
l
l
l
l
l
l l l
l
l
l l
l
l
l
l
l
l
ll
l
l
l l
l l
l
l
l
l
l
ll
l
l l
l
l
l
l
l
l ll
l
l
l l
l
l
ll
l
ll l
l
l
ll l
l
l
l
l
l
l
ll
ll
l
l l
l
l
l
l
l
l
l
ll
llllllllll
llllll llllllll
ll
llllllllll
llllllllllllllllll
lllllllllllllllll llllll
llllllllll
lllllllllllllll
llll
ll llllllll
ll
llllllllllllll
llllllll
llll
ll
llllllllllllllllllllll
llll
llllllllll
lllllllllllll
ll lllllllll
llllll
llllll ll
llllllllllll
ll
llllllll l
l llllllllllll
ll
llllllllllll llllllllll
lllllllllllllllllll
llll
llll llll
llllllllll l
lllll
ll
lllllllll
llllll
llllll
llll
lllll
llll
ll
lllllll ll
ll
ll
llll
llllll
llllll
lll
llll
llll
llll
llll
ll ll
llllll
ll lll llll ll
ll
ll
ll
l
llll
ll
llll
lllll
lll
l
ll
ll
l
l
ll lll
llllll
lllll
llll
lll
lllll
ll lllll
ll
ll
llllllll llll
ll
ll
lll
ll
llllllll
lll
ll
ll lllll lll ll
lllll
llll
ll
lllll
lll
ll
ll lll
ll
ll
l
lll l
ll llll
l
llllll
llll lll
llllll
ll
ll
ll ll
lllllll
lllll
ll
llllll ll
ll
lllllll ll
llll lllllll ll
llllllllll
lll
llllll
llllllllll
llll
llllll
ll
llll
lllllll
ll
ll
ll
l
lll ll
lllllllllll
ll ll
ll lllllll
llllll
llllllll
ll
ll
lllll ll ll
ll
lllllllll
lllll
lllllllllllll
llllllll
llllllll
lllllll
llllll llllllll lllll
lllllllll
lllllllll
lllllllllll
llllll
llll
ll
llllllllll l
lll ll
ll
lll
ll
ll ll ll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll
llll
ll
ll
ll ll
ll ll
ll
ll
ll
ll
ll
llll
ll
ll ll
ll
l
ll
ll
ll lll
ll
ll
ll ll
ll
ll
llll
ll
llll ll
ll
ll
llll ll
ll
l
ll
ll
llllll
lll
lllll
lllllll
ll
ll ll
lll
llll
ll
lll
lll
l
l
l
l
l
ll
l ll
l
ll
ll ll
l
l
lllll
ll
l
ll
lll
l
l
ll
l
ll l
l
ll
lllllll
l
ll
l
l
lllll
l
ll
ll
llll
l
ll
ll
lll
l
ll
ll
l
l
ll l
ll
l
l
l l l
l
llllll
ll
lll
lll
l
lll
l lllll
ll
l
l
l
l
l
l
l
lll
l
ll
l
l ll
l
lll
l
ll
l
lllll
l
ll
ll
llll
l
ll
lll
l
ll
llll
l
l
l
ll
l
llllll
ll
ll
l
l
l
l
l
lll
l
l
l lll l
l
ll
l
l ll
l
ll
l
l
llll
ll
ll
l
0
10
20
30
1980 1990 2000 2010earYYear
Num
ber
of c
ocks
per
km
2
llll
llll lllllllllllllllllllllll
l
lll l
llllllllll llll
ll
lllll
ll
llll
lll
llllllllllll
l
ll
l
ll
l
l
ll
l
Areal
l
l
l
l
l
ningsstadirBiraunellshrBurf
HafursstadirHofstadaheidiHoll
iyrLaxam
Figure 9.2 Log density of Rock Ptarmigan (Lagopus muta) males on six censusplots in northeast Iceland 1981–2016. The fitted average trend curve s(b) isshown with a thick blue line and the shaded light blue area shows the 95%confidence bound.
Figure 9.3 Fitted trend curves e ^ai+s(t) on the original scale for density of
Rock Ptarmigan (Lagopus muta) males on six census plots in northeast Iceland1981–2016. The shaded ribbons show the corresponding 95% confidencebounds.
Generalized additive models (GAMs) provide a flexible modelingframework for fitting non-parametric curves to data (see for exampleHastie and Tibshirani 1990). A convenient route is to use the gam() func-tion in the mgcv package (Wood 2000) in R (R Core Team 2016). Thisfunction can fit GAMs with different types of trend curves (smoothers) andcan handle many different error distributions (i.e., not just the normal dis-tribution). In addition, the gam() function automatically chooses the levelof smoothness (degrees of freedom) in ^s(t), but the user can also manually
set the degree of smoothness. The sample R code below shows two possi-ble strategies for analyzing our data:1. log-transformed data, normal errors, and smoothness chosen automat-
ically2. log-transformed data, normal errors, but smoothness chosen manually
by fixing the degrees of freedom of the trend curve.
# 1) fit gam to log transformed data Ptarmigan.gam <- gam(log(CockDensity) ~ factor(Area) +
s(Year), data = Ptarmigan)
# plot the fitted s() curveplot(Ptarmigan.gam)
# estimated parameters, fitted values, and residuals# output not shown
coefficients(Ptarmigan.gam)fitted(Ptarmigan.gam)residuals(Ptarmigan.gam)
# summary table, output not shownsummary(Ptarmigan.gam)
# obtain degrees of freedom for trend curve and aic# output not shown
summary(Ptarmigan.gam)$edf Ptarmigan.gam$aic
# 2) fix degrees of freedom for trend curve Ptarmigan.gam3 <- gam(log(CockDensity) ~ factor(Area) +
s(Year, k = 17, fx = TRUE), data = Ptarmigan)
The gam() function returns a “gam object” in R that is similar to theobject produced by the linear regression function lm(). We can, for exam-ple, access the estimated parameter values, fitted values and residuals aswell as various information about the fit. The fitted curve (thick bluecurve) for our log-transformed Rock Ptarmigan data (analysis 1 above) isshown in Fig. 9.2. Note that on the log scale, we assume that the trendcurve is the same for all areas, only shifted up or down depending on theai parameter. When we transform back to the original scale the area spe-cific ai parameters allow for varying oscillation sizes between areas, asshown in Fig. 9.3. As shown in the code above, fitted curves can be easilyplotted in R. The plots shown here, however, are made using the R packageggplot2 (Wickham 2009).
Chapter 9 | Trends in ptarmigan numbers 175
176 Brynjarsdóttir and Nielsen
The gam() function in R automatically chooses the level of smoothnessof s(t) via cross-validation (other methods are also possible) which is con-venient and produces reasonable results in most cases. Sometimes, however,the fitted trend curve does not capture all the desired features of our data.In our case, the fitted trend curve ^s(t) shown in Fig. 9.2 represents well thetwo major cycles in ptarmigan numbers from 1980–2002, but smoothsover the next two (shorter) cycles. That is, although almost all data seriesexhibit a peak in 2005, 2010, and 2015, and a low in 2007 and 2012, thefitted trend curve only has one cycle over this same period with a peakaround year 2007 (Figs. 9.2 and 9.3).
There is a simple statistical reason why the trend curve does not capturethese short cycles in ptarmigan numbers. More oscillations (more “wig-gles”) in s(t) require more degrees of freedom (df), which can be thoughtof as the number of parameters in the model. The fitted curve given bygam() is a trade-off between an overall goodness-of-fit criterion (e.g., meansquared prediction error) and a penalty term that increases with increasingdegrees of freedom. The gam() function simply determined that thepenalty for the extra degrees of freedom needed to represent the threecycles in 2005–2016 outweighed the effect of a better fit on the goodness-of-fit criterion. In our case we want a trend curve for ptarmigan abundancethat can be used to reflect food conditions for Gyrfalcon and it is thereforenecessary to include the different cycle frequencies of the two time periods.
The smoothness of the trend curve can be adjusted by fixing the degreesof freedom (df) for s(t) (lower df gives a smoother curve), as shown in theR code above. The estimated df for the fitted curve was 8.855, so to makethe curve less smooth we can set the df to a higher number. The challengethen is to choose a suitable value for the df. We fitted the model in equa-tion (1) to our data with increasing df values and examined the fitted trendcurve. For df values 16 and higher the curve exhibited the shorter cycles wewanted represented. To choose between df values that give similar lookingtrend curves we compared the Akaike Information Criterion (AIC, Akaike1974), shown in Fig. 9.4, and found that AIC has a (local) minimum at17 df. The fitted curve for 17 df is shown in Fig. 9.5.
# calculate AIC for models with different dfdfs <- 5:25AIC <- c()for(i in 1:length(dfs)){
tmp.gam.fit <- gam(log(CockDensity) ~ factor(Area) + s(Year, k = dfs[i], fx = TRUE),data = Ptarmigan)
AIC[i] <- tmp.gam.fit$aic}
# plot AIC for each dfplot(dfs, AIC)
Chapter 9 | Trends in ptarmigan numbers 177
� �
�
�
�
��
� � �
�
�
� � �� � � � � �
5 10 15 20 25
150
200
250
300
Degrees of freedom
AIC
l l
l l
l
l
l
l
l
l
l
l
l
l
ll
l
l
ll
l
l l
l
l
l
l
l
l
l
l
ll
ll
l
l
l
l
l
l
l
l
l
l
l
l l l
l
l
l
l
l
l
l
l
l
l
l
l
l l
ll
l
l
l
l
l
l
l
l
l
l
l
l
l l
l
ll
l
l l
l
l
l
l
l
l
l
l
l
l
l
l
l
l
l
l l
l
l l
ll l
l
l
ll
l
l
ll l
l
l
l
ll
l
l l
l
l
l
l
l
l
l
ll
l
l
ll
ll
l
l
l
l
l
l
l l l
ll
l l
l
l
l
l
l
l
ll
l
l
l l
l l
l
l
l
l
ll
l
l
ll
l
l
l
l
l
l ll
l
l
l l
l
l
l
l
l
l
l l
l
l
l
l l
l
l
l
l
l
l
ll
l
l
l
l l
l l
l
l
l
l
l
ll
llllll ll
llll
llllll
ll
llllll
llllll
ll
ll
llllll
llllll ll
llllll
llllll
llllllll
llllllllllllllll
llllllll
lllllllll
ll
ll
llllll
ll
ll
ll llll
lll
l
ll
ll
ll
lll
lll
l
ll
ll
ll
ll
ll
ll
lllll
ll
lll
llllll
l
lll lll
lllll
l
lll
ll
llllll
ll
lll
l
ll
lll
lllll
llll
ll
lll
l
lll
llll
ll
ll
ll
ll
ll
lll
ll llll ll
ll
llllllllllll
ll
ll
ll
lll
ll
ll
llll
ll
lll
ll
ll ll
llllll
lllllll
lll
lll
ll
ll
lll
ll
ll
lllllll
lllllll
ll
llll ll
ll
lllll
ll
ll ll
ll
lllllllll
ll
ll
lllllll
llllllllll
llll
lllllll
ll
ll
llllllllllllllll
ll
ll
ll
ll
ll
llllllll ll
ll
ll ll
llllllll
ll
lllllllll
llll
ll
lll
llllllllll
ll ll
ll
ll
ll
llll
lllllllllll
ll
lll
ll
lllllllll
ll
ll
ll
lll
lllll
llllllllll
llllllll
lllll
lllllllllll
ll
ll
llll
ll
ll ll ll
llll
ll ll
ll
ll
ll
ll
ll
ll
llll
ll
ll
ll ll
ll ll
ll
ll
ll
ll
llll
ll
ll
llll
ll
ll
l
ll
ll
ll llll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll
ll ll
ll
ll
ll
ll ll
ll
ll
ll
ll
lllllll
llll
ll
ll
ll
ll lll
ll
l
ll
l
l
ll
lll
ll
ll
lll
lllll
ll
lll
l
ll
lll
ll
ll
ll
ll
ll
l
l
−1
0
1
2
3
1980 1990 2000 2010earYYear
umbe
r of
coc
ks p
er
log
nkm
2
llllll
ll
lll
ll
lllllll ll
ll
lllllllll
ll
llll
llll
l
llll
ll
ll
Areall
ll
ll
ll
ll
ll
ningsstadirBiraunellshrBurf
HafursstadirHofstadaheidiHoll
iyrLaxam
Figure 9.4 Akaike Information criterion (AIC) for different degrees of freedomfor a trend curve calculated based on density of Rock Ptarmigan (Lagopusmuta) males on six census plots in northeast Iceland 1981–2016.
Figure 9.5 Log density of Rock Ptarmigan (Lagopus muta) males on sixcensus plots in northeast Iceland 1981–2016 and a fitted average trend curves(t) with 95% confidence bound (blue thick curve and the light blue ribbonaround it). Here the degrees of freedom for s(t) were fixed to 17.
178 Brynjarsdóttir and Nielsen
After fitting the GAM model in (1) we can provide an abundance indexthat may be helpful when modeling ptarmigan count data. The abundanceindex, with base year b, for each year t is calculated according to Fewsteret al. (2000) as:
The choice of base year b is arbitrary, but note that every index is a functionof ^s(b) as well as ^s(t) so the uncertainty of every
^I(t) is influenced by the uncer-
tainty of ^s(b). Therefore the year b should ideally be a year where we havethe most data, since that makes the uncertainty in ^s(b) as low as possible.
# calculate the index # choose settings
# years we want an index estimatePredYears <- 1981:2016
# for better looking plots we can use# PredYears <- seq(1981,2016, by=0.2)
# use first year as base yearbase <- 1
# set the area, we chose HollNewDat <- data.frame(Year = PredYears,
Area = “Holl”)
# calculate index from the fitted trend curves.term <- predict.gam(Ptarmigan.gam, newdata = NewDat,
type = ’terms’, terms = ”s(Year)”)index.hat <- exp(s.term - s.term[base])
In our case, we have six observations every year and choose the first yearas a base year. An easy way to calculate the abundance index in R is to usethe predicted values for one area to calculate
^I(t), as shown in the box
above. The estimated index curve is shown in Fig. 9.6, both for the modelchosen by the gam() function and the model that has 17 df for the trendcurve.
The estimated abundance index as calculated in equation (2) can beused directly as an explanatory variable when modeling Gyrfalcon counts.However, it is important to keep in mind that using
^I(t) as a point estimate
does not take into account the uncertainty of that estimate. We end thischapter by showing how we can calculate the error associated with
^I(t).
Even though the error might be difficult to incorporate in a model for Gyr-
I(t) = (2) ^ Expected density year tExpected density year b
= = ^ ^Σi exp (αi)exp (s(t))^ ^Σi exp (αi)exp (s(b))
^exp (s(t))^exp (s(b))
falcon counts, it is informative for the modeler to have information aboutthe accuracy of the ptarmigan trend index. The error for the abundanceindex can be obtained via the mgcv package using Bayesian samplingmethods. The posterior distribution of parameters can be approximatedby a multivariate normal distribution whose mean vector and covariancematrix is given by the gam() function. By sampling from this posterior dis-tribution, say Npost = 1000 times, we calculate the index in equation (2)for each sample to obtain 1000 samples from the posterior distribution ofI(t). These samples can then be used to obtain summaries of the posteriordistribution of I(t) (e.g., the posterior mean and 95% probability intervals(called credible intervals) for I(t) for each year, as shown in Fig. 9.6). Asan example of an extra insight gained from calculating error for our data,we notice in Fig. 9.6 that the 95% credible intervals for year 2005 (a peak)and 2007 (a low) overlap. This indicates that the indices for these twoyears are not significantly different. Example R code to obtain estimatesand error for the population index is shown below. Note that we use themvrnorm() function in the package MASS (Venables and Ripley 2002).
# uncertainty bounds for the index # set number of posterior samples
nPost <- 1000
# get nPost posterior samples of the indexXp <- predict(Ptarmigan.gam, newdata = NewDat,
type = ’lpmatrix’)nYears <- length(PredYears)PostCoef <- mvrnorm(n = nPost, coef(Ptarmigan.gam),
Ptarmigan.gam$Vp)s.terms <- Xp %*% t(PostCoef)Index <- exp( s.terms - matrix(rep(s.terms[base, ],
nYears), byrow = T, ncol = nPost) )
# calculate posterior means and bounds for 95% CIIndexPostMean <- apply(Index, 1, mean)PostLB <- apply(Index, 1, quantile, prob = 0.025)PostUB <- apply(Index, 1, quantile, prob = 0.975)
# build plotplot(PredYears, IndexPostMean, type = ’l’,
ylim=range(PostLB, PostUB))lines(PredYears, PostLB, type = ’l’, lty = 2)lines(PredYears, PostUB, type = ’l’, lty = 2)points(PredYears, index.hat)
Chapter 9 | Trends in ptarmigan numbers 179
180 Brynjarsdóttir and Nielsen
Figure 9.6 Estimated Rock Ptarmigan (Lagopus muta) population index basedon counts on six census plots in northeast Iceland 1981–2016 with 95%confidence bound. Panel A shows results from the GAM model withautomatic smoothness selection and Panel B shows results from setting thedegrees of freedom to 17.
l
l
l
l
l
l l
l
l
l
l
l l
l
l
l
l
l
l
l
ll
l
l
l
l
ll
l
l
ll l
ll
l
l
l
l
l
l
l
ll
l
l
l
l
l
ll
l
l
ll
l
l
l
l
l
l
l
l
l
l
ll
l
ll
l
l
l
l
lll
lll
ll
ll
ll
ll ll
ll
ll
ll
ll
ll ll
ll
ll
ll
ll
ll
ll
ll
llll
ll
ll
l
ll
llll
ll
ll
llll ll
llll
lll
1
2
3
1980 1990 2000 2010earYYear
xop
ulat
ion
inde
P
l xInde
ior meanosterP
le Credibalvinter
A
lll
ll
ll
ll
ll
llll
ll
ll
ll
ll
ll
llll
ll
ll
llll
ll
ll
ll
ll
ll
ll
ll
ll
ll
ll
llll
ll
llll
ll
ll
lll
1
2
3
1980 1990 2000 2010earYYear
xop
ulat
ion
inde
P
l xInde
ior meanosterP
le Credibalvinter
B
Literature citedAkaike, H. (1974). A new look at the statistical model identification. IEEE
Transactions on Automatic Control. AC-19:716–723.Fewster, R. M., S. T. Buckland, G. M. Siriwardena, S. R. Baillie, and J. D.
Wilson. 2000. Analysis of population trends for farmland birds usinggeneralized additive models. Ecology 81:1970–1984.
Hastie, T. J., and R. J. Tibshirani. 1990. Generalized additive models. CRCPress, Boca Raton, Florida, USA.
Magnússon, K., J. Brynjarsdóttir, and Ó. K. Nielsen. 2004. Populationcycles in Rock Ptarmigan Lagopus muta: modelling and parameter esti-mation. Science Institute University of Iceland, Reykjavík. RH-19-2004.
Nielsen, Ó. K. 1986. Population ecology of the Gyrfalcon in Iceland withcomparative notes on the Merlin and the Raven. Ph.D. thesis, CornellUniversity, Ithaca, New York, USA.
Nielsen, Ó. K. 1996. Rock Ptarmigan censuses in northeast Iceland 1981to 1994. Náttúrufræðingurinn 65:137–151. (In Icelandic with an Eng-lish summary.)
Nielsen, Ó. K. 1999. Gyrfalcon predation on Ptarmigan: numerical andfunctional responses. Journal of Animal Ecology 68:1034–1050.
Nielsen, Ó. K. 2003. The impact of food availability on Gyrfalcon (Falcorusticolus) diet and timing of breeding. Pages 283–302 in D. B. A.Thompson, S. M. Redpath, A. H. Fielding, M. Marquiss, and C. A. Gal-braith, editors. Birds of prey in a changing environment. ScottishNatural Heritage, Edinburgh, Scotland.
Nielsen, Ó. K. 2011. Gyrfalcon population and reproduction in relation toRock Ptarmigan numbers in Iceland. Pages 21–48 in R. T. Watson, T. J.Cade, M. Fuller, G. Hunt, and E. Potapov, editors. Gyrfalcons andPtarmigans in a Changing World, volume 2. The Peregrine Fund, Boise,Idaho, USA.
Nielsen, Ó. K., J. Brynjarsdóttir, and K. G. Magnússon. 2004. Monitoringof the Ptarmigan population in Iceland 1999–2003. Fjölrit Nát-túrufræðistofnunar 47:1–110. (In Icelandic with an English summary.)
Potapov, E. 2011. Gyrfalcon diet: spatial and temporal variation. Pages55–64 in R. T. Watson, T. J. Cade, M. Fuller, G. Hunt, and E. Potapov,editors. Gyrfalcons and Ptarmigan in a Changing World, volume 1. ThePeregrine Fund, Boise, Idaho, USA.
Potapov, E., and R. Sale. 2005. The Gyrfalcon. T & A Poyser, London, UK.R Core Team. 2016. R: A language and environment for statistical comput-
ing. R Foundation for Statistical Computing, Vienna, Austria.https://www.R-project.org/.
Sturludóttir, E. 2015. Statistical analysis of trends in data from ecologicalmonitoring. Ph.D. thesis, University of Iceland, Reykjavík.
Chapter 9 | Trends in ptarmigan numbers 181
Venables, W. N., and B. D. Ripley. 2002. Modern Applied Statistics withS. Fourth Edition. Springer, New York, New York, USA.
Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis.Springer-Verlag New York. http://ggplot2.org.
Wood, S. N. 2000. Modelling and smoothing parameter estimation withmultiple quadratic penalties. Journal of the Royal Statistical Society:Series B (Statistical Methodology) 62:413–428.
182 Brynjarsdóttir and Nielsen