This is an example of using HMMdmdv package in R. HMMdmdv implements Hidden Markov Model for large-scale multiple testing of differential mean and variance in the framework of a proposed hierarchical mixture model. This vignette aims to demonstrate the usage of HMMdmdv through some example codes and example data.
install.packages("HMMdmdv_0.1.1.tar.gz", repos = NULL, type="source")
The example dataset has 1000 rows for 1000 test sites and 100 columns for 100 samples. In each individual test, we are comparing the first 50 samples with the second 50 samples.
library(HMMdmdv) # Loading dataset data(example_data) # Check dataset example_data[1:10, 1:8] dim(example_data) # 1000 tests, 50 samples in each group n<-1000 n1 <- 50 n2 <- 50
# remove case 3 data_df <- remove_case3(dat = example_data, mean_thresholdPV = 0.1, var_thresholdPV = 0.05, n1 = n1, n2 = n2) # parameter estimate init_para_est <- init_est(dat_df = data_df, mean_thresholdPV = 0.05, var_thresholdPV = 0.1, n1 = n1, n2 = n2, n = n)
# upper limit of EM iterations niter<-1000 # parameter estimate indep_para_est <- runEM(dat_df = data_df, n1 = n1, n2 = n2, init_para_est= init_para_est, niter = niter)
emissions <- emission_probs(indep_para_est[5], indep_para_est[6], indep_para_est[7], indep_para_est[8], example_data, n1 = n1, n2 = n2) head(emissions, 10)
HMM_resList <- runHMM(emissions)
result <- posterior_inference(HMM_resList[[1]], HMM_resList[[2]], train = FALSE) head(result, 10)
Details for arguments and functions can be found by typing e.g. help(package="HMMdmdv")
, ?runEM
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.