[R-sig-teaching] Markov chain Monte Carlo

Greg Snow Greg.Snow at imail.org
Sun Nov 15 02:42:21 CET 2009


I have not seen any responses to this yet.  I don't know of an existing matrix that is freely available, but you can construct one by doing something like:

con <- url('http://www.gutenberg.org/dirs/2/6/0/2600/2600.txt')
wp <- readLines(con)
wp <- tolower(paste(wp, collapse=' '))

let <- unlist(strsplit(wp, ''))
let2 <- embed(let, 2)

my.table <- table( let2[,2], let2[,1] )
my.table2 <- sweep( my.table, 1, rowSums(my.table), FUN='/')

Of course you could do additional editing if you feel it is needed.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-sig-teaching-bounces at r-project.org [mailto:r-sig-teaching-
> bounces at r-project.org] On Behalf Of Giovanni Petris
> Sent: Wednesday, October 07, 2009 4:40 PM
> To: r-sig-teaching at r-project.org
> Subject: [R-sig-teaching] Markov chain Monte Carlo
> 
> 
> Hello all,
> 
> In a recent issue of the Bulletin of the American Mathematical
> Society, Persi Diaconis opens a review/discussion paper on MCMC with a
> nice application to cryptography and message decoding. The article is
> available online at
> 
> http://www.ams.org/bull/2009-46-02/S0273-0979-08-01238-X/S0273-0979-08-
> 01238-X.pdf
> 
> I liked the example and wanted to do something similar in my
> classes. Does any body have any suggestions? I can make up my own
> coded message, but in order to decode it I will need a matrix of first
> order transition probabilities for letters in standard English: is
> there anything like that available on line?
> 
> Thank you in advance.
> 
> Best,
> Giovanni Petris
> 
> --
> 
> Giovanni Petris  <GPetris at uark.edu>
> Associate Professor
> Department of Mathematical Sciences
> University of Arkansas - Fayetteville, AR 72701
> Ph: (479) 575-6324, 575-8630 (fax)
> http://definetti.uark.edu/~gpetris/
> 
> _______________________________________________
> R-sig-teaching at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching




More information about the R-sig-teaching mailing list