Description Usage Arguments Value References See Also Examples

View source: R/HS_var_select.R

The function implements two methods to perform variable selection. The first checks
whether 0 is contained in the credible set (see Van der Pas et al. (2016)). The second
is only intended for the sparse normal means problem (regression with identity matrix).
It is described in Carvalho et al. (2010). The horseshoe posterior mean can be written
as *c_i y_i*, with *y_i* the observation. A variable is selected if
*c_i ≥q c*, where *c* is a user-specified threshold.

1 2 | ```
HS.var.select(hsobject, y, method = c("intervals", "threshold"),
threshold = 0.5)
``` |

`hsobject` |
The outcome from one of the horseshoe functions |

`y` |
The data. |

`method` |
Use "intervals" to perform variable selection using the credible sets (at the level specified when creating the hsobject), "threshold" to perform variable selection using the thresholding procedure (only for the sparse normal means problem). |

`threshold` |
Threshold for the thresholding procedure. Default is 0.5. |

A vector of zeroes and ones. The ones correspond to the selected variables.

van der Pas, S.L., Szabo, B., and van der Vaart, A. (2017), Uncertainty quantification for the horseshoe (with discussion). Bayesian Analysis 12(4), 1221-1274.

van der Pas, S.L., Szabo, B., and van der Vaart A. (2017), Adaptive posterior contraction rates for the horseshoe. Electronic Journal of Statistics 10(1), 3196-3225.

Carvalho, C. M., Polson, N. G., and Scott, J. G. (2010), The Horseshoe Estimator for Sparse Signals. Biometrika 97(2), 465–480.

`horseshoe`

and `HS.normal.means`

to obtain the required
hsobject.

1 2 3 4 5 6 7 8 9 10 11 | ```
#Example with 20 signals (last 20 entries), rest is noise
truth <- c(rep(0, 80), rep(8, 20))
data <- truth + rnorm(100)
horseshoe.results <- HS.normal.means(data, method.tau = "truncatedCauchy",
method.sigma = "fixed")
#Using credible sets. Ideally, the first 80 entries are equal to 0,
#and the last 20 entries equal to 1.
HS.var.select(horseshoe.results, data, method = "intervals")
#Using thresholding. Ideally, the first 80 entries are equal to 0,
#and the last 20 entries equal to 1.
HS.var.select(horseshoe.results, data, method = "threshold")
``` |

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.