R/RcppExports.R

Defines functions simZeros_rcpp simSSF_rcpp simLG_rcpp scalez rsfvec rsf nllkLG_rcpp nllkLG_norm_rcpp

Documented in nllkLG_norm_rcpp nllkLG_rcpp rsf rsfvec scalez simLG_rcpp simSSF_rcpp simZeros_rcpp

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

#' Negative log-likelihood for the local Gibbs model (C++)
#'
#' @param beta Parameters of the RSF
#' @param sigma Standard deviation parameter
#' @param ID Vector of track IDs
#' @param xy Matrix of observed locations
#' @param dt Vector of time intervals
#' @param gridc Grid for Monte Carlo integration
#' @param gridz Grid for Monte Carlo integration
#' @param cov Array of covariates (one layer for each covariate)
#' @param lim Limits of the covariate rasters.
#' @param res Resolution of the covariate rasters.
nllkLG_norm_rcpp <- function(beta, sigma, ID, xy, dt, gridc, gridz, cov, lim, res) {
    .Call('_localGibbs_nllkLG_norm_rcpp', PACKAGE = 'localGibbs', beta, sigma, ID, xy, dt, gridc, gridz, cov, lim, res)
}

#' Negative log-likelihood for the local Gibbs model (C++)
#'
#' @param beta Parameters of the RSF
#' @param shape Shape parameter of the distribution of r
#' @param rate Rate parameter of the distribution of r
#' @param ID Vector of track IDs
#' @param xy Matrix of observed locations
#' @param rdist Distribution of availability radius ("fixed", "exp", "gamma")
#' @param truncr Truncated grid for Monte Carlo integration
#' @param gridc Grid for Monte Carlo integration
#' @param gridz Grid for Monte Carlo integration
#' @param cov Array of covariates (one layer for each covariate)
#' @param lim Limits of the covariate rasters.
#' @param res Resolution of the covariate rasters.
nllkLG_rcpp <- function(beta, shape, rate, ID, xy, rdist, truncr, gridc, gridz, cov, lim, res) {
    .Call('_localGibbs_nllkLG_rcpp', PACKAGE = 'localGibbs', beta, shape, rate, ID, xy, rdist, truncr, gridc, gridz, cov, lim, res)
}

#' Resource selection function
#'
#' @param xy Location where the RSF should be evaluated
#' @param beta Vector of resource selection coefficients
#' @param cov Array of covariates (one layer for each covariate)
#' @param lim Four values: x min, x max, y min, y max
#' @param res Two values: resolution in x, and resolution in y
rsf <- function(xy, beta, cov, lim, res) {
    .Call('_localGibbs_rsf', PACKAGE = 'localGibbs', xy, beta, cov, lim, res)
}

#' Resource selection function (vectorized for xy)
#' 
#' @param xy Matrix of points where the RSF should be evaluated
#' @param beta Vector of resource selection coefficients
#' @param cov Array of covariates (one layer for each covariate)
#' @param lim Four values: x min, x max, y min, y max
#' @param res Two values: resolution in x, and resolution in y
#' 
#' @export
rsfvec <- function(xy, beta, cov, lim, res) {
    .Call('_localGibbs_rsfvec', PACKAGE = 'localGibbs', xy, beta, cov, lim, res)
}

#' Scale Monte Carlo sample of end points
#'
#' @param gridc (Non-scaled) grid of intermediate centres, as a matrix
#' with two columns.
#' @param gridz (Non-scaled) grid of end points, as a matrix with
#' two columns.
#' @param r Availability radius
#' @param xy0 Origin of step
#' @param xy1 End of step
scalez <- function(gridc, gridz, r, xy0, xy1) {
    .Call('_localGibbs_scalez', PACKAGE = 'localGibbs', gridc, gridz, r, xy0, xy1)
}

#' Simulation function (local Gibbs sampler)
#'
#' @param nbObs Number of observations
#' @param beta Vector of resource selection coefficients
#' @param allr Vector of radii for movement kernel, or standard deviations
#' if norm=TRUE (of length nbObs-1)
#' @param cov Array of covariates (one layer for each covariate)
#' @param xy0 Initial location
#' @param lim Limits of map
#' @param res Resolution of map
#' @param norm Logical (0 or 1). If TRUE, a normal transition density is used.
#' @param npts Number of potential endpoints to sample at each time step
#' @export
simLG_rcpp <- function(nbObs, beta, allr, cov, xy0, lim, res, norm, npts) {
    .Call('_localGibbs_simLG_rcpp', PACKAGE = 'localGibbs', nbObs, beta, allr, cov, xy0, lim, res, norm, npts)
}

#' SSF simulation function (Fortin et al 2005)
#' 
#' @param nbObs Number of observations
#' @param beta Vector of resource selection coefficients
#' @param xy1 First location
#' @param xy2 Second location
#' @param nzeros Number of zeros (unused steps) to sample for each step
#' @param cov Array of covariates (one layer for each covariate)
#' @param lim Limits of map
#' @param res Resolution of map
#' @param stepprobs Vector of probabilities for intervals of the range of step lengths
#' @param stepbreaks Vector of bounds for intervals of the range of step lengths
#' @param angleprobs Vector of probabilities for intervals of the range of turning angles
#' @param anglebreaks Vector of probabilities for intervals of the range of turning angles
#' 
#' @return Matrix of simulated locations
#' @export
simSSF_rcpp <- function(nbObs, beta, xy1, xy2, nzeros, cov, lim, res, stepprobs, stepbreaks, angleprobs, anglebreaks) {
    .Call('_localGibbs_simSSF_rcpp', PACKAGE = 'localGibbs', nbObs, beta, xy1, xy2, nzeros, cov, lim, res, stepprobs, stepbreaks, angleprobs, anglebreaks)
}

#' Sample zeros for SSF
#' 
#' @param nzeros Number of zeros for each observed location
#' @param xy Matrix of observed locations
#' @param stepprobs Vector of probabilities for intervals of the range of step lengths
#' @param stepbreaks Vector of bounds for intervals of the range of step lengths
#' @param angleprobs Vector of probabilities for intervals of the range of turning angles
#' @param anglebreaks Vector of probabilities for intervals of the range of turning angles
simZeros_rcpp <- function(nzeros, xy, stepprobs, stepbreaks, angleprobs, anglebreaks) {
    .Call('_localGibbs_simZeros_rcpp', PACKAGE = 'localGibbs', nzeros, xy, stepprobs, stepbreaks, angleprobs, anglebreaks)
}
TheoMichelot/localGibbs documentation built on March 24, 2022, 5:56 a.m.