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.

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

`X` |
original design matrix |

`X_ko` |
knockoff matrix |

`y` |
response vector |

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.

The statistic W

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.