Skip to content

Commit

Permalink
Check-in version of code uploaded to CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Feb 11, 2021
1 parent 6501a9a commit 17435c1
Show file tree
Hide file tree
Showing 22 changed files with 3,319 additions and 0 deletions.
24 changes: 24 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Package: bayesefa
Type: Package
Title: Bayesian Exploratory Factor
Version: 0.0.0.4
Date: 2021-02-05
Authors@R: c(
person("Albert", "Man",
email = "aman3@illinois.edu",
role = c("aut")
),
person("Steven Andrew", "Culpepper",
email = "sculpepp@illinois.edu",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4226-6176")
)
)
Description: Exploratory Bayesian factor analysis of continuous, mixed-type, and bounded continuous variables using the mode-jumping algorithm of Man and Culpepper (2020) <doi:10.1080/01621459.2020.1773833>.
License: GPL-3
Depends: R (>= 3.5.0)
Imports: Rcpp (>= 1.0.1), psych
LinkingTo: Rcpp, RcppArmadillo
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
10 changes: 10 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated by roxygen2: do not edit by hand

export(EFA_Mode_Jumper)
export(IFA_Mode_Jumper)
export(IFA_Mode_Jumper_MixedResponses)
export(min2LL_ono)
export(mixedresponse_posterior_prediction)
export(proposal2)
importFrom(Rcpp,sourceCpp)
useDynLib(bayesefa, .registration = TRUE)
476 changes: 476 additions & 0 deletions R/RcppExports.R

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions R/bayesefa-internal.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Package documentation
#' @aliases bayesefa-package
#' @references
#' Man, A. & Culpepper, S. A. (2020). A mode-jumping algorithm for Bayesian factor analysis. Journal of the American Statistical Association, doi:10.1080/01621459.2020.1773833.
#'
#'
"_PACKAGE"


# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
#' @useDynLib bayesefa, .registration = TRUE
#' @importFrom Rcpp sourceCpp
## usethis namespace: end
NULL
31 changes: 31 additions & 0 deletions R/exchangerate-data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#' International Exchange Rate Dataset
#'
#' This dataset was considered by West and Harrison (1997) and
#' Lopes and West (2004). The dataset consists of n = 143 monthly
#' first-differences of the exchange rates of 6 international
#' currencies against the British pound, from Jan 1975 to Dec 1986,
#' these currencies are: US dollar (USD), Canadian dollar (CAD),
#' Japanese yen (JPY), French franc (FRF), German (deutsche) mark (DEM),
#' and the Italian lira (ITL).
#'
#' @format A 143 by 7 \code{matrix} of exchange rate time-series. The variables include:
#' \describe{
#' \item{\code{Month_Year}}{Month and year of exchange rate data.}
#' \item{\code{USD}}{US dollar}
#' \item{\code{CAD}}{Canadian dollar}
#' \item{\code{JPY}}{Japanese yen}
#' \item{\code{FRF}}{French franc}
#' \item{\code{DEM}}{German (deutsche) mark}
#' \item{\code{ITL}}{Italian lira}
#' }
#' @source
#'
#' Lopes, H. F., and West, M. (2004). Bayesian model assessment in factor analysis, Statistica Sinica, 14, 41–67.
#'
#' Man, A. & Culpepper, S. A. (2020). A mode-jumping algorithm for Bayesian factor analysis. Journal of the American Statistical Association, doi:10.1080/01621459.2020.1773833.
#'
#' West, M., and Harrison, J. (1997), Bayesian forecasting and dynamic models (2nd ed.), Berlin, Heidelberg: Springer-Verlag.
#'
#' @author Steven Culpepper
#'
"exchangerate"
Binary file added data/exchangerate.rda
Binary file not shown.
28 changes: 28 additions & 0 deletions inst/include/commonEFAfunctions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <RcppArmadillo.h>

#ifndef COMMONEFAFUNCTIONS_H
#define COMMONEFAFUNCTIONS_H

Rcpp::List proposal2(arma::uvec& new_r_idx,arma::mat& lambda_mean, arma::mat& f_mean);

Rcpp::List mode_jump(const arma::mat& X, arma::mat& lambda_mean, arma::mat& f_mean,
arma::mat& invClam, const arma::vec sigma, arma::uvec r_idx, double my_gamma);

arma::mat rmvnorm(unsigned int n, const arma::vec& mu, const arma::mat& S);

double sim_gamma_type(double x,double alph,double g,double d);

void update_F_matrix(const arma::mat& Y,const arma::mat& I_K,arma::mat& F,arma::mat& Lambda,
arma::vec& psis_inv);

void update_invClam(const arma::mat& Lambda,arma::mat& invClam);

arma::uvec my_setdiff(arma::uvec& x, const arma::uvec& y);

void update_Lambda_loadings_hard_zero(const arma::mat& Y,arma::uvec& r_idx,arma::mat& F,
arma::mat& Lambda,arma::vec& psis_inv,
const arma::mat invClam,double my_gamma);

arma::mat kappa_initialize(const arma::vec& Ms);

#endif
67 changes: 67 additions & 0 deletions man/EFA_Mode_Jumper.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions man/IFA_Mode_Jumper.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions man/IFA_Mode_Jumper_MixedResponses.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions man/bayesefa-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 17435c1

Please sign in to comment.