jointCDF {MoTBFs} | R Documentation |
Functions to compute the multivariate cumulative distribution. It uses a grid data over the ranges of variables in the dataset to calculate the cumulative values.
jointCDF(data, grid)
posGrid(nrows, data, grid)
data |
The dataset as data.frame class. |
grid |
a data frame with the select rows to include in the grid |
nrows |
Number of rows. |
jointCDF()
is the main function which uses the internal
function posGrid()
.
## 1. EXAMPLE
## Dataset with 2 variables
X <- data.frame(rnorm(100), rnorm(100))
## Grid dataset
gridX <- sapply(1:ncol(X), function(i) seq(min(X[,i]), max(X[,i]), length=10))
gridPoints <- expand.grid(gridX) ## expand gridX
ncol(gridPoints)
nrow(gridPoints)
## Joint cumulative values
jointCDF(data = X, grid = gridPoints)
## 2. EXAMPLE
## Dataset with 3 variables
X <- data.frame(rnorm(100), rexp(100), rchisq(100, df=2))
## Grid dataset
gridX <- sapply(1:ncol(X), function(i) seq(min(X[,i]), max(X[,i]), length=10))
gridPoints <- expand.grid(gridX) ## expand gridX
ncol(gridPoints)
nrow(gridPoints)
## Joint cumulative values
jointCDF(data = X, grid = gridPoints)