Function to check whether the argument is coherent and in the correct format.
is.theta(theta, check.class = TRUE)
theta | A list on the |
---|---|
check.class | Logical. If |
logical
. Returns TRUE
if theta
is coherent and
in the correct format. Otherwise, the function returns FALSE
with
an accompanying warning message of the problem.
Anders Ellern Bilgrau <anders.ellern.bilgrau@gmail.com>
#> [1] TRUEtheta2 <- rtheta(d = 3, m = 5) theta2$m <- 6 # m is now incoherent with the number of components is.theta(theta2)#> Warning: theta[[3]] is not a vector of length 6 as defined by theta[[1]]#> [1] FALSEtheta3 <- rtheta(d = 4, m = 2) theta3$sigma$comp1[1, 2] <- 0 # Making the covariance matrix non-symmetric is.theta(theta3)#> Warning: Not all covariance matrices are symmetric.#> [1] FALSEtheta4 <- rtheta(d = 10, m = 10) theta4$sigma$comp1[1, 1] <- 0 # Destroy positive semi-definiteness is.theta(theta4)#> Warning: Not all covariance matrices are postive semi-definite.#> [1] FALSEtheta5 <- rtheta() names(theta5) <- c("m", "d", "prop", "mu", "sigmas") # Incorrect names is.theta(theta5)#> Warning: names(theta) does not equal c("m", "d", "pie", "mu", "sigma")#> [1] FALSE