Andrew Cox
unread,Apr 20, 2012, 11:57:10 AM4/20/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to unmarked
Hi,
I am trying to plot a detection function mostly using code provided
in the distance sampling vignette but I am clearly doing something
wrong, probably because this is my first foray into distance sampling
as well as R. First I used this code to estimate detectability for
100m radius point counts with a hazard key function:
shape<-exp(coef(StockObs,type="det"))
scale<-exp(coef(StockObs,type="scale"))
ea<-2*pi*integrate(grhaz,0,100,shape=shape[1],scale=scale)$value
sqrt(ea / pi)
ea/(pi*100^2)
which so far as I can tell will use the shape and scale from a model
called "StockObs" to estimate detectability. This appears to work
okay, as detectability values for species are near what we would
expect (0.2-0.5).
But when I go to plot the detection function using this code:
plot(function(x) grhaz(x, shape=shape[1], scale=scale), 0, 100,
xlab="Distance (m)", ylab="Detection prob.")
I get a plot that has detection probabilities >1 (up to 20!).
Any help is much appreciated!
Andrew