# ebreg

The goal of ebreg is to implement a Bayesian-like approach to the high-dimensional sparse linear regression problem based on an empirical or data-dependent prior distribution, which can be used for estimation/inference on the model parameters, variable selection, and prediction of a future response.

## Installation

You can install the released version of ebreg from CRAN with:

``install.packages("ebreg")``

And the development version from GitHub with:

``````# install.packages("devtools")
devtools::install_github("antang93/Empirical-Bayes")``````

## Example

This is a basic example which shows you how to solve a common problem:

``````library(ebreg)
## basic example code
n <- 70
p <- 100
beta <- rep(1, 5)
s0 <- length(beta)
sig2 <- 1
d <- 1
log.f <- function(x) -x * (log(1) + 0.05 * log(p)) + log(x <= n)
X <- matrix(rnorm(n * p), nrow=n, ncol=p)
X.new <- matrix(rnorm(p), nrow=1, ncol=p)
y <- as.numeric(X[, 1:s0] %*% beta[1:s0]) + sqrt(sig2) * rnorm(n)

res<-ebreg(y, X, X.new, TRUE, alpha=.99, gam=.005, NULL, FALSE, igpar=c(0.01, 4), log.f, M=5000, TRUE, FALSE, .95)``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.6407278,"math_prob":0.9793564,"size":1080,"snap":"2023-14-2023-23","text_gpt3_token_len":334,"char_repetition_ratio":0.07342008,"word_repetition_ratio":0.0,"special_character_ratio":0.32777777,"punctuation_ratio":0.19313304,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9992961,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-29T13:07:59Z\",\"WARC-Record-ID\":\"<urn:uuid:00e89273-9fbf-48d3-97dc-d469cdf6c4f8>\",\"Content-Length\":\"9570\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b39c15a8-f960-4d2d-b31e-b3659e2b6fcb>\",\"WARC-Concurrent-To\":\"<urn:uuid:b89fab4d-4f2c-410e-90a3-45f717aabc33>\",\"WARC-IP-Address\":\"147.162.35.231\",\"WARC-Target-URI\":\"https://cran.stat.unipd.it/web/packages/ebreg/readme/README.html\",\"WARC-Payload-Digest\":\"sha1:UDTNGZX5CWG463BKGZZUPXC67IMR3NDS\",\"WARC-Block-Digest\":\"sha1:ZJ2H4K7JY7EO2R5JSQQ5CY3H3BNDTX4B\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224644855.6_warc_CC-MAIN-20230529105815-20230529135815-00071.warc.gz\"}"}