This function fits a logistic regression model penalizing the size of the L2 norm of the coefficients.
plr(x, y, weights = rep(1,length(y)),
offset.subset = NULL, offset.coefficients = NULL,
lambda = 1e-4, cp = "bic")
matrix of features
binary response
optional vector of weights for observations
optional vector of indices for the predictors for which the
coefficients are preset to offset.coefficients
. If
offset.coefficients
is not NULL
, offset.subset
must be provided.
optional vector of preset coefficient values for the predictors in
offset.subset
. If offset.coefficient
is not
NULL
, offset.coefficients
must be provided.
regularization parameter for the L2 norm of the coefficients. The
minimizing criterion in plr
is
-log-likelihood+\(\lambda*\|\beta\|^2\). Default is
lambda=1e-4.
complexity parameter to be used when computing the
score. score=deviance+cp*df.
If cp="aic"
or
cp="bic",
these are converted to cp=2
or
cp=log(sample size),
respectively. Default is
cp="bic".
A plr
object is returned. predict, print,
and
summary
functions can be applied.
vector of the coefficient estimates
sandwich estimate of the covariance matrix for the coefficients
deviance of the fitted model
deviance of the null model
degrees of freedom of the fitted model
deviance + cp*df
number of observations
complexity parameter used when computing the score
fitted probabilities
linear predictors computed with the estimated coefficients
If any categorical factors are input, level - the list of level sets
- is automatically generated and returned. See step.plr
for
details of how it is generated.
We proposed using logistic regression with a quadratic penalization on
the coefficients for detecting gene interactions as described in
"Penalized Logistic Regression for Detecting Gene Interactions (2008)"
by Park and Hastie. However, this function plr
may be used for
a general purpose.
Mee Young Park and Trevor Hastie (2008) Penalized Logistic Regression for Detecting Gene Interactions
predict.plr, step.plr
# NOT RUN { n <- 100 p <- 10 x <- matrix(rnorm(n * p), nrow=n) y <- sample(c(0, 1), n, replace=TRUE) fit <- plr(x, y, lambda=1) p <- 3 z <- matrix(sample(seq(3), n * p, replace=TRUE), nrow=n) x <- data.frame(x1=factor(z[, 1]), x2=factor(z[, 2]), x3=factor(z[, 3])) y <- sample(c(0, 1), n, replace=TRUE) fit <- plr(x, y, lambda=1) # 'level' is automatically generated. Check 'fit$level'. # }