rcpd | R Documentation |
Creates a nrow \times ncol matrix with ncp change points. In between change points, the random variables are i.i.d. sampled from the given family and parameters
rcpd( nrow = 100, ncol = 50, ncp = 1, family = "bernoulli", parameters = NULL, changepoints = NULL, prob_NA = 0 )
nrow |
Number of rows, or sample size, of the data. |
ncol |
Number of columns of data matrix. It is the number of variables for each sample. |
ncp |
Number of change points. The number of blocks is ncp + 1. It is overridden if changepoints is non-NULL. |
family |
The family model to be sampled. The families currently implemented are:
|
parameters |
List of parameters containing ncp + 1 dimensional parameter vectors of each block. If NULL, the parameters are sampled randomly. |
changepoints |
A sorted vector of size ncp containing integers as change point locations. The change points are between 1 and ncol-1. If NULL, the change points are sampled uniformly in [1, ncol-1]. |
prob_NA |
Probability of each entry of being NA. Default is 0. |
Returns a list containing 3 elements: #'
"data_matrix" A matrix containing the data.
"changepoints" A numeric vector containing the change-point locations
"parameters" A list whose keys are the parameters names and the values are vectors containing the parameter for each block.
td = rcpd(nrow = 20, ncol = 10) # 20 Bernoulli series of size 10 with 1 change-point td = rcpd(nrow = 10, ncol = 100, ncp = 5, family = "normal") # 10 normal series of size 100 with 5 change-points td = rcpd(nrow = 1000, ncol = 100, changepoints = c(10, 40, 79)) # choosing change-points locations td = rcpd(nrow = 100, ncol = 15, ncp = 2, family = "normal", parameters = list(mean = c(1, 2, 3), var = c(4, 5, 6))) # choosing parameters
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.