Description Usage Arguments Details Value See Also Examples

Computes the difference statistic

*W_j = |Z_j| - |\tilde{Z}_j|*

where *Z_j* and *\tilde{Z}_j* are measure the importance
of the jth variable and its knockoff, respectively, based on the
stability of their selection upon subsampling of the data.

1 2 | ```
MFKnockoffs.stat.stability_selection(X, X_k, y, fitfun = stabs::glmnet.lasso,
...)
``` |

`X` |
original design matrix (size n-by-p) |

`X_k` |
knockoff matrix (size n-by-p) |

`y` |
response vector (length n) |

`fitfun` |
fitfun a function that takes the arguments x, y as above, and additionally the number of variables to include in each model q. The function then needs to fit the model and to return a logical vector that indicates which variable was selected (among the q selected variables). The name of the function should be prefixed by 'stabs::'. |

`...` |
additional arguments specific to 'stabs' (see Details) |

This function uses the `stabs`

package to compute
variable selection stability. The selection stability of the j-th
variable is defined as its probability of being selected upon random
subsampling of the data. The default method for selecting variables
in each subsampled dataset is `stabs::glmnet.lasso_maxCoef`

.

For a complete list of the available additional arguments, see stabsel.

A vector of statistics *W* (length p)

Other statistics for knockoffs: `MFKnockoffs.stat.forward_selection`

,
`MFKnockoffs.stat.glmnet_coef_difference`

,
`MFKnockoffs.stat.glmnet_lambda_difference`

,
`MFKnockoffs.stat.lasso_coef_difference_bin`

,
`MFKnockoffs.stat.lasso_coef_difference`

,
`MFKnockoffs.stat.lasso_lambda_difference_bin`

,
`MFKnockoffs.stat.lasso_lambda_difference`

,
`MFKnockoffs.stat.random_forest`

,
`MFKnockoffs.stat.sqrt_lasso`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
p=100; n=200; k=15
mu = rep(0,p); Sigma = diag(p)
X = matrix(rnorm(n*p),n)
nonzero = sample(p, k)
beta = 3.5 * (1:p %in% nonzero)
y = X %*% beta + rnorm(n)
knockoffs = function(X) MFKnockoffs.create.gaussian(X, mu, Sigma)
# Basic usage with default arguments
result = MFKnockoffs.filter(X, y, knockoffs=knockoffs,
statistic=MFKnockoffs.stat.stability_selection)
print(result$selected)
# Advanced usage with custom arguments
foo = MFKnockoffs.stat.stability_selection
k_stat = function(X, X_k, y) foo(X, X_k, y, fitfun=stabs::lars.lasso)
result = MFKnockoffs.filter(X, y, knockoffs=knockoffs, statistic=k_stat)
print(result$selected)
``` |

MFKnockoffs documentation built on May 2, 2019, 6:33 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.