R/RcppExports.R

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

#' Fit a two-point mixture of Beta distributions
#' @param x A vector of numeric values
#' @param w A vector of two numeric values, representing the weights  
#'          of two Beta distributions. Default values are 0.5, respectively.
#' @param a0 Initial values of the alpha and beta for Beta distribution f0. 
#'        Default values are 1 and 1, respectively.
#' @param a1 Initial values of the alpha and beta for Beta distribution f1. 
#'        Default values are 0.5 and 0.5, respectively. 
#' @param precision The tolerance for convergence. Default value is 
#'        1e-6.
#' @param MaxIter The maximum iteration for the EM algorithm. Default value
#'        is 10000L.  
#' @return A list of four components, including the converged weight,
#'         parameters for Beta distribution f0, parameters for Beta distribution
#'         f1, and the convergence iteration, respectively. 
#'                  
#' @examples 
#' x0=rbeta(900,0.8,0.8)
#' x1=rbeta(100,0.2,0.2)
#' \dontrun{
#'    MBM(c(x0,x1),w=c(0.8,0.2),a0=c(1,1),a1=c(0.5,0.5))
#' }
#' 
#' @export
MBM <- function(x, w = as.numeric( c()), a0 = as.numeric( c()), a1 = as.numeric( c()), precision = 1e-6, MaxIter = 10000L) {
    .Call('_tiltmod_MBM', PACKAGE = 'tiltmod', x, w, a0, a1, precision, MaxIter)
}

#' Fit a mixture of uniform and Beta distribution
#' @param x A vector of numeric values
#' @param w A vector of two numeric values, representing the weights  
#'          of the uniform and Beta distributions. Default 
#'          values are 0.5, respectively.
#' @param a Initial values of the alpha and beta for the Beta
#'          distribution. Defaults are obtained from MOM estimators.
#' @param precision The tolerance for convergence. Default value is 
#'        1e-8.
#' @param MaxIter The maximum iteration for the EM algorithm. Default value
#'        is 10000L.  
#' @return A list of three components, including the converged weight,
#'         parameters for Beta distribution, and the convergence iteration, 
#'         respectively. 
#'                  
#' @examples 
#' x0=runif(900) 
#' x1=rbeta(100,0.5,0.5)
#' UBMM(c(x0,x1),w=c(0.8,0.2),a=c(0.7,0.8))
#' 
#' @export
UBMM <- function(x, w = as.numeric( c()), a = as.numeric( c()), precision = 1e-8, MaxIter = 10000L) {
    .Call('_tiltmod_UBMM', PACKAGE = 'tiltmod', x, w, a, precision, MaxIter)
}

# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
    .Call('_tiltmod_RcppExport_registerCCallable', PACKAGE = 'tiltmod')
})
chongma1989/tiltmod documentation built on May 7, 2019, 8:38 a.m.