plotting detection function

39 views
Skip to first unread message

Aditya Ghoshal

unread,
Jun 13, 2023, 5:19:06 AM6/13/23
to distance-sampling
Hi everyone, 
I have a question on how to plot the empirical detection function from the histograms of sightings in R. I want to set g(x=0.15) as my truncation distance and in order to estimate that I want to plot the g(x). I understand that the probability density function f(x) can be plotted using 'density' function. But how should I go to g(x) from there? I apologize as this might be a question more related to R. 

Till now I have used the following codes for plotting g(x)
d<-density(species$distance)
d$y<-d$y/max(d$y)

Since I have maximal detections close to the line it throws up a plot like this 



density.jpeg
The histogram from which it was generated is below
histogram.jpeg
Once I make the density I find the point where y=0.15 (using abline) and find the distance on the x axis. I do not think this is correct. Can you please shed some light? 

Eric Rexstad

unread,
Jun 13, 2023, 5:31:48 AM6/13/23
to Aditya Ghoshal, distance-sampling
Aditya

You are making the problem more difficult than it is.

To view the shape of the fitted detection function superimposed upon a histogram of detection distances, simply use the plot​ function upon the object created by the ds​ function:

library(Distance)
data("minke")
simplefit <- ds(minke, key="hn", adjustment = NULL)
plot(simplefit, showpoints=FALSE)
abline(h=0.15, lwd=2, col="red")

produces


From: distance...@googlegroups.com <distance...@googlegroups.com> on behalf of Aditya Ghoshal <aditya...@ncf-india.org>
Sent: 13 June 2023 10:19
To: distance-sampling <distance...@googlegroups.com>
Subject: [distance-sampling] plotting detection function
 
--
You received this message because you are subscribed to the Google Groups "distance-sampling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to distance-sampl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/distance-sampling/01205342-8032-48e6-b9cb-bc7f41be88f8n%40googlegroups.com.

Aditya Ghoshal

unread,
Jun 13, 2023, 5:49:38 AM6/13/23
to distance-sampling
Thanks for the prompt response Eric.  So I just fit a detection function on my data before I select the truncation distance and then go ahead to the fitting the various models?
A couple of quick questions:
1.  should I be checking this preliminary fit with other key functions as well?
2. If I plan to use a covariate like region or sampling season in my final model do I need to incorporate it in this preliminary fitting? 

Thank you, 

Eric Rexstad

unread,
Jun 13, 2023, 5:52:46 AM6/13/23
to Aditya Ghoshal, distance-sampling
Aditya

Remember the truncation decision guidance (truncate where g(x)=0.15) is simply that "guidance". You need not dwell upon that decision too long.

Sent: 13 June 2023 10:49
To: distance-sampling <distance...@googlegroups.com>
Subject: Re: [distance-sampling] plotting detection function
 

Aditya Ghoshal

unread,
Jun 13, 2023, 5:58:11 AM6/13/23
to distance-sampling
Right. Also I just saw that varying my truncation distance by even 50 m does not make any appreciable difference to my estimates or their variances. However, my dataset also has species where I may not have sufficient detections (less than 40 detections pooled over regions and two sampling seasons). In that case including outlier detections would have a greater impact on the estimates?   
Reply all
Reply to author
Forward
0 new messages