This function creates the knockoffs, computes the importance statistics,
and selects variables.
It is the main entry point for the knockoff package.
The parameter knockoffs
controls how knockoff variables are created.
By default, the model-X scenario is assumed and a multivariate normal distribution
is fitted to the original variables \(X\). The estimated mean vector and the covariance
matrix are used to generate second-order approximate Gaussian knockoffs.
In general, the function knockoffs
should take a n-by-p matrix of
observed variables \(X\) as input and return a n-by-p matrix of knockoffs.
Two default functions for creating knockoffs are provided with this package.
In the model-X scenario, under the assumption that the rows of \(X\) are distributed
as a multivariate Gaussian with known parameters, then the function
create.gaussian
can be used to generate Gaussian knockoffs,
as shown in the examples below.
In the fixed-X scenario, one can create the knockoffs using the function
create.fixed
. This requires \(n \geq p\) and it assumes
that the response \(Y\) follows a homoscedastic linear regression model.
For more information about creating knockoffs, type ??create
.
The default importance statistic is stat.glmnet_coefdiff.
For a complete list of the statistics provided with this package,
type ??stat
.
It is possible to provide custom functions for the knockoff constructions
or the importance statistics. Some examples can be found in the vignette.