| Title: | The Induced Smoothed Lasso |
|---|---|
| Description: | An implementation of the induced smoothing (IS) idea to lasso and elastic-net regularisation models, allowing estimation and inference (standard errors and Wald tests) on all the model coefficients. Any generalised linear model family can be used. The numerical core, written in C with 'BLAS' and 'LAPACK', solves the smoothed estimating equations by majorization-minimization or Newton iterations and uses low-rank matrix identities when the covariates outnumber the observations. The method is described in Cilluffo et al. (2020) <doi:10.1177/0962280219842890> and in a tutorial <doi:10.13140/RG.2.2.16360.11521>. |
| Authors: | Gianluca Sottile [aut, cre] (ORCID: <https://orcid.org/0000-0001-9347-7251>), Giovanna Cilluffo [aut], Vito M. R. Muggeo [aut] |
| Maintainer: | Gianluca Sottile <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.7.0 |
| Built: | 2026-11-27 20:13:02 UTC |
| Source: | https://github.com/gianluca-sottile/islasso |
Selects the tuning parameter lambda of an islasso() model by minimising an information
criterion (AIC, BIC/eBIC, AICc, GCV or GIC; see islasso.path() for the definitions), as an
alternative to cross-validation.
aic.islasso( object, method = c("AIC", "BIC", "AICc", "GCV", "GIC"), interval, g = 0, y, X, intercept = FALSE, family = gaussian(), alpha = 1, offset, weights, unpenalized, control = is.control(), trace = TRUE )aic.islasso( object, method = c("AIC", "BIC", "AICc", "GCV", "GIC"), interval, g = 0, y, X, intercept = FALSE, family = gaussian(), alpha = 1, offset, weights, unpenalized, control = is.control(), trace = TRUE )
object |
a fitted model of class |
method |
the criterion to minimise. |
interval |
the search interval for |
g |
numeric in [0, 1]: the parameter of the extended BIC ( |
y, X
|
response and model matrix (without the column of ones), used if |
intercept, family, alpha, offset, weights, unpenalized, control
|
as in |
trace |
logical: print the progress of the optimisation? |
The criterion is minimised over with stats::optimize(); the
degrees of freedom are the effective number of parameters (trace of the pseudo hat matrix).
The value of lambda minimising the criterion.
Gianluca Sottile [email protected]
islasso(), islasso.path(), GoF.islasso.path()
n <- 100; p <- 30 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, family = gaussian(), lambda = 5) lambda.bic <- aic.islasso(o, method = "BIC", interval = c(1, 50), trace = FALSE) o2 <- update(o, lambda = lambda.bic)n <- 100; p <- 30 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, family = gaussian(), lambda = 5) lambda.bic <- aic.islasso(o, method = "BIC", interval = c(1, 50), trace = FALSE) o2 <- update(o, lambda = lambda.bic)
Tests general linear hypotheses and computes confidence intervals for linear combinations of coefficients
from a fitted islasso model.
## S3 method for class 'islasso' anova(object, A, b = NULL, ci, ...)## S3 method for class 'islasso' anova(object, A, b = NULL, ci, ...)
object |
A fitted model object of class |
A |
Hypothesis specification. Either:
|
b |
Right-hand side vector for the null hypotheses |
ci |
Optional 2-column matrix of confidence intervals for coefficients. |
... |
Currently unused. |
The method tests the null hypothesis , where and define a linear constraint on model coefficients.
Symbolic expressions support natural syntax: coefficients may be added/subtracted, constants may be multiplied (e.g. "2 * X1 + 3 * X2 = 7").
Equations with omitted = assume zero on the right-hand side. See examples for syntax flexibility.
An object of class "anova.islasso" containing:
Estimate |
Linear combination estimates |
SE |
Standard errors |
Wald |
Wald statistics |
p-value |
Associated p-values |
Gianluca Sottile [email protected]
islasso, summary.islasso, confint.islasso,
predict.islasso, logLik.islasso, residuals.islasso
n <- 100; p <- 100 set.seed(1) beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso(y ~ . -1, data = sim$data, family = gaussian(), lambda = 10) # Test if first 5 variables sum to -7.5 anova(fit, A = c("X1 + X2 + X3 + X4 + X5 = -7.5")) # Test multiple hypotheses anova(fit, A = c("X1 + X2 + X3 + X4 + X5", "X6 + X7 + X8 + X9 + X10"), b = c(-7.5, 8.75)) # Full diagonal comparison to true coefficients anova(fit, A = diag(p), b = beta)n <- 100; p <- 100 set.seed(1) beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso(y ~ . -1, data = sim$data, family = gaussian(), lambda = 10) # Test if first 5 variables sum to -7.5 anova(fit, A = c("X1 + X2 + X3 + X4 + X5 = -7.5")) # Test multiple hypotheses anova(fit, A = c("X1 + X2 + X3 + X4 + X5", "X6 + X7 + X8 + X9 + X10"), b = c(-7.5, 8.75)) # Full diagonal comparison to true coefficients anova(fit, A = diag(p), b = beta)
This data set details a microarray experiment for 52 breast cancer patients. The binary variable status indicates whether or not the patient died of breast cancer (status = 0: did not die, status = 1: died). The other variables represent amplification or deletion of specific genes.
A data frame with 52 rows and multiple variables, including a binary status and gene-level measurements.
Unlike gene expression studies, this experiment focuses on measuring gene amplification or deletion-the number of DNA copies for a given genomic sequence. The goal is to identify key genomic markers distinguishing aggressive from non-aggressive breast cancer.
The experiment was conducted by Dr. John Bartlett and Dr. Caroline Witton in the Division of Cancer Sciences and Molecular Pathology at the University of Glasgow's Royal Infirmary.
Dr. John Bartlett and Dr. Caroline Witton, Division of Cancer Sciences and Molecular Pathology, University of Glasgow, Glasgow Royal Infirmary.
Augugliaro L., Mineo A.M. and Wit E.C. (2013). dgLARS: a differential geometric approach to sparse generalized linear models, Journal of the Royal Statistical Society. Series B, Vol 75(3), 471-498. Wit E.C. and McClure J. (2004). Statistics for Microarrays: Design, Analysis and Inference, Chichester: Wiley.
data(breast) str(breast) table(breast$status) ## Not run: fit <- islasso.path(status ~ ., data = breast, family = binomial(), alpha = 0) temp <- GoF.islasso.path(fit, plot = FALSE) lambda.aic <- temp$lambda.min["AIC"] fit.aic <- islasso(status ~ ., data = breast, family = binomial(), alpha = 0, lambda = lambda.aic) summary(fit.aic, pval = 0.05) ## End(Not run)data(breast) str(breast) table(breast$status) ## Not run: fit <- islasso.path(status ~ ., data = breast, family = binomial(), alpha = 0) temp <- GoF.islasso.path(fit, plot = FALSE) lambda.aic <- temp$lambda.min["AIC"] fit.aic <- islasso(status ~ ., data = breast, family = binomial(), alpha = 0, lambda = lambda.aic) summary(fit.aic, pval = 0.05) ## End(Not run)
islasso objectsComputes confidence intervals for islasso objects using a Wald-type approach.
## S3 method for class 'islasso' confint(object, parm, level = 0.95, type.ci = "wald", trace = TRUE, ...)## S3 method for class 'islasso' confint(object, parm, level = 0.95, type.ci = "wald", trace = TRUE, ...)
object |
A fitted model object of class |
parm |
A specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered. |
level |
The confidence level required. |
type.ci |
Character. Only Wald-type confidence intervals are implemented yet! Set |
trace |
Not used (kept for compatibility). |
... |
Additional arguments for methods. |
confint method for islasso objects
Maintainer: Gianluca Sottile [email protected]
islasso.fit, summary.islasso, residuals.islasso, logLik.islasso, predict.islasso, deviance.islasso
n <- 100; p <- 100; p1 <- 10 beta.veri <- sort(round(c(seq(0.5, 3, length.out = p1 / 2), seq(-1, -2, length.out = p1 / 2)), 2)) beta <- c(beta.veri, rep(0, p - p1)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim$data, family = gaussian()) ci <- confint(o, type.ci = "wald", parm = 1:11) ci plot(ci)n <- 100; p <- 100; p1 <- 10 beta.veri <- sort(round(c(seq(0.5, 3, length.out = p1 / 2), seq(-1, -2, length.out = p1 / 2)), 2)) beta <- c(beta.veri, rep(0, p - p1)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim$data, family = gaussian()) ci <- confint(o, type.ci = "wald", parm = 1:11) ci plot(ci)
The diabetes data frame contains 442 observations used in the Efron et al. "Least Angle Regression" paper.
A data frame with 442 rows and 3 columns:
Matrix with 10 numeric columns (standardized)
Numeric response vector
Matrix with 64 columns including interactions
The x matrix has been standardized to have unit L2 norm and zero mean in each column.
The x2 matrix extends x by adding selected interaction terms.
https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.ps
Efron, Hastie, Johnstone and Tibshirani (2003). "Least Angle Regression" (with discussion), Annals of Statistics.
data(diabetes) str(diabetes) summary(diabetes$y) ## Not run: fit <- islasso(y ~ ., data = data.frame(y = diabetes$y, diabetes$x2), family = gaussian()) summary(fit, pval = 0.05) lambda.aic <- aic.islasso(fit, interval = c(1, 100), trace = FALSE) fit.aic <- update(fit, lambda = lambda.aic) summary(fit.aic, pval = 0.05) ## End(Not run)data(diabetes) str(diabetes) summary(diabetes$y) ## Not run: fit <- islasso(y ~ ., data = data.frame(y = diabetes$y, diabetes$x2), family = gaussian()) summary(fit, pval = 0.05) lambda.aic <- aic.islasso(fit, interval = c(1, 100), trace = FALSE) fit.aic <- update(fit, lambda = lambda.aic) summary(fit.aic, pval = 0.05) ## End(Not run)
Finds, along an islasso.path() fit, the values of lambda minimising the information
criteria AIC, BIC, AICc, eBIC, GCV and GIC (see islasso.path() for their definitions).
GoF.islasso.path(object, plot = TRUE, ...)GoF.islasso.path(object, plot = TRUE, ...)
object |
a fitted model of class |
plot |
logical: should the criteria be plotted against |
... |
not used. |
The degrees of freedom are the effective number of parameters (trace of the pseudo hat matrix), which is not necessarily an integer.
A list with components
gof |
the matrix of criteria along the path; |
minimum |
the positions of the minima; |
lambda.min |
the values of |
plot |
the |
Gianluca Sottile [email protected]
islasso.path(), summary.islasso.path(), predict.islasso.path()
n <- 100; p <- 30 beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) GoF.islasso.path(fit, plot = FALSE)$lambda.minn <- 100; p <- 30 beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) GoF.islasso.path(fit, plot = FALSE)$lambda.min
Collects the parameters controlling the fitting process of islasso() and
islasso.path().
is.control( sigma2 = -1, tol = 1e-05, itmax = 1000, stand = TRUE, trace = 0, nfolds = 5, seed = NULL, adaptive = FALSE, g = 0.5, b0 = NULL, V0 = NULL, c = 0.5, inner = c("mm", "newton"), solver = c("auto", "dense", "woodbury"), ncores = 1L, ... )is.control( sigma2 = -1, tol = 1e-05, itmax = 1000, stand = TRUE, trace = 0, nfolds = 5, seed = NULL, adaptive = FALSE, g = 0.5, b0 = NULL, V0 = NULL, c = 0.5, inner = c("mm", "newton"), solver = c("auto", "dense", "woodbury"), ncores = 1L, ... )
sigma2 |
fixed value of the dispersion parameter; if negative (default) it is estimated (Pearson statistic over the residual degrees of freedom). Ignored for the binomial, Poisson and negative binomial families, where it is 1. |
tol |
tolerance of the convergence criteria (default |
itmax |
maximum number of iterations (default 1000). |
stand |
logical: should the covariates be standardised (default |
trace |
integer: 0 (default) silent, 1 compact and 2 detailed printing of the iterations. |
nfolds |
number of folds for the cross-validation used when |
seed |
optional integer seed for the cross-validation folds (the random number generator state of the session is restored afterwards). |
adaptive |
logical: adaptive lasso with weights based on the pseudo hat values (experimental). |
g |
numeric in [0, 1]: the parameter of the extended BIC ( |
b0 |
optional starting values for the coefficients (original scale, intercept first). |
V0 |
optional starting covariance matrix (or a number for its diagonal) on the
standardised scale; default |
c |
the mixture weight of the induced smoothing (default 0.5), a number in [0, 1] or a vector with one value per coefficient; a negative value means that the weights are re-estimated at each iteration. |
inner |
the algorithm solving the smoothed estimating equation at fixed standard
errors: |
solver |
linear algebra: |
ncores |
number of cores used by |
... |
further arguments, ignored (allows |
A list with the control parameters.
Gianluca Sottile [email protected]
is.control(tol = 1e-6, seed = 1)is.control(tol = 1e-6, seed = 1)
Fits regression models with a smoothed lasso (or elastic-net) penalty under the induced smoothing paradigm, which yields point estimates, standard errors and Wald tests for all the coefficients.
islasso( formula, family = gaussian, lambda, alpha = 1, data, weights, subset, offset, unpenalized, contrasts = NULL, control = is.control() ) islasso.fit( X, y, family = gaussian, lambda, alpha = 1, intercept = FALSE, weights = NULL, offset = NULL, unpenalized = NULL, control = is.control() )islasso( formula, family = gaussian, lambda, alpha = 1, data, weights, subset, offset, unpenalized, contrasts = NULL, control = is.control() ) islasso.fit( X, y, family = gaussian, lambda, alpha = 1, intercept = FALSE, weights = NULL, offset = NULL, unpenalized = NULL, control = is.control() )
formula |
a symbolic description of the model (see |
family |
the error distribution and link function: a family object, a family
function or its name. Any family accepted by |
lambda |
the tuning parameter (a non-negative number). If missing, it is chosen by
cross-validation with |
alpha |
the elastic-net mixing parameter, |
data |
an optional data frame containing the variables in the model. |
weights |
optional vector of prior weights. |
subset |
an optional vector specifying a subset of observations. |
offset |
an optional offset in the linear predictor. |
unpenalized |
names or indices (with respect to the columns of the model matrix without intercept) of the coefficients left unpenalized. The intercept is never penalized. |
contrasts |
an optional list of contrasts for the factors (see |
control |
a list of control parameters, see |
X, y
|
for |
intercept |
for |
For a fixed the lasso estimating equation
is not smooth. The induced
smoothing (IS) approach (Brown and Wang, 2005) replaces by its
expectation under the approximate sampling distribution of the estimator, modelled as the
mixture of a continuous component and a component
concentrated at zero:
where is the standard error of . The smoothed equation
admits
the derivative ,
and the covariance matrix is obtained by the sandwich formula
. Point estimates and standard errors are
computed alternately until the standard errors stabilise.
At fixed standard errors, is the gradient of a smooth convex function, which is
minimised by a monotone majorise-minimise algorithm (default) or by Newton's method with line
search (inner = "newton" in is.control()). When the number of columns exceeds twice the
number of observations, the linear algebra uses the Woodbury identity, with cost
instead of . Generalised linear models are fitted by iteratively
reweighted least squares, so any family with the usual components (linkinv, mu.eta,
variance, dev.resids) is supported.
With stand = TRUE (default in is.control()) the covariates are standardised (weighted
mean and standard deviation with divisor , as in glmnet) and the penalty
acts on the standardised coefficients; the results are reported on the original scale. The
scale of lambda is that of the deviance: .
Since the smoothed penalty is never exactly flat, no estimate is exactly zero: the Wald
statistics, rather than the point estimates, are used to judge which covariates matter.
For coefficients whose estimate is shrunk to (practically) zero the induced-smoothing
fixed point drives the standard error towards zero as well, while the Wald ratio stays
stable: their standard errors depend on the convergence tolerance and should not be used to
build confidence intervals. See vignette("islasso-methodology", package = "islasso").
An object of class "islasso", a list with components including
coefficients, se
|
estimates and standard errors on the original scale; |
dispersion |
the dispersion parameter; |
fitted.values, linear.predictors, residuals, weights, prior.weights
|
as in |
deviance, null.deviance, aic, rank, df.residual, df.null
|
deviance-based summaries; |
converged, iter
|
convergence flag and number of iterations; |
lambda, alpha, family, control, call, formula, terms, model, data, xlevels, contrasts, offset, y
|
the inputs; |
internal |
other internal quantities (full covariance matrix, pseudo hat values
|
Gianluca Sottile [email protected]
Cilluffo G., Sottile G., La Grutta S., Muggeo V.M.R. (2020). The induced smoothed lasso: a practical framework for hypothesis testing in high dimensional regression. Statistical Methods in Medical Research, 29(3), 765–777. doi:10.1177/0962280219842890
Sottile G., Cilluffo G., Muggeo V.M.R. (2019). The R package islasso: estimation and hypothesis testing in lasso regression. Technical report. doi:10.13140/RG.2.2.16360.11521
Brown B.M., Wang Y.G. (2005). Standard errors and covariance matrices for smoothed rank estimators. Biometrika, 92(1), 149–158. doi:10.1093/biomet/92.1.149
summary.islasso(), confint.islasso(), predict.islasso(), anova.islasso(),
plot.islasso(), aic.islasso(), relax.islasso(), islasso.path(), is.control(),
simulXy()
n <- 100; p <- 50 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, family = gaussian(), lambda = 10) summary(o, pval = 0.05) head(coef(o)) logLik(o) # lambda chosen by 5-fold cross-validation (reproducible through 'seed') o <- islasso(y ~ ., data = sim1$data, control = is.control(seed = 1)) summary(relax.islasso(o), pval = 0.05) # binomial beta <- c(1, 1, 1, rep(0, p - 3)) sim2 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, size = 100, family = binomial()) o2 <- islasso(cbind(y.success, y.failure) ~ ., data = sim2$data, family = binomial(), lambda = 5) summary(o2, pval = 0.05) # Poisson sim3 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, family = poisson()) o3 <- islasso(y ~ ., data = sim3$data, family = poisson(), lambda = 5) summary(o3, pval = 0.05) # Gamma with log link sim4 <- simulXy(n = n, p = p, beta = beta, interc = -1, seed = 1, dispersion = 0.1, family = Gamma(link = "log")) o4 <- islasso(y ~ ., data = sim4$data, family = Gamma(link = "log"), lambda = 5) summary(o4, pval = 0.05)n <- 100; p <- 50 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, family = gaussian(), lambda = 10) summary(o, pval = 0.05) head(coef(o)) logLik(o) # lambda chosen by 5-fold cross-validation (reproducible through 'seed') o <- islasso(y ~ ., data = sim1$data, control = is.control(seed = 1)) summary(relax.islasso(o), pval = 0.05) # binomial beta <- c(1, 1, 1, rep(0, p - 3)) sim2 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, size = 100, family = binomial()) o2 <- islasso(cbind(y.success, y.failure) ~ ., data = sim2$data, family = binomial(), lambda = 5) summary(o2, pval = 0.05) # Poisson sim3 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, family = poisson()) o3 <- islasso(y ~ ., data = sim3$data, family = poisson(), lambda = 5) summary(o3, pval = 0.05) # Gamma with log link sim4 <- simulXy(n = n, p = p, beta = beta, interc = -1, seed = 1, dispersion = 0.1, family = Gamma(link = "log")) o4 <- islasso(y ~ ., data = sim4$data, family = Gamma(link = "log"), lambda = 5) summary(o4, pval = 0.05)
Fits the induced smoothed lasso (or elastic net) over a grid of values of the tuning parameter, with warm starts.
islasso.path( formula, family = gaussian(), lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), alpha = 1, data, weights, subset, offset, contrasts = NULL, unpenalized, control = is.control() ) islasso.path.fit( X, y, family = gaussian(), lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(NROW(X) < NCOL(X), 0.01, 1e-04), alpha = 1, intercept = FALSE, weights = NULL, offset = NULL, unpenalized = NULL, control = is.control() )islasso.path( formula, family = gaussian(), lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), alpha = 1, data, weights, subset, offset, contrasts = NULL, unpenalized, control = is.control() ) islasso.path.fit( X, y, family = gaussian(), lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(NROW(X) < NCOL(X), 0.01, 1e-04), alpha = 1, intercept = FALSE, weights = NULL, offset = NULL, unpenalized = NULL, control = is.control() )
formula |
a symbolic description of the model (see |
family |
the error distribution and link function: a family object, a family
function or its name. Any family accepted by |
lambda |
optional vector of values of the tuning parameter; by default a sequence
of |
nlambda |
number of values of |
lambda.min.ratio |
ratio between the smallest and the largest value of |
alpha |
the elastic-net mixing parameter, |
data |
an optional data frame containing the variables in the model. |
weights |
optional vector of prior weights. |
subset |
an optional vector specifying a subset of observations. |
offset |
an optional offset in the linear predictor. |
contrasts |
an optional list of contrasts for the factors (see |
unpenalized |
names or indices (with respect to the columns of the model matrix without intercept) of the coefficients left unpenalized. The intercept is never penalized. |
control |
a list of control parameters, see |
X, y
|
for |
intercept |
for |
Each model of the path is fitted as islasso() would do at the same value of lambda
(starting values from the glmnet path, standard errors started at their default
values), so that the path and a single fit agree; with the Gaussian family the matrix
is computed once for the whole path. The models are independent and can be
fitted in parallel with control = is.control(ncores = ) (socket cluster of the 'parallel'
package; worthwhile for large problems, since starting the workers takes about a second). Every model
is kept in the output, together with its convergence flag (column conv of Info), except
those for which the algorithm failed (a warning is given).
The information criteria stored in GoF are
, ,
, ,
(with the deviance) and ,
where is the effective number of parameters (sum of the pseudo hat values) and
is replaced by the deviance when or the family has no likelihood.
An object of class "islasso.path", a list with components
Coef, SE, Weight, Gradient
|
matrices (one row per value of |
Score |
matrix of standardized scores
|
Info |
matrix with columns |
GoF |
matrix of information criteria (AIC, BIC, AICc, eBIC, GCV, GIC); |
Linear.predictors, Fitted.values, Residuals
|
matrices with one row per value of |
Input |
list with |
call, family, prior.weights, y, offset, alpha, control, formula, model, terms, data, xlevels, contrasts
|
the inputs. |
Gianluca Sottile [email protected]
Cilluffo G., Sottile G., La Grutta S., Muggeo V.M.R. (2020). The induced smoothed lasso: a practical framework for hypothesis testing in high dimensional regression. Statistical Methods in Medical Research, 29(3), 765–777. doi:10.1177/0962280219842890
plot.islasso.path(), predict.islasso.path(), summary.islasso.path(),
GoF.islasso.path(), islasso(), is.control()
n <- 100; p <- 30; p1 <- 10 beta.veri <- sort(round(c(seq(.5, 3, length.out = p1/2), seq(-1, -2, length.out = p1/2)), 2)) beta <- c(beta.veri, rep(0, p - p1)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso.path(y ~ ., data = sim1$data, family = gaussian(), nlambda = 30L) o summary(o, lambda = 10, pval = 0.05) coef(o, lambda = 10) GoF.islasso.path(o, plot = FALSE)$lambda.min plot(o, yvar = "coefficients", gof = "AIC") # standardized scores: +-1 for the relevant covariates, inside (-1, 1) for the others plot(o, yvar = "score", gof = "AIC", label = TRUE) # Poisson beta <- c(1, 1, 1, rep(0, p - 3)) sim3 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, family = poisson()) o3 <- islasso.path(y ~ ., data = sim3$data, family = poisson(), nlambda = 30L) temp <- GoF.islasso.path(o3, plot = FALSE) summary(o3, pval = 0.05, lambda = temp$lambda.min["BIC"])n <- 100; p <- 30; p1 <- 10 beta.veri <- sort(round(c(seq(.5, 3, length.out = p1/2), seq(-1, -2, length.out = p1/2)), 2)) beta <- c(beta.veri, rep(0, p - p1)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso.path(y ~ ., data = sim1$data, family = gaussian(), nlambda = 30L) o summary(o, lambda = 10, pval = 0.05) coef(o, lambda = 10) GoF.islasso.path(o, plot = FALSE)$lambda.min plot(o, yvar = "coefficients", gof = "AIC") # standardized scores: +-1 for the relevant covariates, inside (-1, 1) for the others plot(o, yvar = "score", gof = "AIC", label = TRUE) # Poisson beta <- c(1, 1, 1, rep(0, p - 3)) sim3 <- simulXy(n = n, p = p, beta = beta, interc = 1, seed = 1, family = poisson()) o3 <- islasso.path(y ~ ., data = sim3$data, family = poisson(), nlambda = 30L) temp <- GoF.islasso.path(o3, plot = FALSE) summary(o3, pval = 0.05, lambda = temp$lambda.min["BIC"])
Produces standard diagnostic plots for a fitted islasso model to assess residuals,
model fit, and variance structure.
## S3 method for class 'islasso' plot(x, ...)## S3 method for class 'islasso' plot(x, ...)
x |
An object of class |
... |
Graphical parameters: |
Draws a 2x2 grid of ggplot2 diagnostic plots:
Top-left: standardized deviance residuals (adjusted for leverage) vs linear predictor.
Top-right: normal Q-Q plot of the standardized deviance residuals (red line = reference).
Bottom-left: squared standardized Pearson residuals vs fitted values (variance function).
Bottom-right: working response vs linear predictor (link function).
The leverages are the diagonal elements of , computed
from the derivative of the smoothed estimating equation; their sum is the effective number of
parameters.
Invisibly, a list with the four ggplot objects.
Gianluca Sottile [email protected]
islasso, summary.islasso, residuals.islasso,
logLik.islasso, predict.islasso, deviance.islasso
sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) fit <- islasso(y ~ ., data = sim$data, family = gaussian(), lambda = 8) plot(fit)sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) fit <- islasso(y ~ ., data = sim$data, family = gaussian(), lambda = 8) plot(fit)
Generates plots of coefficient profiles, standard errors, gradients, weights, or goodness-of-fit criteria
from a fitted islasso.path model.
## S3 method for class 'islasso.path' plot( x, yvar = c("coefficients", "se", "score", "gradient", "weight", "gof"), gof = c("none", "AIC", "BIC", "AICc", "eBIC", "GCV", "GIC"), label = FALSE, legend = FALSE, ... )## S3 method for class 'islasso.path' plot( x, yvar = c("coefficients", "se", "score", "gradient", "weight", "gof"), gof = c("none", "AIC", "BIC", "AICc", "eBIC", "GCV", "GIC"), label = FALSE, legend = FALSE, ... )
x |
An object of class |
yvar |
Character. Specifies what to display on the y-axis. Choices are:
|
gof |
Character. Criterion used for highlighting active variables.
Choices: |
label |
Logical. Whether to annotate curves with variable names. |
legend |
Logical. Whether to display a plot legend. |
... |
Additional graphical parameters, e.g. |
This function visualizes the behavior of the solution path across a sequence of lambda values,
helping diagnose coefficient shrinkage, influence of penalty, and variable selection stability.
All the profiles are drawn against .
The standardized score of a covariate,
(computed on the
standardized scale on which the penalty acts), equals at the solution the smoothed sign
: it is close to for the covariates with sizeable effects and strictly inside
for those shrunk towards zero, as the subgradient conditions of the lasso and of the
elastic net (for it is simply ). With the
ridge penalty () there is no sign term and the score is not defined. The gradient, instead, is the residual of the smoothed
estimating equation at the solution: it is zero up to numerical precision and is useful only as
a check of convergence.
A ggplot object (printed when not assigned).
Gianluca Sottile [email protected]
islasso.path, GoF.islasso.path, summary.islasso.path,
coef.islasso.path, fitted.islasso.path, predict.islasso.path
set.seed(1) n <- 100; p <- 30 beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) plot(fit, yvar = "coefficients", gof = "AICc", label = TRUE) plot(fit, yvar = "se", gof = "AICc") plot(fit, yvar = "score", gof = "AICc") plot(fit, yvar = "gradient", gof = "AICc") plot(fit, yvar = "gof", gof = "AICc")set.seed(1) n <- 100; p <- 30 beta <- c(runif(10, -2, 2), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) plot(fit, yvar = "coefficients", gof = "AICc", label = TRUE) plot(fit, yvar = "se", gof = "AICc") plot(fit, yvar = "score", gof = "AICc") plot(fit, yvar = "gradient", gof = "AICc") plot(fit, yvar = "gof", gof = "AICc")
Computes predictions from a fitted islasso model object. Multiple output types supported, including response scale, linear predictor, and coefficient values.
## S3 method for class 'islasso' predict( object, newdata = NULL, type = c("link", "response", "coefficients", "class", "terms"), se.fit = FALSE, ci = NULL, type.ci = "wald", level = 0.95, terms = NULL, na.action = na.pass, ... )## S3 method for class 'islasso' predict( object, newdata = NULL, type = c("link", "response", "coefficients", "class", "terms"), se.fit = FALSE, ci = NULL, type.ci = "wald", level = 0.95, terms = NULL, na.action = na.pass, ... )
object |
A fitted model of class |
newdata |
Optional data frame containing predictors for prediction. If omitted, the fitted model matrix is used. |
type |
Character. Specifies the prediction scale:
|
se.fit |
Logical. If |
ci |
Optional. Precomputed matrix of confidence intervals for the coefficients (2 columns),
e.g. from |
type.ci |
Type of interval. Only |
level |
Confidence level for intervals. Default is |
terms |
If |
na.action |
Function to handle missing values in |
... |
Additional arguments passed to downstream methods. |
A numeric vector or, with se.fit = TRUE or type = "terms", a matrix.
Gianluca Sottile [email protected]
islasso, summary.islasso, logLik.islasso, residuals.islasso, deviance.islasso
set.seed(1) n <- 100; p <- 100 beta <- c(runif(20, -3, 3), rep(0, p - 20)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso(y ~ ., data = sim$data, family = gaussian(), lambda = 2) head(predict(fit, type = "response")) predict(fit, newdata = sim$data[1:3, ], se.fit = TRUE)set.seed(1) n <- 100; p <- 100 beta <- c(runif(20, -3, 3), rep(0, p - 20)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso(y ~ ., data = sim$data, family = gaussian(), lambda = 2) head(predict(fit, type = "response")) predict(fit, newdata = sim$data[1:3, ], se.fit = TRUE)
Generates predictions from a fitted islasso.path model at one or more lambda values.
Supports various output types including linear predictors, response scale, class labels, and coefficients.
## S3 method for class 'islasso.path' predict( object, newdata, type = c("link", "response", "coefficients", "class"), lambda, ... )## S3 method for class 'islasso.path' predict( object, newdata, type = c("link", "response", "coefficients", "class"), lambda, ... )
object |
A fitted model object of class |
newdata |
Optional data frame containing covariates for prediction. If omitted, returns fitted values from the original model. |
type |
Character. Type of prediction:
|
lambda |
Numeric value(s). Specific lambda value(s) at which predictions are required. If missing, predictions are computed for the full lambda sequence. |
... |
Additional arguments passed to lower-level methods. |
For values of lambda not in the path, the coefficients are linearly
interpolated on the scale.
A vector or a matrix (one column per value of lambda) depending on type.
Gianluca Sottile [email protected]
islasso.path, summary.islasso.path, coef.islasso.path,
GoF.islasso.path, fitted.islasso.path, logLik.islasso.path,
residuals.islasso.path, deviance.islasso.path
set.seed(1) n <- 100; p <- 30 beta <- c(runif(10, -3, 3), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) optimal <- GoF.islasso.path(fit, plot = FALSE) pred <- predict(fit, newdata = sim$data[1:5, ], type = "response", lambda = optimal$lambda.min[c("AIC", "BIC")]) predset.seed(1) n <- 100; p <- 30 beta <- c(runif(10, -3, 3), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) fit <- islasso.path(y ~ ., data = sim$data, family = gaussian(), nlambda = 30) optimal <- GoF.islasso.path(fit, plot = FALSE) pred <- predict(fit, newdata = sim$data[1:5, ], type = "response", lambda = optimal$lambda.min[c("AIC", "BIC")]) pred
This dataset originates from a study examining the correlation between prostate-specific antigen levels and various clinical measures in men scheduled for radical prostatectomy. It contains 97 rows and 9 variables.
A data frame with 97 observations and 9 variables:
Log of cancer volume
Log of prostate weight
Age of the patient
Log of benign prostatic hyperplasia amount
Seminal vesicle invasion (binary)
Log of capsular penetration
Gleason score
Percentage of Gleason scores 4 or 5
Log of prostate-specific antigen
Stamey, T.A., et al. (1989). Prostate specific antigen in the diagnosis and treatment of adenocarcinoma of the prostate: II. radical prostatectomy treated patients. Journal of Urology, 141(5), 1076-1083.
Stamey, T.A., Kabalin, J.N., McNeal, J.E., Johnstone, I.M., Freiha, F., Redwine, E.A., and Yang, N. (1989). Journal of Urology, 141(5), 1076-1083.
data(Prostate) summary(Prostate) cor(Prostate$lpsa, Prostate$lcavol) fit <- islasso(lpsa ~ ., data = Prostate, family = gaussian(), control = is.control(seed = 1)) summary(fit, pval = 0.05) lambda.aic <- aic.islasso(fit, method = "AIC", trace = FALSE) fit.aic <- update(fit, lambda = lambda.aic) summary(fit.aic, pval = 0.05)data(Prostate) summary(Prostate) cor(Prostate$lpsa, Prostate$lcavol) fit <- islasso(lpsa ~ ., data = Prostate, family = gaussian(), control = is.control(seed = 1)) summary(fit, pval = 0.05) lambda.aic <- aic.islasso(fit, method = "AIC", trace = FALSE) fit.aic <- update(fit, lambda = lambda.aic) summary(fit.aic, pval = 0.05)
Refits an islasso() model leaving unpenalized a subset of covariates, chosen by their
p-values or given explicitly, while the other covariates are (practically) removed by a large
penalty.
relax.islasso(fit, id = NULL, pval = 0.05, ...)relax.islasso(fit, id = NULL, pval = 0.05, ...)
fit |
a fitted model of class |
id |
optional names or indices (with respect to the covariates, intercept excluded)
of the covariates to leave unpenalized; by default those with p-value not greater than |
pval |
the significance level used when |
... |
further arguments replacing those of the original call. |
The refit uses a value of lambda equal to 100 times the smallest value that
shrinks all the penalized coefficients to zero, so that the unselected covariates have
(practically) null estimates.
An object of class "islasso".
n <- 100; p <- 30 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, lambda = 10) summary(relax.islasso(o), pval = 0.05) summary(relax.islasso(o, id = c("X1", "X2")), pval = 0.05)n <- 100; p <- 30 beta <- c(rep(1, 5), rep(0, p - 5)) sim1 <- simulXy(n = n, p = p, beta = beta, seed = 1, family = gaussian()) o <- islasso(y ~ ., data = sim1$data, lambda = 10) summary(relax.islasso(o), pval = 0.05) summary(relax.islasso(o, id = c("X1", "X2")), pval = 0.05)
Generates covariates (multivariate normal with AR(1) correlation) and a response from a Gaussian, binomial, Poisson or Gamma regression model, for simulation studies and examples.
simulXy( n, p, interc = 0, beta, family = gaussian(), prop = 0.1, lim.b = c(-3, 3), sigma = 1, size = 1, rho = 0, scale.data = TRUE, seed = NULL, X = NULL, dispersion = 0.1 )simulXy( n, p, interc = 0, beta, family = gaussian(), prop = 0.1, lim.b = c(-3, 3), sigma = 1, size = 1, rho = 0, scale.data = TRUE, seed = NULL, X = NULL, dispersion = 0.1 )
n |
number of observations. |
p |
number of covariates. |
interc |
the intercept of the linear predictor (default 0). |
beta |
vector of |
family |
a family object, function or name: |
prop |
proportion of non-null coefficients when |
lim.b |
range of the non-null coefficients when |
sigma |
standard deviation of the Gaussian response. |
size |
number of trials of the binomial response; with |
rho |
correlation parameter: |
scale.data |
logical: should the columns of the model matrix be standardised? |
seed |
optional seed; the state of the random number generator of the session is restored on exit. |
X |
optional model matrix replacing the generated one. |
dispersion |
dispersion parameter of the Gamma response (default 0.1). |
A list with components
data |
a data frame with the response |
beta0 |
the intercept; |
beta |
the regression coefficients. |
Gianluca Sottile [email protected]
n <- 100; p <- 100 beta <- c(runif(10, -3, 3), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1234) str(sim$data[, 1:5])n <- 100; p <- 100 beta <- c(runif(10, -3, 3), rep(0, p - 10)) sim <- simulXy(n = n, p = p, beta = beta, seed = 1234) str(sim$data[, 1:5])
Provides a concise summary of a fitted islasso model, including p-values and optional filtering.
## S3 method for class 'islasso' summary(object, pval = 1, which, use.t = FALSE, type.pval = "wald", ...)## S3 method for class 'islasso' summary(object, pval = 1, which, use.t = FALSE, type.pval = "wald", ...)
object |
A fitted model of class |
pval |
Numeric threshold for displaying coefficients. Only those with |
which |
Optional. Specifies a subset of coefficients to test. If missing, all parameters are evaluated. |
use.t |
Logical. If |
type.pval |
Character. Type of p-value approximation. Only |
... |
Additional arguments; |
The column Df reports the pseudo hat values , whose sum is the
effective number of parameters (see islasso). The Wald statistics are the ratios of
the estimates to their standard errors; with use.t = TRUE (Gaussian family only) the
p-values use a t distribution with the residual degrees of freedom.
An object of class "summary.islasso" containing:
coefficients |
matrix with estimates, standard errors, pseudo hat values, Wald statistics and p-values; |
dispersion, df, res, aic, lambda, nulldev, dev, df.null, df.res, family, iter
|
model summaries; |
pval |
threshold used to filter the printed coefficients; |
unpenalized |
logical vector of the unpenalized coefficients (always printed); |
call |
the original model call. |
Gianluca Sottile [email protected]
islasso.fit, residuals.islasso, logLik.islasso, predict.islasso, deviance.islasso
sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) o <- islasso(y ~ ., data = sim$data, lambda = 8) summary(o, pval = 0.1) # coefficients with p-value <= 0.1 summary(o, which = c("X1", "X4"))sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) o <- islasso(y ~ ., data = sim$data, lambda = 8) summary(o, pval = 0.1) # coefficients with p-value <= 0.1 summary(o, which = c("X1", "X4"))
Extracts coefficient estimates, standard errors and p-values from an islasso.path fit at a given regularization level lambda.
## S3 method for class 'islasso.path' summary(object, pval = 1, use.t = FALSE, lambda, ...)## S3 method for class 'islasso.path' summary(object, pval = 1, use.t = FALSE, lambda, ...)
object |
A fitted object of class |
pval |
Numeric threshold for displaying coefficients. Only variables with |
use.t |
Logical. If |
lambda |
Numeric. Value of the regularization parameter at which the summary should be extracted. |
... |
Currently unused. |
Between two values of the path, estimates, standard errors and the other quantities
are linearly interpolated on the scale.
An object of class "summary.islasso.path" containing filtered estimates and significance metrics.
Gianluca Sottile [email protected]
islasso.path, GoF.islasso.path, coef.islasso.path,
fitted.islasso.path, predict.islasso.path,
residuals.islasso.path, logLik.islasso.path,
deviance.islasso.path
sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) o <- islasso.path(y ~ ., data = sim$data, nlambda = 20) summary(o, pval = 0.1, lambda = 5)sim <- simulXy(n = 100, p = 20, beta = c(1, -1, 0.5, rep(0, 17)), seed = 1) o <- islasso.path(y ~ ., data = sim$data, nlambda = 20) summary(o, pval = 0.1, lambda = 5)