R/RcppExports.R

Defines functions theta_simulation tau_simulation sigma2_simulation marginal_d_cpp X_simulation W_simulation B_simulation

Documented in marginal_d_cpp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @title Simulate Bs
#' @param attributes Attributes of the model and the data
#' @param hyp_parm Hyperparameters of the model
#' @param data Dataset of type matrix
#' @param parm Current estimated parameters
#' @return Sample of factor loadings, B
#' @noRd
B_simulation <- function(attributes, hyp_parm, data, parm) {
    .Call(`_DIFM_B_simulation`, attributes, hyp_parm, data, parm)
}

#' @title Simulate Ws
#' @param attributes Attributes of the model and the data
#' @param hyp_parm Hyperparameters of the model
#' @param parm Current estimated parameters
#' @return Sample of evolution variance, W
#' @noRd
W_simulation <- function(attributes, hyp_parm, parm) {
    .Call(`_DIFM_W_simulation`, attributes, hyp_parm, parm)
}

#' @title Simulate Xs
#' @param attributes Attributes of the model and the data
#' @param parm Current estimated parameters
#' @return Sample of common factors, X
#' @noRd
X_simulation <- function(attributes, parm) {
    .Call(`_DIFM_X_simulation`, attributes, parm)
}

#' @title  Marginal predictive density 
#' @description  It calculates the marginal density (Lewis and Raftery, 1997) from the DIFM sample using C++.
#' @param  data The dataset
#' @param  attributes Model attributes generated from \code{difm.model.attributes}.
#' @param  hyp_parm Hyperparameters generated from \code{difm.hyp.parm}.
#' @param  Gibbs Result of Gibbs sampler from DIFM function.
#' @param  burnin Burn-in period. If not specified, one tenths of the iterations will be the burn-in period.
#' @param  verbose  Print out the process.
#'
#' @return  A list of 4 items: Laplace-Metropolis predictive density of the given DIFM, integrated likelihood, the maximum of the predictive densities and determinant of the covariance matrix of the parameters.
#' 
#' @export
marginal_d_cpp <- function(data, attributes, hyp_parm, Gibbs, burnin = -1L, verbose = TRUE) {
    .Call(`_DIFM_marginal_d_cpp`, data, attributes, hyp_parm, Gibbs, burnin, verbose)
}

#' @title Simulate sigma squared
#' @param attributes Attributes of the model and the data
#' @param hyp_parm Hyperparameters of the model
#' @param data Dataset of type matrix
#' @param parm Current estimated parameters
#' @return Sample of idiosyncratic variances, sigma squared
#' @noRd
sigma2_simulation <- function(attributes, hyp_parm, data, parm) {
    .Call(`_DIFM_sigma2_simulation`, attributes, hyp_parm, data, parm)
}

#' @title Simulate taus
#' @param attributes Attributes of the model and the data
#' @param hyp_parm Hyperparameters of the model
#' @param parm Current estimated parameters
#' @return Sample of factor loadings variance, tau
#' @noRd
tau_simulation <- function(attributes, hyp_parm, parm) {
    .Call(`_DIFM_tau_simulation`, attributes, hyp_parm, parm)
}

#' @title Simulate thetas
#' @param attributes Attributes of the model and the data
#' @param hyp_parm Hyperparameters of the model
#' @param data Dataset of type matrix
#' @param parm Current estimated parameters
#' @return Sample of temporal components, thetas
#' @noRd
theta_simulation <- function(attributes, hyp_parm, data, parm) {
    .Call(`_DIFM_theta_simulation`, attributes, hyp_parm, data, parm)
}

Try the DIFM package in your browser

Any scripts or data that you put into this service are public.

DIFM documentation built on May 29, 2024, 3:37 a.m.