htlr | R Documentation |
This function trains linear logistic regression models with HMC in restricted Gibbs sampling.
htlr(
X,
y,
fsel = 1:ncol(X),
stdx = TRUE,
prior = "t",
df = 1,
iter = 2000,
warmup = floor(iter/2),
thin = 1,
init = "lasso",
leap = 50,
leap.warm = floor(leap/10),
leap.stepsize = 0.3,
cut = 0.05,
verbose = FALSE,
rep.legacy = FALSE,
keep.warmup.hist = FALSE,
...
)
X |
Input matrix, of dimension nobs by nvars; each row is an observation vector. |
y |
Vector of response variables. Must be coded as non-negative integers, e.g., 1,2,...,C for C classes, label 0 is also allowed. |
fsel |
Subsets of features selected before fitting, such as by univariate screening. |
stdx |
Logical; if |
prior |
The prior to be applied to the model. Either a list of hyperparameter settings
returned by |
df |
The degree freedom of t/ghs/neg prior for coefficients. Will be ignored if the
configuration list from |
iter |
A positive integer specifying the number of iterations (including warmup). |
warmup |
A positive integer specifying the number of warmup (aka burnin).
The number of warmup iterations should not be larger than iter and the default is |
thin |
A positive integer specifying the period for saving samples. |
init |
The initial state of Markov Chain; it accepts three forms:
|
leap |
The length of leapfrog trajectory in sampling phase. |
leap.warm |
The length of leapfrog trajectory in burnin phase. |
leap.stepsize |
The integrator step size used in the Hamiltonian simulation. |
cut |
The coefficients smaller than this criteria will be fixed in each HMC updating step. |
verbose |
Logical; setting it to |
rep.legacy |
Logical; if |
keep.warmup.hist |
Warmup iterations are not recorded by default, set |
... |
Other optional parameters:
|
An object with S3 class htlr.fit
.
Longhai Li and Weixin Yao (2018). Fully Bayesian Logistic Regression with Hyper-Lasso Priors for High-dimensional Feature Selection. Journal of Statistical Computation and Simulation 2018, 88:14, 2827-2851.
set.seed(12345)
data("colon")
## fit HTLR models with selected features, note that the chain length setting is for demo only
## using t prior with 1 df and log-scale fixed to -10
fit.t <- htlr(X = colon$X, y = colon$y, fsel = 1:100,
prior = htlr_prior("t", df = 1, logw = -10),
init = "bcbc", iter = 20, thin = 1)
## using NEG prior with 1 df and log-scale fixed to -10
fit.neg <- htlr(X = colon$X, y = colon$y, fsel = 1:100,
prior = htlr_prior("neg", df = 1, logw = -10),
init = "bcbc", iter = 20, thin = 1)
## using horseshoe prior with 1 df and auto-selected log-scale
fit.ghs <- htlr(X = colon$X, y = colon$y, fsel = 1:100,
prior = "ghs", df = 1, init = "bcbc",
iter = 20, thin = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.