gbsamplerC: A Gibbs sampler using Rcpp

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

A specific Gibbs sampler for 2 dimension (x,y) with bivariate density using Rcpp

Usage

1
gbsamplerC(m, a, b, n)

Arguments

m

numbers of sample want to generate

a

the a parameter in Beta(x+a,n-x+b)

b

the b parameter in Beta(x+a,n-x+b)

n

the n parameter in Binomial(n,y)

Value

a matrix including two random sample with dimension of (m,2)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
  dir_cpp <- '/data/cenmin/statistical computing/Rcpp/'
  sourceCpp(paste0(dir_cpp,"GBSampler.cpp"))
  set.seed(12)
  m = 10000
  a = 2
  b = 3
  n = 5
  t1 <- proc.time()
  xC <- gbsamplerC(m,a,b,n)
  t2 <- proc.time()
  t <- t2-t1
  paste0(t[3][[1]],'s') 

## End(Not run) 

mimic0127/StatComp21097 documentation built on Dec. 24, 2021, 1:28 a.m.