Skip to contents

Bayesian Factor Analysis for Climate Trajectories (BFACT) is an R package for modeling climate data using a Bayesian implementation of a latent factor model.

Installation

You can install the development version of BFACT from GitHub:

# install.packages("devtools")
devtools::install_github("Shalenik/BFACT")

Features

  • Bayesian Factor Analysis: Fit BFACT models to climate data with customizable latent factors

  • Model Selection: Tools for selecting optimal hyperparameters

  • Posterior Simulation: Generate and analyze posterior samples

Getting Started

See the vignettes for detailed examples:

Quick Example

library(BFACT)

# Simulate data with H_true = 2 latent factors
sim <- simulate_data(H_true = 2, K = 20, T_obs = 50)

# Fit BFACT model with H = 2
fit <- fit_bfact_model(sim, H = 2, nsim = 5000)

# Extract posterior mean curve
post_mean <- posterior_mean_curve(fit)

# Plot results
plot_data_with_posterior(sim$Y, sim$z, 
                        posterior_samples = sample_posterior(fit, ncurves = 50),
                        title = "BFACT Fit")

Main Functions

Citation

If you use BFACT in your research, please cite:

[Citation information to be added]

License

[License information to be added]