R/RcppExports.R

Defines functions logprior_HM_cpp loglik_HM_cpp loglik_HM_i_cpp logprior_PO_cpp loglik_PO_cpp loglik_PO_i_cpp mcmc_PO_HM_powered mcmc_PO dinvgamma bounce_limit sign categ_to_dummie dmvnorm_arma SMI_pred_biased_data SMI_post_biased_data

Documented in dmvnorm_arma SMI_post_biased_data SMI_pred_biased_data

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

#' @title SMI posterior for the biased data toy model
#' @description Calculates the posterior mean and variance of the Semi-Modular Posterior
#' @param Z Data sampled from the unbiased module
#' @param Y Data sampled from the unbiased module
#' @param sigma_z Likelihood std dev for Z
#' @param sigma_y Likelihood std dev for Y
#' @param sigma_phi Prior std dev for phi
#' @param sigma_theta Prior std dev for theta
#' @param sigma_theta_tilde Prior std dev for theta
#' @param eta Degree of influence of the unbiased module into phi
#' @export
SMI_post_biased_data <- function(Z, Y, sigma_z, sigma_y, sigma_phi, sigma_theta, sigma_theta_tilde, eta = 1) {
    .Call(`_aistats2020smi_SMI_post_biased_data`, Z, Y, sigma_z, sigma_y, sigma_phi, sigma_theta, sigma_theta_tilde, eta)
}

#' @title SMI posterior predictive distribution for the biased data toy model
#' @description Calculates the posterior mean and variance of the Semi-Modular Posterior predictive distribution
#' @param Z Data sampled from the unbiased module
#' @param Y Data sampled from the unbiased module
#' @param sigma_z Likelihood std dev for Z
#' @param sigma_y Likelihood std dev for Y
#' @param sigma_phi Prior std dev for phi
#' @param sigma_theta Prior std dev for theta
#' @param sigma_theta_tilde Prior std dev for theta
#' @param eta Degree of influence of the unbiased module into phi
#' @export
SMI_pred_biased_data <- function(Z, Y, sigma_z, sigma_y, sigma_phi, sigma_theta, sigma_theta_tilde, eta = 1) {
    .Call(`_aistats2020smi_SMI_pred_biased_data`, Z, Y, sigma_z, sigma_y, sigma_phi, sigma_theta, sigma_theta_tilde, eta)
}

#' @title Multivariate Normal Density Function
#' @description This function returns the log-density for a multivariate Gaussian distribution. Originally from: https://gallery.rcpp.org/articles/dmvnorm_arma/
#' @param x matrix of observations
#' @param mean mean vector
#' @param sigma positive definite covariance matrix
#' @param logd logical; whether log-density should be returned (default to FALSE)
#' @export
dmvnorm_arma <- function(x, mean, sigma, logd = FALSE) {
    .Call(`_aistats2020smi_dmvnorm_arma`, x, mean, sigma, logd)
}

categ_to_dummie <- function(x, categ_x) {
    .Call(`_aistats2020smi_categ_to_dummie`, x, categ_x)
}

sign <- function(val) {
    .Call(`_aistats2020smi_sign`, val)
}

bounce_limit <- function(x, a, b) {
    .Call(`_aistats2020smi_bounce_limit`, x, a, b)
}

dinvgamma <- function(x, alpha, beta, lg = 0L) {
    .Call(`_aistats2020smi_dinvgamma`, x, alpha, beta, lg)
}

mcmc_PO <- function(Y, X, X_eta, K, power_w, prior_spec, rnd_eff, n_iter, theta, theta_min_max, theta_prop_int, theta_prop_kernel, keep_ll = TRUE, check_mcmc = FALSE, verbose = FALSE, quiet = FALSE) {
    .Call(`_aistats2020smi_mcmc_PO`, Y, X, X_eta, K, power_w, prior_spec, rnd_eff, n_iter, theta, theta_min_max, theta_prop_int, theta_prop_kernel, keep_ll, check_mcmc, verbose, quiet)
}

mcmc_PO_HM_powered <- function(data_arc, data_mod, power_w_PO, power_w_HM, prior_spec_PO, prior_spec_HM, PO_site_rnd_eff, HM_site_rnd_eff, n_iter, n_warmup, n_thin, theta, theta_min_max, theta_prop_int, theta_prop_kernel, ManureLevel_imp, Rainfall_imp, imp_playpen = FALSE, gibbs_hm = TRUE, keep_imp = TRUE, keep_ll = TRUE, check_mcmc = FALSE, verbose = FALSE) {
    .Call(`_aistats2020smi_mcmc_PO_HM_powered`, data_arc, data_mod, power_w_PO, power_w_HM, prior_spec_PO, prior_spec_HM, PO_site_rnd_eff, HM_site_rnd_eff, n_iter, n_warmup, n_thin, theta, theta_min_max, theta_prop_int, theta_prop_kernel, ManureLevel_imp, Rainfall_imp, imp_playpen, gibbs_hm, keep_imp, keep_ll, check_mcmc, verbose)
}

loglik_PO_i_cpp <- function(Y, X, alpha, beta) {
    .Call(`_aistats2020smi_loglik_PO_i_cpp`, Y, X, alpha, beta)
}

loglik_PO_cpp <- function(Y, X, alpha, beta) {
    .Call(`_aistats2020smi_loglik_PO_cpp`, Y, X, alpha, beta)
}

logprior_PO_cpp <- function(alpha, beta, sigma_eta, eta, prior_spec) {
    .Call(`_aistats2020smi_logprior_PO_cpp`, alpha, beta, sigma_eta, eta, prior_spec)
}

loglik_HM_i_cpp <- function(Y, X, beta, sigma, v, ind_v) {
    .Call(`_aistats2020smi_loglik_HM_i_cpp`, Y, X, beta, sigma, v, ind_v)
}

loglik_HM_cpp <- function(Y, X, beta, sigma, v, ind_v) {
    .Call(`_aistats2020smi_loglik_HM_cpp`, Y, X, beta, sigma, v, ind_v)
}

logprior_HM_cpp <- function(beta, sigma, v, sigma_eta, eta, prior_spec) {
    .Call(`_aistats2020smi_logprior_HM_cpp`, beta, sigma, v, sigma_eta, eta, prior_spec)
}

# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
    .Call('_aistats2020smi_RcppExport_registerCCallable', PACKAGE = 'aistats2020smi')
})
christianu7/aistats2020smi documentation built on March 7, 2021, 2:40 p.m.