Use R package microbenchmark
to compare the performance of C functions (rwMetropolisR
) and Cpp functions (rwMetropolisC
).
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.