Nothing
#' @title Check covariance of exposure values are well defined.
#'
#' @description Function that verifies \code{Xvar} are well defined for
#' \code{paf.confidence} and \code{pif.confidence}
#'
#' @param Xvar Input of covariance matrix of exposure values
#'
#' @return Xvar
#'
#' @importFrom matrixcalc is.positive.semi.definite
#'
#' @examples
#'
#' #Example 1
#' Xvar <- 0.2
#' check.xvar(Xvar)
#'
#' @author Rodrigo Zepeda-Tello \email{rzepeda17@gmail.com}
#' @author Dalia Camacho-GarcĂa-FormentĂ \email{daliaf172@gmail.com}
#'
#' @seealso \code{\link{check.confidence}}, \code{\link{check.thetas}},
#' \code{\link{check.cft}}, \code{\link{check.rr}},
#' \code{\link{check.exposure}}, \code{\link{check.integrals}}
#'
#' @keywords internal
#'
#' @export
check.xvar <- function(Xvar){
#Convert to matrix
Xvar <- as.matrix(Xvar)
#Check nan, NA and character
if(any(is.na(Xvar)) || any(is.nan(Xvar)) || any(is.character(Xvar))){
stop("Covariance of exposure values Xvar had non-numeric arguments")
}
#Check is squared
if(ncol(Xvar) != nrow(Xvar)){
stop("Covariance matrix is not square matrix")
}
#Check is positive definite
if(!is.positive.semi.definite(Xvar)){
stop("Covariance matrix must be positive semi-definite.")
}
return(Xvar)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.