R/RcppExports.R

Defines functions multinomialLHC ks_pvalue compute_Pdplus_arma compute_Pdminus_arma KSdistance_groupM compute_Pdplus compute_Pdminus KSdistance_group2 KSdistance_group KSdistance_pointM KSdistance_point

Documented in compute_Pdminus compute_Pdminus_arma compute_Pdplus compute_Pdplus_arma KSdistance_group KSdistance_group2 KSdistance_groupM KSdistance_point KSdistance_pointM ks_pvalue multinomialLHC

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

#' KS distance for IID sampes drawn from a continuous distribution.
#'
#' @param sample A numeric vector of IID samples from a continuous distribution
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A list with components;
#' \item{dplus}{A value of statistic D+.}
#' \item{dminus}{A value of statistic D-.}
#' \item{d}{A value of statistic max(D-,D+).}
#' @export
KSdistance_point <- function(sample, cdf) {
    .Call('_gof4srm_KSdistance_point', PACKAGE = 'gof4srm', sample, cdf)
}

#' KS distance for IID sampes drawn from a continuous distribution.
#'
#' @param msample A numeric matrix of IID samples from a continuous distribution (m series)
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A list with components;
#' \item{dplus}{A value of statistic D+.}
#' \item{dminus}{A value of statistic D-.}
#' \item{d}{A value of statistic max(D-,D+).}
#' @export
KSdistance_pointM <- function(msample, cdf) {
    .Call('_gof4srm_KSdistance_pointM', PACKAGE = 'gof4srm', msample, cdf)
}

#' KS distance for grouped samples drawn from a continuous distribution.
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A list with components;
#' \item{dplus}{A value of statistic D+.}
#' \item{dminus}{A value of statistic D-.}
#' \item{d}{A value of statistic max(D-,D+).}
KSdistance_group <- function(ctime, count, cdf) {
    .Call('_gof4srm_KSdistance_group', PACKAGE = 'gof4srm', ctime, count, cdf)
}

#' KS distance for grouped samples drawn from a continuous distribution.
#' (experimental: We do not know this is mathematically correct or not.)
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A list with components;
#' \item{dplus}{A value of statistic D+.}
#' \item{dminus}{A value of statistic D-.}
#' \item{d}{A value of statistic max(D-,D+).}
#' @export
KSdistance_group2 <- function(ctime, count, cdf) {
    .Call('_gof4srm_KSdistance_group2', PACKAGE = 'gof4srm', ctime, count, cdf)
}

#' Compute P(C->d-) for the generalized KS statistic
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param dminus A value of d-
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A value of the probability
#' @export
compute_Pdminus <- function(ctime, count, dminus, cdf) {
    .Call('_gof4srm_compute_Pdminus', PACKAGE = 'gof4srm', ctime, count, dminus, cdf)
}

#' Compute P(D+>d+) for the generalized KS statistic
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param dplus A value of d+
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A value of the probability
#' @export
compute_Pdplus <- function(ctime, count, dplus, cdf) {
    .Call('_gof4srm_compute_Pdplus', PACKAGE = 'gof4srm', ctime, count, dplus, cdf)
}

#' KS distance for grouped samples drawn from a continuous distribution.
#'
#' @param ctime A sequence represents time slots (bins)
#' @param size An integer for the number of total samples.
#' @param sample A set of sampels drawn from the multinomial distribution.
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @return A list with components;
#' \item{dplus}{A vector of statistic D+.}
#' \item{dminus}{A vector of statistic D-.}
#' \item{d}{A vector of statistic max(D-,D+).}
#' @export
KSdistance_groupM <- function(ctime, size, sample, cdf) {
    .Call('_gof4srm_KSdistance_groupM', PACKAGE = 'gof4srm', ctime, size, sample, cdf)
}

#' Compute P(D->d-) for the generalized KS statistic
#'
#' This is an experimental function instead of compute_Pdminus.
#' This is not used yet.
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param dminus A value of d-
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @param solve A function to solve a linear equation.
#' @return A value of the probability
compute_Pdminus_arma <- function(ctime, count, dminus, cdf, solve) {
    .Call('_gof4srm_compute_Pdminus_arma', PACKAGE = 'gof4srm', ctime, count, dminus, cdf, solve)
}

#' Compute P(D+>d+) for the generalized KS statistic
#'
#' This is an experimental function instead of compute_Pdplus.
#' This is not used yet.
#'
#' @param ctime A sequence represents time slots (bins)
#' @param count A sequence indicates the number of samples falls int a bin
#' @param dplus A value of d+
#' @param cdf A function of CDF. It is allowd to get a closure.
#' @param solve A function to solve a linear equation.
#' @return A value of the probability
compute_Pdplus_arma <- function(ctime, count, dplus, cdf, solve) {
    .Call('_gof4srm_compute_Pdplus_arma', PACKAGE = 'gof4srm', ctime, count, dplus, cdf, solve)
}

#' Compute p-value of KS.
#'
#' @param d The value of d
#' @param n An integer to indicate the degree of freedom
#' @param imax An integer to indicate the maximum number of terms in the series expansion
#' @param epsi A double for tolerance error
#' @return p-value of KS
#'
ks_pvalue <- function(d, n, imax = 100000L, epsi = 1.0e-12) {
    .Call('_gof4srm_ks_pvalue', PACKAGE = 'gof4srm', d, n, imax, epsi)
}

#' Generate samples drawn from multinomial distirbution.
#'
#' This is a function to generate samples drawn from multinomial distribution fron
#' a given random sequence of LHC.
#'
#' @param n An integer indicating the number of samples.
#' @param size An integer indicating of dimenisions?
#' @param ctime A vector indicating the time instants
#' @param cdf An object of cumulative distribution function
#' @param lhc A numeric matrix generated by LHC.
multinomialLHC <- function(n, size, ctime, cdf, lhc) {
    .Call('_gof4srm_multinomialLHC', PACKAGE = 'gof4srm', n, size, ctime, cdf, lhc)
}
SwReliab/gof4srm documentation built on Dec. 18, 2021, 3:05 p.m.