Accessing fitted values to get P's...

21 views
Skip to first unread message

clac...@googlemail.com

unread,
Feb 26, 2024, 4:58:17 PMFeb 26
to distance-sampling
Hi folks.. 
Apologies if this has been answered before - but I don't think it has. 
When a multi-covariate distance model is run, is there any way to extract the individual probabilities for each sighting from the model results? 
The reason I would like to do this, is that I am investigating a way to correct for availability bias using some auxiliary data. If this all works out, I would have a different availability correction value  for each sighting, based on things like group size. I'm guessing I'd probably have to apply this manually to each sighting, but I don't know how I would do so within the R package. 
Happy to provide more information if needed. 
Thanks in advance
Claire

Eric Rexstad

unread,
Feb 27, 2024, 5:24:22 AMFeb 27
to distance-sampling, clac...@googlemail.com
Claire

I'm not sure it has been asked before, and it is a bit tricky to answer.

Your first stop will be the documentation for predict.ds()​, with special attention paid to this passage:
The predicted detection probability is the average probability which is simply the integral divided by the distance range. Fitted detection probabilities are stored in the model object and these are returned unless compute=TRUE or newdata is specified. compute=TRUE is used to estimate numerical derivatives for use in delta method approximations to the variance. Note that the ordering of the returned results when no new data is supplied (the "fitted" values) will not necessarily be the same as the data supplied to ddf, the data (and hence results from predict) will be sorted by object ID (object).
This tells us that these predicted average probabilities are stored in the object created by ds​. However, the last sentence states that care needs to be taken to properly match the predicted probabilities with the detection after accounting for truncation, etc.. I demonstrate with a bit of code applied to the amakihi​ data set provided with the Distance​ package.

library(Distance)
data(amakihi)
test <- ds(data=amakihi, key="hr", formula = ~OBs+MAS, truncation = 82.5)
within.trunc <- amakihi[amakihi$distance<82.5 & !is.na(amakihi$distance), ]
within.sort <- within.trunc[order(within.trunc$object), ]
m <- within.sort$MAS
o <- within.sort$OBs
plot(m, test$ddf$fitted)
plot(o, test$ddf$fitted)

From: 'clac...@googlemail.com' via distance-sampling <distance...@googlegroups.com>
Sent: 26 February 2024 21:58
To: distance-sampling <distance...@googlegroups.com>
Subject: [distance-sampling] Accessing fitted values to get P's...
 
--
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/6c737794-acaf-4d7d-a3d1-52040dbdb3c0n%40googlegroups.com.

clac...@googlemail.com

unread,
Feb 27, 2024, 3:32:54 PMFeb 27
to distance-sampling
Thanks Eric! 
I think this will work for what I need. Very much appreciated indeed
Claire

Reply all
Reply to author
Forward
0 new messages