-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from DistanceDevelopment/optimist2
CRAN release mrds-3.0.0
- Loading branch information
Showing
48 changed files
with
1,881 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,22 @@ Maintainer: Laura Marshall <[email protected]> | |
License: GPL (>=2) | ||
Title: Mark-Recapture Distance Sampling | ||
LazyLoad: yes | ||
Author: Jeff Laake <[email protected]>, David Borchers | ||
<[email protected]>, Len Thomas <[email protected]>, David | ||
Miller <[email protected]>, Jon Bishop and Jonah McArthur | ||
Authors@R: c( | ||
person("Laura", "Marshall", email = "[email protected]" , role = "cre"), | ||
person("Jeff", "Laake", role = "aut"), | ||
person("David", "Miller", email = "[email protected]", role = "aut"), | ||
person("Felix", "Petersma", email = "[email protected]", role = "aut"), | ||
person("Len", "Thomas", email = "[email protected]", role = "ctb"), | ||
person("David", "Borchers", email = "[email protected]", role = "ctb"), | ||
person("Jon", "Bishop", role = "ctb"), | ||
person("Jonah", "McArthur", role = "ctb"), | ||
person("Eric", "Rexstad", email = "[email protected]", role = "rev")) | ||
Description: Animal abundance estimation via conventional, multiple covariate | ||
and mark-recapture distance sampling (CDS/MCDS/MRDS). Detection function | ||
fitting is performed via maximum likelihood. Also included are diagnostics | ||
and plotting for fitted detection functions. Abundance estimation is via a | ||
Horvitz-Thompson-like estimator. | ||
Version: 2.3.0 | ||
Version: 3.0.0 | ||
URL: https://github.com/DistanceDevelopment/mrds/ | ||
BugReports: https://github.com/DistanceDevelopment/mrds/issues | ||
Depends: | ||
|
@@ -21,12 +28,13 @@ Imports: | |
mgcv, | ||
methods, | ||
numDeriv, | ||
nloptr, | ||
Rsolnp | ||
Suggests: | ||
testthat, | ||
covr, | ||
knitr, | ||
rmarkdown, | ||
bookdown | ||
RoxygenNote: 7.2.3 | ||
RoxygenNote: 7.3.2 | ||
Encoding: UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Cosine adjustment term, not the series. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' | ||
#' @returns scalar or vector containing the cosine adjustment term for every | ||
#' value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.cos <- function(distance, scaling, adj.order) { | ||
return(cos(adj.order * pi * distance / scaling)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Hermite polynomial adjustment term, not the series. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' | ||
#' @returns scalar or vector containing the Hermite adjustment term for every | ||
#' value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.herm <- function(distance, scaling, adj.order) { | ||
return(hermite.poly((distance / scaling), adj.order)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Simple polynomial adjustment term, not the series. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' | ||
#' @returns scalar or vector containing the polynomial adjustment term for every | ||
#' value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.poly <- function(distance, scaling, adj.order) { | ||
return((distance / scaling) ^ adj.order) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#' Series of the gradient of the cosine adjustment series w.r.t. the scaled | ||
#' distance. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' @param adj.parm vector of parameters (a_j) | ||
#' @param adj.exp boolean, defaults to FALSE | ||
#' | ||
#' @return scalar or vector containing the gradient of the cosine adjustment | ||
#' series for every value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.series.grad.cos <- function(distance, scaling = 1, adj.order, | ||
adj.parm = NULL, adj.exp = FALSE){ | ||
|
||
# Check the adjustment parameters | ||
if(is.null(adj.parm)){ | ||
adj.parm <- as.vector(rep(1, length(adj.order))) | ||
} | ||
|
||
adj.order <- as.vector(adj.order) | ||
|
||
cossum <- 0 | ||
|
||
for(i in seq_along(adj.order)){ | ||
cossum <- cossum + | ||
(adj.parm[i] * -(adj.order[i] * pi * sin(adj.order[i] * pi * | ||
distance / scaling))) | ||
} | ||
|
||
# if adj.exp return exp(cossum) to keep f(x)>0 | ||
if(adj.exp){ | ||
return(exp(cossum)) | ||
}else{ | ||
return(cossum) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#' Series of the gradient of the Hermite polynomial adjustment series w.r.t. the | ||
#' scaled distance. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' @param adj.parm vector of parameters (a_j) | ||
#' @param adj.exp boolean, defaults to FALSE | ||
#' | ||
#' @return scalar or vector containing the gradient of the Hermite adjustment | ||
#' series for every value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.series.grad.herm <- function(distance, scaling = 1, adj.order, | ||
adj.parm = NULL, adj.exp = FALSE){ | ||
|
||
# Check the adjustment parameters | ||
if(is.null(adj.parm)){ | ||
adj.parm <- as.vector(rep(1, length(adj.order))) | ||
} | ||
|
||
adj.order <- as.vector(adj.order) | ||
|
||
hermsum <- 0 | ||
|
||
for(i in seq_along(adj.order)){ | ||
if (adj.order[i] - 1 == 0) { | ||
hermsum <- hermsum + | ||
(adj.parm[i] * adj.order[i] * 1) | ||
} else { | ||
hermsum <- hermsum + | ||
(adj.parm[i] * adj.order[i] * hermite.poly((distance / scaling), | ||
adj.order[i] - 1)) | ||
} | ||
} | ||
|
||
# if adj.exp return exp(hermsum) to keep f(x)>0 | ||
if(adj.exp){ | ||
return(exp(hermsum)) | ||
}else{ | ||
return(hermsum) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#' Series of the gradient of the simple polynomial adjustment series w.r.t. the | ||
#' scaled distance. | ||
#' | ||
#' For internal use only -- not to be called by 'mrds' or 'Distance' users | ||
#' directly. | ||
#' | ||
#' @param distance perpendicular distance vector/scalar | ||
#' @param scaling scale parameter | ||
#' @param adj.order the adjustment order | ||
#' @param adj.parm vector of parameters (a_j) | ||
#' @param adj.exp boolean, defaults to FALSE | ||
#' | ||
#' @return scalar or vector containing the gradient of the polynomial adjustment | ||
#' series for every value in \code{distance} argument | ||
#' | ||
#' @author Felix Petersma | ||
adj.series.grad.poly <- function(distance, scaling = 1, adj.order, | ||
adj.parm = NULL, adj.exp = FALSE){ | ||
|
||
# Check the adjustment parameters | ||
if(is.null(adj.parm)){ | ||
adj.parm <- as.vector(rep(1, length(adj.order))) | ||
} | ||
|
||
adj.order <- as.vector(adj.order) | ||
|
||
polysum <- 0 | ||
|
||
for(i in seq_along(adj.order)){ | ||
if (adj.order[i] - 1 == 0) { | ||
polysum <- polysum + | ||
(adj.parm[i] * adj.order[i] * 1) | ||
} else { | ||
polysum <- polysum + | ||
(adj.parm[i] * adj.order[i] * (distance/scaling) ^ (adj.order[i] - 1)) | ||
} | ||
} | ||
|
||
# if adj.exp return exp(polysum) to keep f(x)>0 | ||
if(adj.exp){ | ||
return(exp(polysum)) | ||
}else{ | ||
return(polysum) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.