Analysis of association studies and inference of haplotypic phase using hidden Markov models