HBEST is an R package that implements the nonparametric hierarchical Bayesian spectral analysis method known as HBEST. The details of this method can be found in Lee et al. (2025). A detailed example using the function HBEST() can be found in the vignette.
A GitHub Pages static site is available to preview the documentation and vignettes: GitHub Page.
The GitHub repository contains a Dockerfile to allow users familiar with Docker to run RStudio in a local browser with HBEST already installed.
RStudio Installation
You can install the development version of HBEST from GitHub with:
# install.packages("pak")
pak::pak("llrebecca21/HBEST")Functions
This package contains user functions HBEST() and HBEST_fast(). Both functions implement the same method, but the HBEST_fast() function has slightly faster implementation. Both functions are made available to users since HBEST() is the code used in the publication Lee et al. (2025). The vignette HBEST_tutorial contains a simple walk through of the HBEST() function. The data generation functions are also available to users and details of these functions can be found in the vignette Data_generation_tutorial.
Docker Instructions
This section will walk through the steps of how to: install Docker Desktop (if user does not already have it installed); download the package repository; build the Docker image locally; run the container; open RStudio in a browser; and access the package and vignettes.
The steps below are described for MAC and Windows OS. Where steps differ, a note has been made.
Download Docker Desktop
If you do not already have Docker Desktop installed on your local computer, you can download the installer at:
For Windows users, during installation ensure WSL 2 backend is enabled when prompted.
Restart your computer if prompted and start Docker Desktop.
In your terminal (Mac) or PowerShell (Windows) check that docker is installed:
The links above walk through local installation of Docker Desktop and must be completed prior to the next steps. The creators of this project will not assist in technical issues that may arise with Docker Desktop installation or use.
Download Package Repository from GitHub
Assuming the user has already installed Docker/Docker Desktop on their local computer (only needs to be installed once), one can follow these steps to build and run a local Docker Container so that RStudio can be run through a browser with HBEST and other dependent libraries already installed.
- Download or clone the entire zipped repository
HBESTfrom https://github.com/llrebecca21/HBEST, i.e., Code > Download Zip. Save the zippedHBESTfolder to someplace you can navigate to easily with terminal commands.
For Windows users you must unzip the folder before moving to the next step.
- In your local terminal or PowerShell, navigate to where the unzipped repository folder is saved. i.e.,
replace yourfilepath above with your file path.
- Check you are in the correct directory.
You are in the correct directory if you see the items:
- Dockerfile
- DESCRIPTION
- R/
- vignettes/
Build the local Docker Image
- Build the Docker image locally:
This may take a couple of minutes. This step copies the package source into the container, installs all dependencies, and builds the vignettes.
The build was successful if you see * DONE (HBEST).
Run the Docker Container
- Run the container:
Run the following code below. It is IMPORTANT to change the changeme to a password you will remember. If you want to use the Docker container for creating a volume to have files saved after container stops, you will need to adjust the run commands shown below. This is left for the user to investigate.
The code below will allow the user to have a container that persists (can restart the container again).
In terminal (Mac) or PowerShell (Windows- remove the \ to avoid errors):
Open the Connection to RStudio
Open Docker Desktop and find the container running
hbest-rs, click the port link8787:8787. It is important that you are using a browser that supports http connections. If the port 8787 is already taken on your local computer, you will need to go into the Dockerfile and modify the last lineEXPOSE 8787to another port number.Login to RStudio with:
username: rstudio
password: the password you created when running step 4 above.
You will need to login everytime you run the container.
- Check the package is installed by running the following code in the RStudio session:
You can also view vignettes: