## Introduction

Distance sampling and capture–recapture methods are the two most widely used methods for estimating animal abundance. Powerful general software packages for distance sampling have existed for many years (Thomas *et al*. 2010) and mark–recapture (White & Burnham 1999), and this has greatly facilitated their use in addressing ecological and management problems. These packages have been supplemented in recent years by packages implementing new developments in these fields (Fiske & Chandler 2011; Efford 2012) but even so, the rate of new method development is outstripping the rate at which the authors of major packages in these areas can update their software. To allow ecologists and managers to take advantage of new developments soon after their advent as possible, there is clearly utility in releasing more specific packages that implement new methods as they are developed. These may or may not subsequently be incorporated into the major packages in these fields, but meanwhile state-of-the-art methods are available for ecologists and managers to use.

This paper describes one such package nupoint, now available on sourceforge, which implements a variant of distance sampling that was first developed in 2010 (Marques *et al*. 2010) and has been adapted and extended for a number of different applications since then. We draw together and generalize the original method and subsequent extensions, into a single package. More specifically, the paper deals with point transect sampling in the presence of nonuniform animal distribution that varies with some observable environmental feature.

The background to the new method is as follows: point transect sampling is one of the two main forms of distance sampling and involves observers located at a number of randomly located points, searching for animals and recording the distances to detected animals. Random location of points is crucial for conventional point transect methods because estimation requires that animals are independently uniformly distributed in the searched areas around the points – and by distributing points randomly (according to a uniform distribution), the uniformity assumption is met. But it is not always possible to distribute points randomly, and when points are located on, or with reference to, some environmental feature, the assumption of uniform distribution of animals in the searched areas is likely to be violated. Common examples include locating points along paths or roads and locating points on shore when surveying marine fauna. In such cases, conventional point transect methods will result in biased estimation of density (Marques *et al*. 2010).

The R package nupoint implements point transect density estimation for situations in which there is, or may be, an animal density gradient in the searched areas. The package accommodates two kinds of density gradient. The simpler of the two is one in which animal density contours are parallel to some linear feature on which points are located. To deal with this case, the package incorporates the methods of Marques *et al*. (2010), which were developed to draw inferences from point transect surveys on roads, assuming animal density contours are parallel to the road, and the methods of Cox *et al*. (2011), which do the same but were developed for point transect surveys on the sea surface (and which we expand upon below). The less simple kinds of density gradient accommodated by the package are those in which animal density contours are not parallel but are aligned with some observable (typically nonlinear) environmental variable. The package incorporates the methods of Arranz *et al*. (unpublished data) to deal with this case (we expand on this application below).

The key features of the package are as follows:

- By using detection angles as well as distances, it allows estimation of both a conventional point transect radial distance detection function and (unlike conventional methods) nonuniform animal density with respect to some observable environmental feature within the searched area (such as distance from road or from shore, or altitude or depth).
- Key outputs are estimates of density itself, density function parameters, detection function parameters and associated coefficients of variation and confidence intervals.
- The package also provides some tools for plotting and for model diagnosis, AIC statistics for model selection and goodness-of-fit test statistics.
- Finally, a facility to investigate estimator properties by simulation is also provided.

We illustrate the package by applying it to a multibeam hydroacoustic survey (Cox *et al*. 2011), and a subset of the shore-based survey data of beaked whale surfacings of Arranz *et al*. (unpublished data). The similarity of the two problems is illustrated in Fig. 1.

As well as addressing quite different biological problems, the two surveys differ in the kinds density gradients involved and the kinds of supplementary data available. Before getting into the analysis of the data, we give a brief intuitive explanation of how the method works, which we hope will aid understanding of the subsequent analyses.

Consider the echosounder survey in Fig. 1 and suppose it surveyed a full 180 degrees. Suppose also that krill density changed with depth – i.e. the contours of animal density were parallel to the surface. And suppose that the echosounder is as good at detecting animals at all angles from vertical. At 90 degrees to vertical (horizontally just under the surface), it is searching along a contour of constant density, and so there are on average as many animals at all distances from it. As a result, the drop-off in the number of animals detected as distance from the echosounder increases reflects detectability only (i.e. the shape its detection function). But in a vertical direction, animal density changes as distance from the echosounder changes, so the change in the numbers of animals detected with increasing distance reflects a combination of detectability and density.

If the echosounder only searched vertically, you would not be able to separate these two effects and hence be unable to estimate animal density. But because it also searches horizontally (in this illustrative scenario) along a contour of constant density, you can separate them. The key result is that by searching a range of angles relative to animal density contours, and recording both angles and distances, the detection gradient and density gradient can be separated. (In reality, you do not just search at two angles, but the same idea applies no matter what range of angles you search and the mathematics of the method takes care of the details of how density and detectability are separated – see Marques *et al*. 2010 and Cox *et al*. 2011 for mathematical details.)