# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Get marginal functional covariance matrix
#'
#' Integrate over the longitudinal dimension to obtain an nt x nt marginal
#' covariance matrix
#'
#' @param cov An ns*nt by ns*nt dimensional covariance matrix
#' @param ns Number of longitudinal points
#' @param nt Number of functional points
#' @export get_marginal_func
#' @return An nt x nt marginal functional covariance matrix
#' @examples
#' See Root/Simulation
get_marginal_func <- function(cov, ns, nt) {
.Call('_LFBayes_get_marginal_func', PACKAGE = 'LFBayes', cov, ns, nt)
}
#' Get marginal longitudinal covariance matrix
#'
#' Integrate over the functional dimension to obtain an ns x ns marginal
#' covariance matrix
#'
#' @param cov An ns*nt by ns*nt dimensional covariance matrix
#' @param ns Number of longitudinal points
#' @param nt Number of functional points
#' @export get_marginal_long
#' @return An ns x ns marginal longitudinal covariance
#' @examples
#' See Root/Simulation
get_marginal_long <- function(cov, ns, nt) {
.Call('_LFBayes_get_marginal_long', PACKAGE = 'LFBayes', cov, ns, nt)
}
#' Post-process MCMC samples
#'
#' This function will post-process posterior draws from an object returned from
#' run_mcmc.
#'
#' @param splineS basis matrix in the longitudinal direction
#' @param splineT basis matrix in the functional direction
#' @param mod an object returned from run_mcmc
#' @param numeig number of eigenfunctions to infer
#' @param iter number of total iterations in the original mcmc
#' @param burnin number of these iterations to use as burnin
#' @param nchains number of chains
#' @param s complete data longitudinal times
#' @param t complete data functional times
#' @export get_posterior_summaries
#' @return Posterior marginal eigenfunctions, eigenvalues, mean, and
#' their associated uncertainty.
#' @examples
#' See the example in Root/Example
get_posterior_summaries <- function(splineS, splineT, mod, numeig, iter, burnin, nchains, s, t, alpha) {
.Call('_LFBayes_get_posterior_summaries', PACKAGE = 'LFBayes', splineS, splineT, mod, numeig, iter, burnin, nchains, s, t, alpha)
}
#' Calculate log-likelihood
#'
#' Calculates log-likelihood after obtaining draws from the joint posterior
#' distribution. Use after running run_mcmc.
#'
#' @param y A list of of length n containing responses
#' @param X An n x p design matrix
#' @param Bs Basis matrix for longitudinal direction
#' @param Bt Basis matrix for functional direction
#' @param missing A list of length n containing missing indices for each
#' response
#' @param Theta Posterior draws of Theta, arranges in a cube
#' @param Varphi Posterior draws of Varphi, vector format
#' @param iter Number of total samples
#' @param burnin Number of samples to use as burnin
#' @export loglik
#' @return A Matrix of size (iter - burnin) x number of observed time points
#' over all subjects containing log-likelihood values
loglik <- function(y, X, Bs, Bt, missing, Theta, Varphi, iter, burnin) {
.Call('_LFBayes_loglik', PACKAGE = 'LFBayes', y, X, Bs, Bt, missing, Theta, Varphi, iter, burnin)
}
#' Run Markov-Chain Monte-Carlo sampling algorithm
#'
#' This function will generate samples from the posterior distribution.
#'
#' @param y A list of of length n containing responses
#' @param missing A list of length n containing missing indices for each
#' response
#' @param X An n by p design matrix
#' @param splineS Basis matrix for longitudinal direction
#' @param splineT Basis matrix for functional direction
#' @param q1 Number of latent factors for longitudinal direction
#' @param q2 Number of latent factors for functional direction
#' @param thin Keep every thin samples
#' @param iter Number of posterior samples to keep
#' @param burnin Number of burnin samples to discard for posterior inference
#' @param nchains How many chains to run
#' @export run_mcmc
#' @return A list of samples for each parameter. This list can be used as input
#' to eigenLFChains for further post-processing
#' @examples
#' See the example in Root/Example
run_mcmc <- function(y, missing, X, splineS, splineT, q1, q2, iter, thin, burnin, nchains) {
.Call('_LFBayes_run_mcmc', PACKAGE = 'LFBayes', y, missing, X, splineS, splineT, q1, q2, iter, thin, burnin, nchains)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.