30.09.2014 Views

final report - probability.ca

final report - probability.ca

final report - probability.ca

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

+ # plot(ell, dim^ep*sx1/it)<br />

+ result = list(ell, accr, dim^ep * sx1/it)<br />

+ return(result)<br />

+ }<br />

Subsequently, one <strong>ca</strong>n s<strong>ca</strong>n through the returned vectors easily using the following code, which also yields<br />

theoreti<strong>ca</strong>l curves for the same example:<br />

> S<strong>ca</strong>nGam = function(it = 5e+05, dim = 50, ep = 0, n = 50) {<br />

+ ell = 10 + (1:n) * 3<br />

+ ER = 1/75<br />

+ vsd = ell/dim^ep<br />

+ a = 5<br />

+ # initialize the speed measure<br />

+ esp = 0<br />

+ for (i in (1:it)) {<br />

+ x = rgamma(2 * n, a, 1)<br />

+ y = rnorm(2 * n, x, rep(vsd^0.5, each = 2))<br />

+ eps = matrix(log(dgamma(y, a, 1)/dgamma(x, a, 1)), 2,<br />

+ n)<br />

+ # <strong>ca</strong>lculate the ratio<br />

+ eps = (eps[1, ] + eps[2, ] - ell * ER/2)/sqrt(ell * ER)<br />

+ esp = esp + pnorm(eps)<br />

+ }<br />

+ # s<strong>ca</strong>n the vectors<br />

+ ell[which.max(2 * ell * esp/it)]<br />

+ OAR = 2 * esp[which.max(2 * ell * esp/it)]/it<br />

+ plot(2 * esp/it, 2 * ell * esp/it, type = "l")<br />

+ result = list(ell, 2 * esp/it, 2 * ell * esp/it, which.max(2 *<br />

+ ell * esp/it), ellhat, OAR)<br />

+ return(result)<br />

+ }<br />

Acknowledgement. Words <strong>ca</strong>nnot express the gratitude I have for my supervisor, Professor Jeffrey S. Rosenthal. He<br />

graciously lent me this time and introduced me to the exciting field of optimal s<strong>ca</strong>ling of Monte Carlo algorithms,<br />

providing positive encouragement throughout the process. Without his guidance, none of this would have been<br />

possible.<br />

48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!