Description
Email from a user:
I want to use it to obtain probability of detection for each of my sightings. However, the predict.dsmodel looks like it is not available in the newest version of the ds package. Are there other functions or packages I can use to obtain these probabilities?
Checking via an MRE, I find this is true, so offered these alternatives:
But it is easy to remedy. You can either use the "triple colon" trick to access functions within a package that are not exported. Or you can simply call the generic function predict that checks what type of model object it has received and call the appropriate function as a result. Here is an example of both (showing they produce identical results) using the amakihi dataset because I wanted a covariate in my detection function model so predict is doing something interesting:
library(Distance)
data("amakihi")
cu <- convert_units("meter", NULL, "square kilometer")
fitobs <- ds(amakihi, transect = "point", key="hr",
truncation = 83, formula=~"OBs")
mypredict <- Distance:::predict.dsmodel(fitobs, compute=TRUE)
mypred2 <- predict(fitobs, compute = TRUE)
identical(mypredict, mypred2)
table(mypredict)
I presume the function in question should be exported in the next release.