# In practice, set "reps" larger than 200.
set.seed(20240201)
n <- 100
func <- function(X, theta) theta[1] + theta[2]*X[,1]
Sig <- rWishart(1, df = n, Sigma = diag(n))[,,1]
theta <- c(2,5)
X <- matrix(rexp(n, rate = 1))
cdfr <- compare(true_mean = func, true_X = X, true_covariance = list(Sigma = Sig),
test_mean = func, X = X, covariance = list(Sigma = Sig), reps = 200,
prog = Inf, theta = theta, theta_init = rep(1, length(theta)))
ks.test(cdfr)
ks.test(cdfr, stat = "CvM")
Run the code above in your browser using DataLab