choc | R Documentation |
choc carry out a choc analysis on a multivariate time series
choc(mydata, H, timevar, weights = NULL, resolution = 100, ncores = 1)
mydata |
a data frame or matrix with one column per time series and one row per observation (event). Marginal distributions are assumed to follow a normal distribution |
H |
either a function from library ks to estimate a bandwith matrix, or directly a bandwith matrix. Exemples of function |
timevar |
a vector specifying the time step for each observation. Several observations per time step are required. Observations of a same time step are assumed to be replicates. |
weights |
weights of the observations |
resolution |
grid resolution on which the densities of probability will be computed. The resolution does not affect the result: high resolution increases the resolution of final diagrams but increases computation time and memory usage. The number of observations per time step should be roughly similar |
ncores |
Number of cores used. The parallelization will take place only if OpenMP is supported. |
a chocR object, i.e. a list with 5 elements:
list_data the list of data per time step
grid a dafaframe with one row per time series and a column tau that gives the tau of Kendall trend test
cholH the cholesky decomposition of H
list_weights the weights of observation
root_i a transformation of inv(trimatu(cholH))
#generate artificial data set #two time series measured on 40 time steps with 100 observations per time step. #the two series follow a multinormal time series with a tend on means and a constant #covariance matrix if (require(MASS) & require(ks)){ tvar <- rep(1:40,times=100) #times steps meansX <-tvar/40 #trend on 1st variable meansY <- -0.5*tvar/40 #trend on 2nd variable sigma <- matrix(c(1,.1,.1,1),2,2) #covariance matrix values <- t(apply(cbind(meansX,meansY),1,function(mu) mvrnorm(1,mu,sigma))) #generate the values H <- Hpi #choose the default bandwith res_choc <- choc(values,H,tvar) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.