mlestimate {bbl} | R Documentation |
Maximum likelihood estimate
Description
Perform inference of bias and interaction parameters for a single response group
Usage
mlestimate(
xi,
weights = NULL,
qJ = NULL,
method = "pseudo",
L = NULL,
lambda = 1e-05,
lambdah = 0,
symmetrize = TRUE,
eps = 0.9,
nprint = 100,
itmax = 1e+05,
tolerance = 1e-04,
verbose = 1,
prior.count = 1,
naive = FALSE,
lz.half = FALSE
)
Arguments
xi |
Data matrix; expected to be numeric with elements ranging from
zero to positive integral upper bound |
weights |
Frequency vector of number of times each row of |
qJ |
Matrix of logicals indicating which predictor pairs are
interacting. If |
method |
|
L |
Vector of number of factor levels in each predictor. If
|
lambda |
Vector of L2 regularization parameters for
|
lambdah |
L2 parameters for |
symmetrize |
Enforce the symmetry of interaction parameters by
taking mean values of the matrix and its trace:
|
eps |
Vector of regularization parameters for |
nprint |
Frequency of printing iteration progress under |
itmax |
Maximum number of iterations for |
tolerance |
Upper bound for fractional changes in pseduo-likelihood
values before termiating iteration in |
verbose |
Verbosity level. |
prior.count |
Prior count for |
naive |
Naive Bayes inference. Equivalent to |
lz.half |
Divide interaction term in approximation to |
Details
Given numeric data matrix, either pseudo-likelihood
of mean-field theory is used to find the maximum likelihood estimate
of bias h
and interaction J
parameters. Normally
called by bbl
rather than directly.
Value
List of inferred parameters h
and J
. See
bbl
for parameter structures.
Examples
set.seed(535)
predictors <- list()
for(i in 1:5) predictors[[i]] <- c('a','c','g','t')
par <- randompar(predictors)
par
xi <- sample_xi(nsample=5000, predictors=predictors, h=par$h, J=par$J,
code_out=TRUE)
head(xi)
ps <- mlestimate(xi=xi, method='pseudo', lambda=0)
ps$h
ps$J[[1]]
mf <- mlestimate(xi=xi, method='mf', eps=0.9)
plot(x=unlist(par$h), y=unlist(ps$h), xlab='True', ylab='Inferred')
segments(x0=-2, x1=2, y0=-2, y1=2, lty=2)
points(x=unlist(par$J), y=unlist(ps$J), col='red')
points(x=unlist(par$h), y=unlist(mf$h), col='blue')
points(x=unlist(par$J), y=unlist(mf$J), col='green')