How to use a Detection Function from DISTANCE software in dsm() in R package

Skip to first unread message

May 4, 2021, 10:44:09 AMMay 4
to distance-sampling
Hi, following advice from previuos posts, I am trying to use the detection function produced by DISTANCE software in an  estimation using DSM.

I found differences in detection function estimation between R package and DISTANCE software, in spite all of my efforts to make both analyses comparable. I can´t find previous posts regarding this issue but I understand this differences comes from difference in engines optimizing results. However, in a post from Marjorie Bison from 2018 the recommendation is to use the detection model coming from DISTANCE software.

So the question is how to use a detection function in DSM coming form DISTANCE software. 

Many thanks

May 4, 2021, 11:31:44 AMMay 4
to distance-sampling
Following, I discovered a minor discrepancy in the binning for both analysis. Unifying the binning, both analysis differ in the third decimal for the estimation of p and in the four decimal in the estimation of SE(p), selecting a Half-Normal detectin function. I assume these differences as negligible. However, I would like to know how to pass a detection function from DISTANCE to the  package in the future, because more complex model fitting like Hazard Rate probably differ between engines

Len Thomas

May 4, 2021, 12:20:58 PMMay 4
Hello Aschiavini,

Good to hear that the two estimates are virtually identical when the
same data and binning are used.

It does happen that they sometimes produce different results, because
one or the other (or both) has failed to correctly maximize the
likelihood underneath the detection function model. This happens quite
rarely! Typically there are other issues with the fit in this case,
such as a big spike in the detection function, too many covariates for
the amount of data, lots of adjustment terms, etc.

Anyway, your question is well timed because we actually have a project
ongoing at the moment aimed at making improvements to the estimation
routine underlying the ds function from the Distance library in R (which
in fact calls the ddf function from the mrds library to do the fitting).
My colleague Dave Miller is leading on this. We are due to finish in
June this year, and expect to make a new release of the Distance and
mrds R packages after that.

Regarding your other question, so far as I know, one cannot readily pass
the output from the CDS or MCDS engines in Distance for Windows, with
associated measures of estimator uncertainty, into the dsm package in R.

If you do find a case where there are differences in results when
exactly the same data, binning, truncation and model are used, then a
first step would be to check the reported log likelihood for the two
results. For the CDS and MCDS engine, this is reported on the Model
Fitting page "Final Ln(likelihood) value = ". For the ds package, if
you have a fitted object called ds.model, you can get it by typing
The one that is more positive is the "correct" one. If this is the
CDS/MCDS one, you could try using the parameter estimates from this fit
as starting values for the ds function. If you do find a case where
this happens, drop me an email and I (or one of my colleagues) will show
you how -- we could then post a worked example back to the list.

I emphasize, however, that this is a pretty rare occurrence so you
should be able to trust the fits coming out of the ds function.

Best wishes, Len
> --
> 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
> <>.
> To view this discussion on the web visit
> <>.

Len Thomas @len_thom
Centre for Research into Ecological and Environmental Modelling
and School of Mathematics and Statistics
The Observatory, University of St Andrews, Scotland KY16 9LZ
Office: UK+1334-461801 Admin: UK+1334-461842

While I may be sending this email outside of my normal office hours,
I have no expectation to receive a reply outside of yours.

The University of St Andrews is a charity
registered in Scotland, No SC013532.

May 4, 2021, 12:57:28 PMMay 4
to distance-sampling
Thanks Len, fortunately our data show a very "polite" decay in detection with Distance, making indistinct to choose between Unif+cos or Heminormal.

Will take your advice in case something goes out of control.

Reply all
Reply to author
0 new messages