plotCI: Plot hyperrectangular and ellipsoidal confidence intervals

Description Usage Arguments Value Examples

View source: R/EstimateOptimizationParameters.R

Description

Plot hyperrectangular and ellipsoidal confidence intervals

Usage

1

Arguments

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

Value

an object of class ggplot2

Examples

 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)

cmottet/GLP documentation built on May 6, 2019, 12:05 a.m.