R/RcppExports.R

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

psi_huber <- function(x, c) {
    .Call(robustBLME_psi_huber, x, c)
}

vpsi_huber <- function(x, c, xLen) {
    .Call(robustBLME_vpsi_huber, x, c, xLen)
}

psip_huber <- function(x, c) {
    .Call(robustBLME_psip_huber, x, c)
}

dhalfCauchy <- function(x, scale, lg = FALSE) {
    .Call(robustBLME_dhalfCauchy, x, scale, lg)
}

dinvgamma <- function(x, shape, scale, lg) {
    .Call(robustBLME_dinvgamma, x, shape, scale, lg)
}

thinMat <- function(X, index) {
    .Call(robustBLME_thinMat, X, index)
}

rmvnorm <- function(mu, S, p) {
    .Call(robustBLME_rmvnorm, mu, S, p)
}

rmvnorm2 <- function(mu, lowcholS, p) {
    .Call(robustBLME_rmvnorm2, mu, lowcholS, p)
}

rmvt <- function(mu, lowcholS, p, df) {
    .Call(robustBLME_rmvt, mu, lowcholS, p, df)
}

dmvt <- function(x, mu, S, ldetS, p, df, lg) {
    .Call(robustBLME_dmvt, x, mu, S, ldetS, p, df, lg)
}

dPrior_lmm <- function(betas, log_sig2_b, log_sig2_eps, beta_stDev, sig2_scale, n_betas, log_) {
    .Call(robustBLME_dPrior_lmm, betas, log_sig2_b, log_sig2_eps, beta_stDev, sig2_scale, n_betas, log_)
}

dmvnorm_I <- function(x, h, dim_x, log_) {
    .Call(robustBLME_dmvnorm_I, x, h, dim_x, log_)
}

V_list <- function(sig2_b, sig2_eps, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, m_i) {
    .Call(robustBLME_V_list, sig2_b, sig2_eps, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, m_i)
}

#' @title Robust Restricted Likelihood Estimating Function II
#'
#' @description Robust estimating functions for a linear mixed effects model
#' based on the Restricted Likelihood. This is the robust REML proposal II
#' of Richardson & Welsh (1995).
#' @usage Psi_reml2(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b,
#'             ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n,
#'             n_betas, m_i, n, n_ind)
#' @param betas The vector of fixed effects.
#' @param sig2_b The variance of the random effects.
#' @param sig2_eps The variance of the error term.
#' @param y The matrix of the response variable. Must be a ...
#' @param Xn The matrix of covariates for the whole sample
#' @param Xnt The transposed matrix of covariates for the whole sample
#' @param ZZt_b The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the random effects
#' @param ZZt_b_ii Same as \code{ZZt_b} but the block for the ith individual
#' @param ZZt_eps The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the error term.
#' @param ZZt_eps_ii Same as \code{ZZt_eps} but the block for the ith individual.
#' @param c_hub The bound for Huber's psi function for the location parameters
#' @param c2_hub The bound for Huber's proposal 2 estimating function for scale parameters.
#' @param K2n The K2 matrix consitency correction on the scale parameters.
#' @param n_betas number of fixed effects
#' @param m_i number of replications
#' @param n the sample size
#' @param n_ind the number of individuals
#' @noRd
Psi_reml2 <- function(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_Psi_reml2, betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind)
}

#' @title Robust REML II Estimating Function for fixed effects
#'
#' @description Robust estimating function for the fixed effects of the linear mixed effects model
#' based on REML. This is the robust REML proposal II of Richardson & Welsh (1995).
#' @usage Psi_reml2_betas(betas, sig2_b, sig2_eps, y, Xn, ZZt_b,
#'             ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub,
#'             n_betas, m_i, n, n_ind)
#' @param betas The vector of fixed effects.
#' @param sig2_b The variance of the random effects.
#' @param sig2_eps The variance of the error term.
#' @param y The matrix of the response variable. Must be a ...
#' @param Xn The matrix of covariates for the whole sample
#' @param ZZt_b The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the random effects
#' @param ZZt_b_ii Same as \code{ZZt_b} but the block for the ith individual
#' @param ZZt_eps The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the error term.
#' @param ZZt_eps_ii Same as \code{ZZt_eps} but the block for the ith individual.
#' @param c_hub The bound for Huber's psi function for the location parameters
#' @param n_betas number of fixed effects
#' @param m_i number of replications
#' @param n the sample size
#' @param n_ind the number of individuals
#' @noRd
Psi_reml2_betas <- function(betas, sig2_b, sig2_eps, y, Xn, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_Psi_reml2_betas, betas, sig2_b, sig2_eps, y, Xn, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, n_betas, m_i, n, n_ind)
}

#' @title Robust REML II Estimating Function for the random effects
#'
#' @description Robust estimating function for the variance component of the random
#'  effects of the linear mixed effects model based on REML. This is the robust REML
#'  proposal II of Richardson & Welsh (1995).
#' @usage Psi_reml2_sig2_b(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b,
#'             ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n,
#'             n_betas, m_i, n, n_ind)
#' @param betas The vector of fixed effects.
#' @param sig2_b The variance of the random effects.
#' @param sig2_eps The variance of the error term.
#' @param y The matrix of the response variable. Must be a ...
#' @param Xn The matrix of covariates for the whole sample
#' @param Xnt The transposed matrix of covariates for the whole sample
#' @param ZZt_b The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the random effects
#' @param ZZt_b_ii Same as \code{ZZt_b} but the block for the ith individual
#' @param ZZt_eps The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the error term.
#' @param ZZt_eps_ii Same as \code{ZZt_eps} but the block for the ith individual.
#' @param c2_hub The bound for Huber's psi2 function for the variance paramerr of the random effects
#' @param K2n The K2 matrix consitency correction on the scale parameters.
#' @param n_betas number of fixed effects
#' @param m_i number of replications
#' @param n the sample size
#' @param n_ind the number of individuals
#' @noRd
Psi_reml2_sig2_b <- function(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_Psi_reml2_sig2_b, betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n, n_betas, m_i, n, n_ind)
}

#' @title Robust REML II Estimating Function for the random effects
#'
#' @description Robust estimating function for the variance of the residuals
#'  of the linear mixed effects model based on REML. This is the robust REML
#'  proposal II of Richardson & Welsh (1995).
#' @usage Psi_reml2_sig2_eps(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b,
#'             ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n,
#'             n_betas, m_i, n, n_ind)
#' @param betas The vector of fixed effects.
#' @param sig2_b The variance of the random effects.
#' @param sig2_eps The variance of the error term.
#' @param y The matrix of the response variable. Must be a ...
#' @param Xn The matrix of covariates for the whole sample
#' @param Xnt The transposed matrix of covariates for the whole sample
#' @param ZZt_b The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the random effects
#' @param ZZt_b_ii Same as \code{ZZt_b} but the block for the ith individual
#' @param ZZt_eps The matrix \eqn{$Z \times Z^t$}{Z times Z^t} for the error term.
#' @param ZZt_eps_ii Same as \code{ZZt_eps} but the block for the ith individual.
#' @param c2_hub The bound for Huber's psi2 function for the variance paramerr of the error term
#' @param K2n The K2 matrix consitency correction on the scale parameters.
#' @param n_betas number of fixed effects
#' @param m_i number of replications
#' @param n the sample size
#' @param n_ind the number of individuals
#' @noRd
Psi_reml2_sig2_eps <- function(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_Psi_reml2_sig2_eps, betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c2_hub, K2n, n_betas, m_i, n, n_ind)
}

Psi_rlmm_reml2_abc <- function(betas, V_inv, V_inv_1half, y, Xn, Xnt, ZZt_b_ii, c_hub, c2_hub, n_betas, m_i, n, n_ind, consistency_b, consistency_eps) {
    .Call(robustBLME_Psi_rlmm_reml2_abc, betas, V_inv, V_inv_1half, y, Xn, Xnt, ZZt_b_ii, c_hub, c2_hub, n_betas, m_i, n, n_ind, consistency_b, consistency_eps)
}

Psi_rlmm_reml2_ith <- function(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind, ith) {
    .Call(robustBLME_Psi_rlmm_reml2_ith, betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind, ith)
}

Psi_rlmm_reml2_alli <- function(betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_Psi_rlmm_reml2_alli, betas, sig2_b, sig2_eps, y, Xn, Xnt, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, n_betas, m_i, n, n_ind)
}

simData_rlmm <- function(betas, sig2_b, sig2_eps, Xn, ZZt_b_ii, ZZt_eps_ii, m_i, n_ind) {
    .Call(robustBLME_simData_rlmm, betas, sig2_b, sig2_eps, Xn, ZZt_b_ii, ZZt_eps_ii, m_i, n_ind)
}

ABCkern_reml2 <- function(nabc, h, y, Xn, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, param_hat, lch_prop_scale_mat, Psi_hat, chol_J_Psi_hat, prior_beta_stdev, prior_sig2_scale, thin, trace_int, m_i, n_ind) {
    .Call(robustBLME_ABCkern_reml2, nabc, h, y, Xn, ZZt_b, ZZt_b_ii, ZZt_eps, ZZt_eps_ii, c_hub, c2_hub, K2n, param_hat, lch_prop_scale_mat, Psi_hat, chol_J_Psi_hat, prior_beta_stdev, prior_sig2_scale, thin, trace_int, m_i, n_ind)
}

log_lik_lmm <- function(betas, sig2_b, sig2_eps, y, Xn, ZZt_b_ii, ZZt_eps_ii, n_betas, m_i, n, n_ind) {
    .Call(robustBLME_log_lik_lmm, betas, sig2_b, sig2_eps, y, Xn, ZZt_b_ii, ZZt_eps_ii, n_betas, m_i, n, n_ind)
}

funPsi_rls <- function(mu, sig, y, n, c1, c2, kc2) {
    .Call(robustBLME_funPsi_rls, mu, sig, y, n, c1, c2, kc2)
}

Owen_Psi <- function(mu, sig, y, n, c1, c2, kc2) {
    .Call(robustBLME_Owen_Psi, mu, sig, y, n, c1, c2, kc2)
}

Owen_Lmult <- function(lambda, mu, sig, y, n, c1, c2, kc2) {
    .Call(robustBLME_Owen_Lmult, lambda, mu, sig, y, n, c1, c2, kc2)
}

dPrior <- function(mu, lsig, muSD, sigScale, lg = FALSE) {
    .Call(robustBLME_dPrior, mu, lsig, muSD, sigScale, lg)
}

simData_rls <- function(mu, sig, n) {
    .Call(robustBLME_simData_rls, mu, sig, n)
}

ABCrls <- function(nabc, eps, y, c1, c2, kc2, hatPar, hatVcov, hatGrad, hatJinv, muSD, sigScale, thin) {
    .Call(robustBLME_ABCrls, nabc, eps, y, c1, c2, kc2, hatPar, hatVcov, hatGrad, hatJinv, muSD, sigScale, thin)
}

distPsi_rls <- function(mu_lsig, y, c1, c2, kc2) {
    .Call(robustBLME_distPsi_rls, mu_lsig, y, c1, c2, kc2)
}

post_ls <- function(mu, lsig, y, muSD, sigScale, lg = FALSE) {
    .Call(robustBLME_post_ls, mu, lsig, y, muSD, sigScale, lg)
}

Try the robustBLME package in your browser

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

robustBLME documentation built on May 1, 2019, 6:34 p.m.