R/RcppExports.R

Defines functions obsMat2deltax sim_toad rstable simulate_cell

Documented in obsMat2deltax rstable sim_toad simulate_cell

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Simulation function of the cell biology example
#'
#' @description Simulation function of the cell biology example.
#' @param x The initial matrix of cell presences of size \code{rows}
#' \eqn{\times} \code{cols}.
#' @param Pm Parameter \eqn{P_m},
#' the probability of cell movement.
#' @param Pp Parameter \eqn{P_p},
#' the probability of cell proliferation.
#' @inheritParams cell
#' @return  A \code{rows} \eqn{\times} \code{cols}
#'  \eqn{\times} \code{num_obs} array
#'   of the cell presences at times \code{1:num_obs} (not time 0).
#' @export
simulate_cell <- function(x, rows, cols, Pm, Pp, sim_iters, num_obs) {
    .Call(`_BSL_simulate_cell`, x, rows, cols, Pm, Pp, sim_iters, num_obs)
}

#' Generate a random sample from the zero-centered stable distribution
#'
#' @description Draw a sample from a symmetric, zero-centered stable distribution with
#' given scale and stability (alpha) parameters, using the CMS algorithm.
#' @param scale The scale parameter.
#' @param alpha The stability parameter.
#' @return  A random sample from the zero-centered stable distribution.
#' @keywords internal
rstable <- function(scale, alpha) {
    .Call(`_BSL_rstable`, scale, alpha)
}

#' The simulation function for the toad example
#'
#' @description The simulation function for the toad example.
#' @param params A vector of proposed model parameters, \eqn{\alpha},
#'   \eqn{gamma} and \eqn{p_0}.
#' @param ntoad The number of toads to simulate in the observation.
#' @param nday The number of days lasted of the observation.
#' @param model Which model to be used. 1 for the random return model, 2 for the nearest return model,
#'   and 3 for the distance-based return probability model.
#' @param d0 Characteristic distance for model 3. Only used if model is 3.
#' @return A data matrix.
#' @examples sim_toad(c(1.7,36,0.6), 10, 8, 1)
#' @export
sim_toad <- function(params, ntoad, nday, model = 1L, d0 = 100) {
    .Call(`_BSL_sim_toad`, params, ntoad, nday, model, d0)
}

#' Convert an observation matrix to a vector of n-day displacements
#'
#' @description Convert an observation matrix to a vector of n-day
#' displacements. This is a function for the toad example.
#' @param X The observation matrix to be converted.
#' @param lag Interger, the number of day lags to compute the displacement.
#' @return A vector of displacements.
#' @export
obsMat2deltax <- function(X, lag) {
    .Call(`_BSL_obsMat2deltax`, X, lag)
}

Try the BSL package in your browser

Any scripts or data that you put into this service are public.

BSL documentation built on Nov. 3, 2022, 9:06 a.m.