Learn R Programming

nntmvn (version 1.3.0)

ptmvn_check_converge: Check the convergence of 1st moment with m at selected indices of a PTMVN distribution with zero mean

Description

Check the convergence of 1st moment with m at selected indices of a PTMVN distribution with zero mean

Usage

ptmvn_check_converge(
  y,
  cens_lb,
  cens_ub,
  covmat = NULL,
  locs = NULL,
  cov_name = NULL,
  cov_parm = NULL,
  m_vec = seq(from = 10, to = 100, by = 10),
  N = 1000,
  ind_test = NULL
)

Value

a matrix summarizing the 1st moments evaluated at increasing m at the selected indices

Arguments

y

responses before censoring, of length n

cens_lb

cens_lb and cens_ub define the censoring region, of length n

cens_ub

cens_lb and cens_ub define the censoring region, of length n

covmat

n-by-n dense covariance matrix, either covmat or locs, cov_name, and cov_parm need to be provided

locs

location matrix n X d

cov_name

covariance function name from the GpGp package

cov_parm

parameters for the covariance function from the GpGp package

m_vec

a vector of m values (int) to be tested

N

the number of samples to generate for each test index and each m to evaluate 1st-order moment

ind_test

a vector of indices indexing the locs where we check the 1st-order moment convergence, by default, 10 random indices are used. If some test loc is not censored, the function treats it as unobserved

Examples

Run this code
library(GpGp)
library(nntmvn)
library(lhs)
library(ggplot2)
set.seed(123)
n <- 500
locs <- lhs::randomLHS(n, 2)
lb <- rep(-Inf, n)
ub <- rep(0, n)
covmat <- GpGp::matern15_isotropic(c(1, 0.1, 0.01), locs)
y <- as.vector(t(chol(covmat)) %*% rnorm(n))
check_obj <- ptmvn_check_converge(y, lb , ub, covmat,
                                  m_vec = seq(from = 10, to = 50, by = 10)
)
first_mmt <- check_obj$pred
plot(first_mmt)
pred_err <- check_obj$error
plot(pred_err)

Run the code above in your browser using DataLab