# Knockoff filter lasso statistics

### Description

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.

### Usage

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"), ...)
``` |

### Arguments

`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) |

### 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`

.

### Value

The statistic *W*