Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Variable Selection Using Shrinkage Priors

License

NotificationsYou must be signed in to change notification settings

nilson01/VsusP-variable-selection-using-shrinkage-priors

Repository files navigation

Introduction

In the context of Gaussian linear models, the package proposes a solution of the variable selection problem using Shrinkage priors. First obtain a posterior distribution of the number of significant variables by clustering the significant variables and the noise coefficients and obtaining samples from this distribution using MCMC. Then, the significant variables are estimated from the posterior median of absolute beta. This approach requires only one tuning parameters and is applicable to continuous shrinkage priors as well.

R-CMD-checkCodecov test coverage

Getting Started

These instructions will install the package to your computer.

Prerequisites

In order to install the package directly from Github, you need to have thedevtools package:

install.packages("devtools")

Installation

To install the package from Github, first loaddevtools:

library(devtools)

Next, installVsusP as follows:

devtools::install_github("nilson01/VsusP")

The package can now be loaded into R and used:

library(VsusP)

Example

To provide an example of theVsusP package, we will first simulate some data:

# install.packages("MASS") # if not yet installedlibrary(MASS)set.seed(20221208)sim.XY <- function(n, p, beta) {  X <- matrix(rnorm(n * p), n, p)  Y <- as.vector(X %*% beta + rnorm(n, 0, 1))  return(list(X = X, Y = Y, beta = beta))}n <- 100p <- 20beta <- exp(rnorm(p))data <- sim.XY(n, p, beta)

The functionSequential2Means is used get the samples ofBeta andH.b.i.Beta can be calculated using different shrinkage priors and gibbs sampling technique, whereas H.b.i is the estimated number of signals corresponding to each tuning parameterb.i that is computed using S2M algorithm. If theBeta matrix is available prior, then H.b.i is recommended to be computed usingSequential2MeansBeta.

b.i <- seq(0, 1, 0.05)S2M <- Sequential2Means(X = data$X, Y = data$Y, b.i = b.i, prior = "horseshoe+", n.samples = 5000, burnin = 2000)Beta <- S2M$BetaH.b.i <- S2M$H.b.i

Then, using the result fromSequential2Means orSequential2MeansBeta, appropriate tuning parameter can be estimated using b.i Vs H.b.i plot fromOptimalHbi function.

OptimalHbi(bi = b.i, Hbi = H.b.i)

Finally, the indices of important subset of variables can be obtained usingS2MVarSelection function. The input parameterH is the optimal H.b.i value from the selected tuning parameter inOptimalHbi function. Also,Beta is the user defined matrix or the matrix derived fromSequential2Means function.

H <- 17impVariablesGLM <- S2MVarSelection(Beta, H)impVariablesGLM

There are several other variants of these functions as per input cases. For example: Sequential2MeansBeta and S2MVarSelectionV1.Check the documentation for the different functions on options and details, using e.g.,?Sequential2Means.

References

R Core Team (2022). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URLhttps://www.R-project.org/.

**Li, H., & Pati, D. (2020) ** "Variable Selection Using Shrinkage Priors." Computational Statistics & Data Analysis, 107, pp.107-119. doi:10.1016/j.csda.2020.106839.

About

Variable Selection Using Shrinkage Priors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp