R/RcppExports.R

Defines functions HyperpriorBayes EmpiricalBayes loglikeli sumC gibbsC

Documented in EmpiricalBayes gibbsC HyperpriorBayes loglikeli sumC

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

#' @title A Gibbs sampler using Rcpp
#' @description A Gibbs sampler using Rcpp
#' @param N the number of samples
#' @param thin the number of between-sample random numbers
#' @return a random sample of size \code{n}
#' @examples
#' \dontrun{
#' rnC <- gibbsC(100,10)
#' par(mfrow=c(2,1));
#' plot(rnC[,1],type='l')
#' plot(rnC[,2],type='l')
#' }
#' @export
gibbsC <- function(N, thin) {
    .Call('_StatComp21038_gibbsC', PACKAGE = 'StatComp21038', N, thin)
}

#' @title A function that can sum the value of a vector
#' @description A function that can sum the value of a vector
#' @param x the vector
#' @param p the length of x or the length we want to caculate
#' @return a double value
#' @examples
#' \dontrun{
#' r<-c(-1,-2,3)
#' p<-length(r)
#' sumC(r,p)
#' }
#' @export
sumC <- function(x, p) {
    .Call('_StatComp21038_sumC', PACKAGE = 'StatComp21038', x, p)
}

#' @title The loglikelihood function of lambda
#' @description The loglikelihood function of lambda
#' @param lambda a double value
#' @param tauinv2 the vector
#' @param p the length of tauinv2
#' @return a double value
#' @examples
#' \dontrun{
#' lambda<-1;tauinv2<-c(1,2,3);p<-length(tauinv2)
#' loglikeli(lambda,tauinv2,p)
#' }
#' @export
loglikeli <- function(lambda, tauinv2, p) {
    .Call('_StatComp21038_loglikeli', PACKAGE = 'StatComp21038', lambda, tauinv2, p)
}

#' @title Empirical Bayes method for lambda
#' @description it is an empirical bayes method to get the lambda, and we use mento carlo EM
#' @param L0 a double value
#' @param tol a double value
#' @param tauinv2 a vector
#' @param p an int value
#' @param lambda a double value
#' @return a numericvector
#' @examples
#' \dontrun{
#' L0<-0.1;tol<-10^(-3);tauinv2<-c(1,2,3);p<-3;lambda<-1
#' EmpiricalBayes(L0,tol,tauinv2,p,lambda)
#' }
#' @export
EmpiricalBayes <- function(L0, tol, tauinv2, p, lambda) {
    .Call('_StatComp21038_EmpiricalBayes', PACKAGE = 'StatComp21038', L0, tol, tauinv2, p, lambda)
}

#' @title Hyperprior method for lambda
#' @description Hyperprior method for lambda
#' @param tauinv2 a vector
#' @param r an int value
#' @param d an int value
#' @param p an int vale
#' @return a double value
#' @examples
#' \dontrun{
#' tauinv2<-c(1,2,3);r<-1;d<-1;p<-3
#' HyperpriorBayes(tauinv2,r,d,p)
#' }
#' @export
HyperpriorBayes <- function(tauinv2, r, d, p) {
    .Call('_StatComp21038_HyperpriorBayes', PACKAGE = 'StatComp21038', tauinv2, r, d, p)
}
USTCLifengLiu/StatComp21038 documentation built on Dec. 23, 2021, 10:18 p.m.