## Supplement 1. R code for computing least-cost path distance and likelihood analysis of the spatial capture–recapture (SCR) model, for computing the marginal likelihood and obtaining the MLEs, and for simulation study, and a narrative walk-through in PDF format.

## File List

EDmanuscript-supplements.pdf (md5: 44eb27bf3d2ab768941365c6a9dc1d43) – R code in pdf form and extra explanation for supplement 1

leastcostpath.R (md5: f8d1a9c67e4ee10ed633937d82b68f3f) - R code for computing least-cost path distance and likelihood analysis of the SCR model

MLE.R (md5: 4a4f93a6aa444cb52f458e0dbdc80db5)- R code for computing the marginal likelihood and obtaining the MLEs

simstudy.R (md5: 1b05540b8556e498242191382ba37c1b) - R code for simulation study

## Description

The supplement demonstrates the computation of least-cost path and its use in obtaining maximum likelihood estimates of model parameters. The file Leastcostpath.R is an R script which can be executed directly (narrative walk-through is provided by the PDF file EDmanuscript-supplements.pdf). The likelihood function (in the form of an R function) is provided in the R script MLE.R. Finally, the various pieces are put together to carry-out a simulation study in the R script simstudy.R.