# plotting detection function

26 views

Jun 13, 2023, 5:19:06 AMJun 13
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

The histogram from which it was generated is below

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?

Jun 13, 2023, 5:31:48 AMJun 13

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

Sent: 13 June 2023 10:19
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.

Jun 13, 2023, 5:49:38 AMJun 13
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,

Jun 13, 2023, 5:52:46 AMJun 13

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