Description Usage Arguments Value Examples
View source: R/correctIntegral.R
correctIntegral
normalizes a log-concave density
parametrized by a set of hyperplane parameters. Works by calculating y =
log(f(x)) for each data point in X, normalizing y, and then recalculating a
and b.
1 | correctIntegral(X, mu, a, b, cvh)
|
X |
Set of data points (one sample per row) |
mu |
Mean vector of X that gets added back to X |
a |
Matrix where rows are hyperplane normals |
b |
Vector where entries are intercepts of hyperplanes |
cvh |
Matrix where each row is a set of indices of points in X describing one face of conv(X) |
Normalized hyperplane parameters (for the uncentered X <- X +
mu
)
a, b |
Hyperplane parameters of the normalized density. |
y |
Vector with values y_i = log(f(X_)) of the normalized density. |
aSparse, bSparse |
Input hyperplane parameters. |
1 2 3 4 5 6 7 8 9 10 | # draw samples from normal distribution
X <- matrix(rnorm(200),100,2)
# calculate parameters of convex hull of X
r <- calcCvxHullFaces(X)
# draw random parameters of 10 hyperplanes
a <- matrix(runif(10*2),10,2)
b <- runif(10)
# calculate parameters of convex hull of X
params <- correctIntegral(X,rep(0,2),a,b,r$cvh)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.