# Knockoff filter forward selection statistics

### Description

Computes the statistic

*W_j = \max(Z_j, Z_{j+p}) \cdot \mathrm{sgn}(Z_j - Z_{j+p}),*

where *Z_1,…,Z_{2p}* give the reverse order in which the 2p
variables (the originals and the knockoffs) enter the forward selection
model. See the Details for information about forward selection.

### Usage

1 2 3 | ```
knockoff.stat.fs(X, X_ko, y)
knockoff.stat.fs_omp(X, X_ko, y)
``` |

### Arguments

`X` |
original design matrix |

`X_ko` |
knockoff matrix |

`y` |
response vector |

### Details

In *forward selection*, the variables are chosen iteratively to maximize
the inner product with the residual from the previous step. The initial
residual is always `y`

. In standard forward selection
(`knockoff.stats.fs`

), the next residual is the remainder after
regressing on the selected variable; when *orthogonal matching pursuit*
is used (`knockoff.stats.fs_omp`

), the next residual is the remainder
after regressing on *all* the previously selected variables.

### Value

The statistic W