Detection probability using double observer data

880 views
Skip to first unread message

Mark Na

unread,
Dec 13, 2011, 12:25:44 PM12/13/11
to unmarked
Hello,

I have counts of multiple species of waterbirds collected using a
dependent double observer method. Each sampling unit (wetland) was
visited two times during the breeding season. I assume closure.

I have used Program DOBSERV (based con Nichols et al. 2000) to produce
detection probabilities (using data from a single visit) but I'd like
to move these analyses into R.

I have two questions:

1. Which unmarked function, if any, will replicate DOBSERV?

2. I understand that using data from a second visit would allow me to
model occupancy as well as detection, but would it also produce better
estimates of detection probability than using data from a single
visit? If so, which unmarked function should I use for that?

Many thanks, in advance.

Mark

Richard Chandler

unread,
Dec 13, 2011, 1:50:56 PM12/13/11
to unma...@googlegroups.com
Hi Mark,

For single-visit data, you can use multinomPois. For single- or multiple-visit data, you can use gmultmix. To fit the dependent double observer model, you will need to specify your own function to compute the multinomial cell probs (called a "piFun" in unmarked). When you use a custom piFun, you also have to create a custom "obsToY" object. Fortunately, there is an example of this that comes with the unmarked package. Go to the directory where unmarked was installed, and look at the file library/unmarked/inst/doc/sim.gmultmix.R. The relevant code is pasted below.

You don't need multiple visits to estimate occupancy. If you assume a Poisson distribution for abundance at each site, you can compute occurrence probability as 1 - exp(-lambda), where lambda is the estimate of animals/site. Having multiple visits allow you to assess population closure among visits.

Richard



# function to simulate dependent double observer data
sim.dep.double <- function(nSites=200, numPrimary=2, lambda=1, phi=0.6,
                           pA=0.8, pB=0.6, alpha=0.5)
{

    N <- matrix(NA, nSites, numPrimary)
    y <- array(NA, c(nSites, 2, numPrimary))

    # Abundance at each site
    M <- rnbinom(nSites, size=alpha, mu=lambda)

    # Number available during each rep
    for(i in 1:nSites) {
        N[i,] <- rbinom(numPrimary, M[i], phi)
        }

    # Number observed
    for(i in 1:nSites) {
        for(t in 1:numPrimary) {
            cp <- c(pA, pB * (1 - pA))
            cp[3] <- 1 - sum(cp)
            y[i,,t] <- c(rmultinom(1, N[i,t], cp)[1:2])
            }
        }
    return(matrix(y, nSites))
}

str(sim.dep.double())


# function to compute multinomial cell probs
depDoubPiFun <- function(p) {
    M <- nrow(p)
    pi <- matrix(NA, M, 2)
    pi[,1] <- p[,1]
    pi[,2] <- p[,2]*(1-p[,1])
    return(pi)
}

# matrix that "maps" covariate data to observations
obsToY <- matrix(1, 2, 2)
numPrimary <- 2
obsToY <- kronecker(diag(numPrimary), obsToY)



# Example
set.seed(4)
nSites <- 200
T <- 10
y.sim <- sim.dep.double(nSites=nSites, numPrimary=T, lambda=3)
observer <- matrix(c("A", "B"), nSites, T*2, byrow=TRUE)
obsToY <- matrix(1, 2, 2)
obsToY <- kronecker(diag(T), obsToY)
umf <- unmarkedFrameGMM(y = y.sim,
    obsCovs = list(observer=observer),
    numPrimary=T, obsToY=obsToY, piFun="depDoubPiFun")
summary(umf)

m5 <- gmultmix(~1, ~1, ~observer-1, umf, mixture="NB")
m5

plogis(1.429) # detection prob for observerA
plogis(0.395) # observerB






From: Mark Na <mtb...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 12/13/2011 12:28 PM
Subject: [unmarked] Detection probability using double observer data
Sent by: unma...@googlegroups.com


Mark Na

unread,
Dec 15, 2011, 5:27:15 PM12/15/11
to unmarked
Hi Richard,

Many thanks for your reply. I'll work through the example you
provided. In the meantime, the path you suggest (library/unmarked/inst/
doc/sim.gmultmix.R) doesn't seem to exist - there is no directory
called inst. So, I can't find the file sim.gmultmix.R. Any idea where
else I could look?

Thanks, Mark

Jeffrey Royle

unread,
Dec 15, 2011, 7:48:33 PM12/15/11
to unma...@googlegroups.com
hi Mark,
 right now unmarked will only handle the independent double observer protocol using multmix or gmultmix.  I'll have to think if we can trick this function or hack it easily to handle dependent double observers.  For now though you're out of luck, sorry.
regards,
andy

Jeffrey Royle

unread,
Dec 15, 2011, 8:57:38 PM12/15/11
to unma...@googlegroups.com
hi all,
 I stand corrected and embarrassed. I was catching up on emails tonight and didn't see Richards detailed reply from earlier which he apparently figured out already!
 Sorry to add confusion to the issue here.
regards
andy

Richard Chandler

unread,
Dec 16, 2011, 8:42:44 AM12/16/11
to unma...@googlegroups.com
ha ha. no worries.

btw, Mark, the correct path is /library/unmarked/unitTests/sim.gmultmix.R

Richard



From: Jeffrey Royle <jar...@gmail.com>
To: unma...@googlegroups.com
Date: 12/15/2011 08:57 PM
Subject: Re: [unmarked] Re: Detection probability using double observer data
Sent by: unma...@googlegroups.com

Mark Na

unread,
Dec 16, 2011, 11:32:59 AM12/16/11
to unmarked
Hi Richard,

Okay, I found the sim files, thanks.

So, do the piFun function and ObsToy object depend on the data or can
the ones in the sim file be used with any dataset? It's not entirely
clear what these do or whether they need to be modified.

Thanks again,

Mark

On Dec 16, 7:42 am, Richard Chandler <rchand...@usgs.gov> wrote:
> ha ha. no worries.
>
> btw, Mark, the correct path is /library/unmarked/unitTests/sim.gmultmix.R
>
> Richard
>
> From:
> Jeffrey Royle <jaro...@gmail.com>
> To:
> unma...@googlegroups.com
> Date:
> 12/15/2011 08:57 PM
> Subject:
> Re: [unmarked] Re: Detection probability using double observer data
> Sent by:
> unma...@googlegroups.com
>

Richard Chandler

unread,
Dec 16, 2011, 12:12:27 PM12/16/11
to unma...@googlegroups.com
Hi Mark,

The "piFun" and "obsToY" in the example I posted earlier should work for any dependent double observer dataset. Note that you don't have to bother with stuff if you have removal-sampling data or independent double observer sampling data. In those cases, all this stuff is taken care of automatically.

Richard

_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5696



From: Mark Na <mtb...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 12/16/2011 11:33 AM
Subject: [unmarked] Re: Detection probability using double observer data
Sent by: unma...@googlegroups.com

Dan

unread,
Sep 21, 2012, 12:17:05 PM9/21/12
to unma...@googlegroups.com
Hello,

I also have dependent double-observer count data for multiple species. Thus, I have species-specific encounter histories for each site:

Simplified Example:
X<-matrix(c(2,1,1,3,1,0,0,1,111,111,222,222,0,1,0,1),nrow=4)
X<-data.frame(X)
names(X)<-c("y.1","y.2","Site", "Species")

I am using gmultmix to estimate detection and abundance and am wondering if it is possible to implement a multi-species approach or if I will have to model each species separately?

Cheers,
Dan

Jeffrey Royle

unread,
Sep 21, 2012, 3:17:31 PM9/21/12
to unma...@googlegroups.com
[sorry if this is a duplicate response, my email is acting up]
hi Dan,
There is no explicit multi-species model. If you did have some
hypotheses in mind that involved multiple species, its possible you could
achieve a version of such a model by treating each species as its own
"site" (so "sites" in the model are really [site x species] combinations).
Otherwise, for such a thing, you could use one of the BUGS variants.
regards
andy

Mark Na

unread,
Sep 24, 2012, 3:01:44 PM9/24/12
to unma...@googlegroups.com
Hi Richard and Andy,

I am working with the double observer code in the sim.gmultmix.R file provided with the latest release of unmarked.

As I understand things, this code returns beta coefficients which can be transformed into estimates of detection probability for each observer.

How can I modify the code to calculate overall detection probability, i.e. the probability of being detected by at least one of the observers (sensu Nichols, Auk, 2000)?

Many thanks,

Mark



On Friday, December 16, 2011 11:12:27 AM UTC-6, Richard Chandler wrote:

Richard Chandler

unread,
Sep 24, 2012, 3:56:50 PM9/24/12
to unma...@googlegroups.com
Hi Mark,

I think you want:

1 - ((1-pA)*(1-pB))

where 
pA=detection prob for observer A 
pB=detection prob for observer B



Richard
Reply all
Reply to author
Forward
0 new messages