Natural history museums and herbaria collectively hold hundreds of millions of zoological, botanical, and paleontological specimens. These collections serve as the foundation for understanding the distribution of life on Earth and the basis for addressing loss of biodiversity, emerging diseases, and other pressing global problems as well as important question in ecology and evolution. One of the short comings of these kind of data is that the lack of evidence of the presence of a species in a certain region does not mean the species is truly absent there. Likewise, specimens are often misidentified, and therefore the report of a species in a locality is not always evidence that a viable population occurs there. The goal of this project is to develop a method which could be used to estimate the probability of presence of a species in a certain study region based on certain sampling effort and presence reports.

(* necessary for version 1.0):

[X] rasterLopodData(rasterN, rasterY, extSample, extDetection) *

[X] xyLopodData(xyN, xyY,nCells, extSample, extDetection)

[X] shapeLopodData(ShapeFile, fieldN, fieldY)

[ ] dfLopodData(df, fieldN, fieldY, custW)

[X] modelLopod(LopodData, varP = F, q = NULL, pmin = 0, CAR = F, nChains = 4, warmup = 2000, sampling = 1000)*

- [X] For Rasters
- [X] For Shapefiles
[ ] For DataFrames (Should this be implemented?) ``` {r}

if (q<0 & q>1){ message(“q must be NULL or between 0 and 1”) }

if (pmin<0 & pmin>1){ message(pmin must be between 0 and 1“) } ```

```
stanData = list( nSampledCells = length(LopodData@geoInfo$sampledId$cellRaster),
sampledId = LopodData@geoInfo$sampledId$cellStan,
nNotSampled = length(LopodData@geoInfo$notSampledId$cellStan),
notSampledId = LopodData@geoInfo$notSampledId$cellStan,
n = length(LopodData@geoInfo$sampledId$cellRaster)+length(LopodData@geoInfo$notSampledId$cellStan),
W_n = dim(LopodData@geoInfo$W_sparse)[1],
W_sparse = LopodData@geoInfo$W_sparse,
D_sparse = LopodData@geoInfo$D_sparse,
lambda = LopodData@geoInfo$lambda_sparse,
N = N,
y = y,
minP = pmin,
q = q
)
```

- [X] psiipq.stan *

- [X] psiip.stan *

- [X] psiipiq.stan *

- [X] psiipi.stan *

- [X] psiipq_CAR.stan *

- [X] psiip_CAR.stan *

- [X] psiipiq_CAR.stan *

- [X] psiipi_CAR.stan *

####Conditionals for all settings combinations

```
if (LopodModel@modelInfo$CAR == F) {
if (LopodModel@modelInfo$varP == F){
if (is.null(LopodModel@modelInfo$q)==T){
}
if (is.null(LopodModel@modelInfo$q)==F) {}
}
if (LopodModel@modelInfo$varP == T){
if (is.null(LopodModel@modelInfo$q)==T){}
if (is.null(LopodModel@modelInfo$q)==F) {}
}
}
if (LopodModel@modelInfo$CAR == T) {
if (LopodModel@modelInfo$varP == F){
if (is.null(LopodModel@modelInfo$q)==T){}
if (is.null(LopodModel@modelInfo$q)==F) {}
}
if (LopodModel@modelInfo$varP == T){
if (is.null(LopodModel@modelInfo$q)==T){}
if (is.null(LopodModel@modelInfo$q)==F) {}
}
}
```

- [X] lopodSummary(LopodModel, params) *

- [X] lopodDens(LopodModel, params) *

[X] lopodRaster(LopodModel, par=“psi”, value=“median”) *

[X] lopodShape(shapefle, LopodModel, par=“psi”, value=“median”, fieldname = NULL)

[ ] lopodRasterDist(LopodModel, par=“psi”, value=“median”, nIter = 100)

[ ] lopodShapeDist(shapefle, LopodModel, par=“psi”, value=“median”, fieldname = NULL, nIter = 100)

[ ] lopodPresAbs(LopodModel, par=“psi”, value=“median”, thresh=0.05)

[ ] lopodPresBG(LopodModel, par=“psi”, value=“median”, thresh=0.05)

[ ] lopodPresAbsDist(LopodModel, par=“psi”, nIter = 100)

[ ] lopodPresBGDist(LopodModel, par=“psi”, nIter = 100)