-
Notifications
You must be signed in to change notification settings - Fork 0
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 #44 from bladder-ca/new_release
preparing for CRAN release of 0.1.4
- Loading branch information
Showing
14 changed files
with
315 additions
and
11 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
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,54 @@ | ||
#' Vectorized sampling from a non homogeneous Poisson Point Process (NHPPP) from | ||
#' an interval (thinning method) with piecewise constant_majorizers (C++) | ||
#' | ||
#' Vectorized sampling from a non homogeneous Poisson Point Process (NHPPP) from | ||
#' an interval (thinning method) with piecewise constant_majorizers. | ||
#' The majorizers are step functions over equal-length time intevals. | ||
#' | ||
#' @param lambda (function) a vectorized intensity function, with one or two arguments. | ||
#' The first is time. The optional second is a named list with additional arguments. | ||
#' @param lambda_args (list) optional list of named arguments for `lambda()` | ||
#' @param Lambda_maj_matrix (matrix) for the majorizeintegrated intensity rates at the end of each interval | ||
#' @param lambda_maj_matrix (matrix) intensity rates, one per interval | ||
#' @param range_t (vector, or matrix) `t_min` and `t_max`, possibly vectorized | ||
#' @param subinterval (matrix, double) subinterval of `range_t` to sample from | ||
#' @param tol (scalar, double) tolerance for the number of events | ||
#' @param atmost1 boolean, draw at most 1 event time | ||
#' @param atmostB If not NULL, draw at most B (B>0) event times. NULL means ignore. | ||
#' | ||
#' @return a matrix of event times (columns) per draw (rows) | ||
#' NAs are structural empty spots | ||
#' @export | ||
#' | ||
#' @examples | ||
#' Z <- vdraw_intensity_step_regular( | ||
#' lambda = function(x, lambda_args = NULL) 0.1 * x, | ||
#' range_t = c(1, 10), | ||
#' lambda_maj_matrix = matrix(rep(1, 5), nrow = 1) | ||
#' ) | ||
#' @export | ||
|
||
|
||
vdraw_intensity_step_regular <- function(lambda = NULL, | ||
lambda_args = NULL, | ||
Lambda_maj_matrix = NULL, | ||
lambda_maj_matrix = NULL, | ||
range_t = NULL, | ||
subinterval = NULL, | ||
tol = 10^-6, | ||
atmost1 = FALSE, | ||
atmostB = NULL) { | ||
return( | ||
vdraw_intensity_step_regular_cpp( | ||
lambda = lambda, | ||
lambda_args = lambda_args, | ||
Lambda_maj_matrix = Lambda_maj_matrix, | ||
lambda_maj_matrix = lambda_maj_matrix, | ||
range_t = range_t, | ||
subinterval = subinterval, | ||
tol = tol, | ||
atmost1 = atmost1, | ||
atmostB = atmostB | ||
) | ||
) | ||
} |
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,49 @@ | ||
#' Vectorized sampling from a zero-truncated non homogeneous Poisson Point Process (NHPPP) from | ||
#' an interval (thinning method) with piecewise constant_majorizers | ||
#' | ||
#' Vectorized sampling from a zero-truncated non homogeneous Poisson Point Process (NHPPP) from | ||
#' an interval (thinning method) with piecewise constant_majorizers. | ||
#' The majorizers are step functions over equal-length time intevals. | ||
#' | ||
#' @param lambda (function) a vectorized intensity function, with one or two arguments. | ||
#' The first is time. The optional second is a named list with additional arguments. | ||
#' @param lambda_args (list) optional list of named arguments for `lambda()` | ||
#' @param Lambda_maj_matrix (matrix) for the majorizeintegrated intensity rates at the end of each interval | ||
#' @param lambda_maj_matrix (matrix) intensity rates, one per interval | ||
#' @param range_t (vector, or matrix) `t_min` and `t_max`, possibly vectorized | ||
#' @param tol (scalar, double) tolerance for the number of events | ||
#' @param atmost1 boolean, draw at most 1 event time | ||
#' @param ... (any) other arguments (ignored -- used for flexibility in calling from other functions) | ||
#' | ||
#' @return a matrix of event times (columns) per draw (rows) | ||
#' NAs are structural empty spots | ||
#' @export | ||
#' | ||
#' @examples | ||
#' Z <- vztdraw_intensity_step_regular( | ||
#' lambda = function(x, lambda_args = NULL) 0.1 * x, | ||
#' range_t = c(1, 10), | ||
#' lambda_maj_matrix = matrix(rep(1, 5), nrow = 1) | ||
#' ) | ||
#' @export | ||
vztdraw_intensity_step_regular <- function(lambda = NULL, | ||
lambda_args = NULL, | ||
Lambda_maj_matrix = NULL, | ||
lambda_maj_matrix = NULL, | ||
range_t = NULL, | ||
tol = 10^-6, | ||
atmost1 = FALSE, | ||
...) { | ||
return( | ||
vztdraw_intensity_step_regular_R( | ||
lambda = lambda, | ||
lambda_args = lambda_args, | ||
Lambda_maj_matrix = Lambda_maj_matrix, | ||
lambda_maj_matrix = lambda_maj_matrix, | ||
range_t = range_t, | ||
tol = tol, | ||
atmost1 = atmost1, | ||
... | ||
) | ||
) | ||
} |
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,37 @@ | ||
#' Vectorized sampling from zero-truncated NHPPPs with piecewise constant intensities | ||
#' with same interval lengths | ||
#' | ||
#' Simulate a piecewise constant-rate Poisson Point Process over `(t_min, t_max]` (inversion method) | ||
#' where the intervals have the same length (are "regular"). | ||
#' | ||
#' @param Lambda_matrix (matrix) integrated intensity rates at the end of each interval | ||
#' @param lambda_matrix (matrix) intensity rates, one per interval | ||
#' @param range_t (vector, double) `t_min` and `t_max` | ||
#' @param subinterval (vector, double) optional -- the subinterval of `range_t` to sample. If `NULL`, the whole range_t is used. | ||
#' @param atmost1 boolean, draw at most 1 event time | ||
#' @param ... (any) other arguments (ignored -- used for flexibility in calling from other functions) | ||
#' | ||
#' @return a vector of event times t | ||
#' if no events realize, it will have 0 length | ||
#' @export | ||
#' | ||
#' @examples | ||
#' x <- vztdraw_sc_step_regular(Lambda_matrix = matrix(1:5, nrow = 1)) | ||
#' @export | ||
vztdraw_sc_step_regular <- function(Lambda_matrix = NULL, | ||
lambda_matrix = NULL, | ||
range_t = c(0, 10), | ||
subinterval = NULL, | ||
atmost1 = FALSE, | ||
...) { | ||
return( | ||
vztdraw_sc_step_regular_cpp( | ||
Lambda_matrix = Lambda_matrix, | ||
lambda_matrix = lambda_matrix, | ||
range_t = range_t, | ||
subinterval = subinterval, | ||
atmost1 = atmost1, | ||
... | ||
) | ||
) | ||
} |
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
## R CMD check results | ||
|
||
0 errors | 0 warnings | 1 note | ||
0 errors | 0 warnings | 0 notes | ||
|
||
* This is a new release. | ||
|
||
* Per feedback from CRAN (Uwe Ligges) I removed file LICENSE and `+ file` from the description. | ||
* This is a new version of the package. It adds vectorized functions and many numerical tests/checks. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.