benchmarks: Benchmark R and Rcpp functions.

Description Examples

Description

Use R package microbenchmark to compare the performance of C functions (rwMetropolisR) and Cpp functions (rwMetropolisC).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
ts <- microbenchmark(rwC1 = rwMetropolisC(sigma[1], x0, N), 
rwC2 = rwMetropolisC(sigma[2], x0, N), 
rwC3 = rwMetropolisC(sigma[3], x0, N), 
rwC4 = rwMetropolisC(sigma[4], x0, N), 
rw1 = rwMetropolisR(sigma[1], x0, N), 
rw2 = rwMetropolisR(sigma[2], x0, N), 
rw3 = rwMetropolisR(sigma[3], x0, N), 
rw4 = rwMetropolisR(sigma[4], x0, N))
knitr::kable(summary(ts)[, c(1,3,5,6)])

## End(Not run)

Shenshiny/StatComp21010 documentation built on Dec. 23, 2021, 10:22 p.m.