Description Usage Arguments Details Value

Computes the difference statistic

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

or the signed maximum statistic

*W_j = \max(Z_j, \tilde{Z}_j) \cdot \mathrm{sgn}(Z_j - \tilde{Z}_j),*

where *Z_j* and *\tilde{Z}_j* are the maximum values of
*λ* at which the jth variable and its knockoff, respectively,
enter the lasso model.

1 2 3 | ```
knockoff.stat.lasso_difference(X, X_ko, y, method = c("glmnet", "lars"), ...)
knockoff.stat.lasso_signed_max(X, X_ko, y, method = c("glmnet", "lars"), ...)
``` |

`X` |
original design matrix |

`X_ko` |
knockoff matrix |

`y` |
response vector |

`method` |
either 'glmnet' or 'lars' (see Details) |

`...` |
additional arguments specific to 'glmnet' or 'lars' (see Details) |

This function can use either the `glmnet`

or the `lars`

package to compute the lasso path. The `lars`

package computes the lasso
path exactly, while `glmnet`

approximates it using a fine grid of
*λ*'s. For large matrics, `glmnet`

can be much faster than
`lars`

. By default, `glmnet`

is used.

If `method`

is set to `'glmnet'`

, the `nlambda`

parameter can
be used to control the granularity of the grid of *λ*'s. The
default value of `nlambda`

is `5*p`

, where `p`

is the number
of columns of `X`

.

The statistic *W*

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.