Learn R Programming

ncvreg (version 3.4-0)

perm.ncvreg: Permutation fitting for ncvreg

Description

Fits multiple penalized regression models in which the outcome is randomly permuted, thereby allowing estimation of the false inclusion rate.

Usage

perm.ncvreg(X, y, ..., permute=c("outcome", "residuals"), N=10, seed,
  trace=FALSE)

Arguments

X
The design matrix, without an intercept, as in ncvreg.
y
The response vector, as in ncvreg.
...
Additional arguments to ncvreg.
permute
What to permute. If 'outcome', the response vector, y, is permuted. If 'residuals', the residuals are permuted. This is only available for linear regression (i.e., for family='gaussian').
N
The number of permutation replications. Default is 10.
seed
You may set the seed of the random number generator in order to obtain reproducible results.
trace
If set to TRUE, perm.ncvreg will inform the user of its progress by announcing the beginning of each permutation fit. Default is FALSE.

Value

  • An object with S3 class "perm.ncvreg" containing:
  • EFThe number of variables selected at each value of lambda, averaged over the permutation fits.
  • SThe actual number of selected variables for the non-permuted data.
  • FIRThe estimated false inclusion rate (EF/S).
  • fitThe fitted ncvreg object for the original (non-permuted) data.
  • lossThe loss/deviance for each value of lambda, averaged over the permutation fits. This is an estimate of the explanatory power of the model under null conditions, and can be used to adjust the loss of the fitted model in a manner akin to the idea of an adjusted R-squared in classical regression.

Details

The function fits a penalized regression model to the actual data, then repeats the process N times with a permuted version of the response vector. This allows estimation of the expected number of variables included by chance for each value of lambda. The ratio of this expected quantity to the number of selected variables using the actual (non-permuted) response is called the false inclusion rate (FIR).

See Also

ncvreg, plot.fir, fir

Examples

Run this code
## Linear regression
data(prostate)
X <- as.matrix(prostate[,1:8])
y <- prostate$lpsa
pmfit <- perm.ncvreg(X, y)

par(mfcol=c(2,2))
plot(pmfit)
plot(pmfit, type="EF")
plot(pmfit$fit)

pmfit.r <- perm.ncvreg(X, y, permute='residuals')
plot(pmfit.r, col="red")                          # Permuting residuals is
lines(pmfit$fit$lambda, pmfit$FIR, col="gray60")  # less conservative

## Logistic regression
data(heart)
X <- as.matrix(heart[,1:9])
y <- heart$chd
pmfit <- perm.ncvreg(X, y, family="binomial")

par(mfrow=c(2,2))
plot(pmfit)
plot(pmfit, type="EF")
plot(pmfit$fit)

Run the code above in your browser using DataLab