This function constructs knockoffs of variables distributed as a hidden Markov model.
knockoffHMM(X, pInit, Q, pEmit, groups = NULL, seed = 123,
cluster = NULL, display_progress = FALSE)
an integer matrix of size n-by-p containing the original variables.
an array of length K, containing the marginal distribution of the states for the first variable.
an array of size (p-1,K,K), containing a list of p-1 transition matrices between the K states of the Markov chain.
an array of size (p,M,K), containing the emission probabilities for each of the M possible emission states, from each of the K hidden states and the p variables.
an array of length p, describing the group membership of each variable (default: NULL).
an integer random seed (default: 123).
a computing cluster object created by makeCluster (default: NULL).
whether to show progress bar (default: FALSE).
An integer matrix of size n-by-p containing the knockoff variables.
Each element of the matrix X should be an integer value between 0 and M-1.
The transition matrices contained in Q are defined with the same convention as in knockoffDMC.
The emission propability matrices contained in pEmit are defined such that
sesia2019SNPknock sesia2019multiSNPknock
Other knockoffs: knockoffDMC
,
knockoffGenotypes
,
knockoffHaplotypes
# NOT RUN {
# Generate data
p=10; K=5; M=3;
pInit = rep(1/K,K)
Q = array(stats::runif((p-1)*K*K),c(p-1,K,K))
for(j in 1:(p-1)) { Q[j,,] = Q[j,,] / rowSums(Q[j,,]) }
pEmit = array(stats::runif(p*M*K),c(p,M,K))
for(j in 1:p) { pEmit[j,,] = pEmit[j,,] / rowSums(pEmit[j,,]) }
X = sampleHMM(pInit, Q, pEmit, n=20)
# Generate knockoffs
Xk = knockoffHMM(X, pInit, Q, pEmit)
# Generate group-knockoffs for groups of size 3
groups = rep(seq(p), each=3, length.out=p)
Xk = knockoffHMM(X, pInit, Q, pEmit, groups=groups)
# }
Run the code above in your browser using DataLab