MCMC: Hamiltonian Monte Carlo (a.k.a. Hybrid Monte Carlo)

The following post presents a very good explanation of the intuition of Hamiltonian dynamics and introduction of HMC algorithm.   The random-walk behavior of many Markov Chain Monte Carlo (MCMC) algorithms makes Markov chain convergence to a target stationary distribution inefficient, resulting in slow m… Source: MCMC: Hamiltonian Monte Carlo (a.k.a. Hybrid Monte Carlo) Advertisements Continue reading MCMC: Hamiltonian Monte Carlo (a.k.a. Hybrid Monte Carlo)

Difference between prediction intervals and confidence intervals

This post provides a good explanation about the Prediction interval and confidence interval. I just forwarded it here to keep a record. The original author has many other enlightening posts about forecasting as well, which are interesting to check. One example I can think of is in simple linear regression. For example, if I give you the value of the covariate for a future point, and then we would like to predict the value of the response. The confidence interval for this response is used to cover the expected value of y. But the prediction interval is used to cover a … Continue reading Difference between prediction intervals and confidence intervals

Selected Writing Samples

I select some of my writing samples to share in this post. The topics of the writing samples range from selected statistical consulting cases to Bayesian statistics, machine learning or algorithm analysis course term project recently. I attach the pdf files of the writing samples below and if you are interested in them, please click on the links for each file and feel free to leave questions for discussion. I post them for academic and learning purposes. All copyrights are reserved by me and please do not use them for commercial purposes. Selected Statistical Consulting Cases: Project1_Redacted Project2_Redacted Selected Course … Continue reading Selected Writing Samples

Generating Graph Visualizations with pydot and Graphviz

Originally posted on The Python Haven:
Hi, for my latest college assignment I had to find a way to visualize data that is interrelated. For instance, my application generated the following data: A –> B B –> C B –> D And I needed a way to generate pretty graphs without too much headache! I am already using wxPython for the application’s UI (it saved me a lot of time, and I learned a lot in the process, even implemented my own clone of the Aero Wizard layout used in Windows Vista and 7), so I tried to look for… Continue reading Generating Graph Visualizations with pydot and Graphviz

How to convert fasta files to nexus files in R

Both .fasta and .nexus files are used to save the sequences information in phylogenetics and they are both widely used. However, for some software like MrBayes, it only reads the .nexus file. As a result, if you have a .fasta file at hand, you will need to be able to convert between different formats for files. R provides an easy way to achieve this.  We can use read.fasta() function in “seqinr” package to read the data first and then use write.nexus.data() function to write our new .nexus data. One thing worth mentioning is that the argument “format” in write.nexus.data()has two … Continue reading How to convert fasta files to nexus files in R

How to draw the pairwise marginal distribution for each pair of parameters in a grid using ggplot2

Assuming I have the posterior samples for each of the four parameters. My question is how to plot the pairwise marginal distribution on a grid of 4*4=16 with ggplot2? The easiest solution I find is to use ggpairs() from GGally package in R.  The original post is at stackoverflow. I paste the toy sample dataset named “df” which is a data.frame with four variables x, y, z, w below: The code using ggpairs() is below: You can see the plot produced by ggpairs() by clicking the following link: samplePlot The upper triangle denotes the estimated joint kernel density estimation and … Continue reading How to draw the pairwise marginal distribution for each pair of parameters in a grid using ggplot2