Description Usage Arguments Value Examples
View source: R/EstimateOptimizationParameters.R
Plot hyperrectangular and ellipsoidal confidence intervals
1 |
sample |
Vector of sample points |
CI |
List containing either hyperrectangle, data.frame containing the lower bounds and upper bounds of the derivatives and truncated moments., or \itemellipsoid, a list containing the vector of means, the covariance matrix, and the radius of the ellipsoid describing the confidence interval |
an object of class ggplot2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | set.seed(100)
n <- 300 ; mu <- c(1,2,3) ; Sigma <- matrix(c(6,0,0,0,1,1,0,1,1),ncol =3) ; alpha = 0.05
sample <- MASS::mvrnorm(n,mu,Sigma) %>% as.data.frame
CIellipsoid <- list(mu = colMeans(sample, na.rm = TRUE), Sigma = cov(sample, use = "complete.ob"), radius = sqrt(qchisq(1-alpha/2, df = 2)))
CIrectangular <- apply(sample, 2, quantile, probs = c(alpha/2,1-alpha/2))
CI <- list(ellipsoid = CIellipsoid, hyperrectangle = CIrectangular)
plotCI(sample,CI)
n <- 300 ; mu <- c(1,2) ; Sigma <- matrix(c(6,1,1,1),ncol =2) ; alpha = 0.05
sample <- MASS::mvrnorm(n,mu,Sigma) %>% as.data.frame
CIellipsoid <- list(mu = colMeans(sample, na.rm = TRUE), Sigma = cov(sample, use = "complete.ob"), radius = sqrt(qchisq(1-alpha/2, df = 2)))
CIrectangular <- apply(sample, 2, quantile, probs = c(alpha/2,1-alpha/2))
CI <- list(ellipsoid = CIellipsoid, hyperrectangle = CIrectangular)
plotCI(sample,CI)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.