Learn R Programming

BMN (version 1.02)

BMNExact: Exact inference in L1-penalized Binary Markov Model

Description

Functions to calculate a parameter estimates for L1-penalized Binary Markov Models.

Usage

BMNExact(X, rhoVec, thrCheck=1e-3, thrPseudo=1e-5, ThetaStart=NULL, verbose = FALSE, maxIter=100, timeout=60, penalize.diag=FALSE) BMNExact.single(X, rho, thrCheck=1e-3, thrPseudo=1e-5, ThetaStart=NULL, verbose = FALSE, maxIter=100, timeout=60, penalize.diag=FALSE)

Arguments

X
Input data matrix consisting of 0-1 entries. Has n rows and p columns.
rho
Value of the penalty parameter; If a non-negative p-by-p matrix is given, it is used as the penalty structure.
rhoVec
Gives all values of rho for which the solution should be calculated.
thrCheck
Error threshold at which convergence is declared.
thrPseudo
Error threshold for the interal pseudolikelihood algorithm.
ThetaStart
Starting value for Theta, has to be a p-by-p matrix.
verbose
Should status messages be printed.
maxIter
Maximum number of iteratios to run.
timeout
Number of seconds after which the procedure is stopped; for the path algorithm, this is reset for every value of rho.
penalize.diag
Should the diagonal be penalized?

Value

rho
Vector of penalty parameters sorted in increasing order.
ThetaList
A list of Theta pxp matrices, corresponding to the penalty parameters in rho.
success
A logical vector of the same length as rho. True, if the function succeeded for the corresponding value in rho.
penalize.diag
Logical. Indicates if the diagonal was penalized (same as input value penalize.diag.

Details

The function BMNExact fits a penalized pairwise binary Markov model to the data provided as matrix X for each of the elements in the penalty parameter vector rhoVec (note that rhoVec will be sorted in increasing order). Internally, the function BMNExact.single is called for each entry in rhoVec and the results are collected as described below.

See Also

BMNPseudo, BMNJT

Examples

Run this code
library(BMN)
Theta = matrix(numeric(25), ncol=5);
Theta[1,1]=0.5; Theta[2,2]=0.5; Theta[3,3]=0; Theta[4,4]= -0.5; Theta[5,5]= 0.5;
Theta[1,2]=Theta[2,1]=1; Theta[1,4]=Theta[4,1]=1; Theta[2,3]=Theta[3,2]= -1;
numSamples=1000; burnIn=100; skip=1;

simData = BMNSamples(Theta, numSamples, burnIn, skip)

rhoVec = c(0.01, 0.02, 0.03)

exactPath = BMNExact(simData, rhoVec)
exactSingle = BMNExact.single(simData, 0.02)

Run the code above in your browser using DataLab