Data Transformation or Simulation with Empirical Covariance Matrix

Transforms or simulates data with a target empirical covariance matrix supplied by the user. The method to obtain the data with the target empirical covariance matrix is described in Section 5.1 of Christidis, Van Aelst and Zamar (2019) .


Build Status CRAN_Status_Badge Downloads

simTargetCov

This package transforms or simulates data with a target empirical covariance matrix supplied by the user. The details to obtain such data can be found in Christidis, Van Aelst and Zamar (2019) (https://arxiv.org/abs/1812.05678).


Installation

You can install the stable version on R CRAN.

install.packages("simTargetCov", dependencies = TRUE)

You can install the development version from GitHub.

library(devtools)
devtools::install_github("AnthonyChristidis/simTargetCov")

Usage

# Function to create target covariance matrix with kernel set to r
target_cor <- function(r, p){
 Gamma <- diag(p)
 for(i in 1:(p-1)){
   for(j in (i+1):p){
     Gamma[i,j] <- Gamma[j,i] <- r^(abs(i-j))
   }
 }
 return(Gamma)
}

# Transformation of data to target empirical covariance
dat.target.cov <- simTargetCov(X = MASS::mvrnorm(30, mu = rep(0,6),
                               Sigma = target_cor(0.5,6)),
                               target = target_cor(0.5,6))
round(cov(dat.target.cov), 2)

# Simulation of data with target empirical covariance
sim.target.cov <- simTargetCov(n = 30, p = 6, target = target_cor(0.5,6))
round(cov(sim.target.cov), 2)

License

This package is free and open source software, licensed under GPL (>= 2).

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("simTargetCov")

1.0.1 by Anthony Christidis, 7 years ago


Browse source code at https://github.com/cran/simTargetCov


Authors: Anthony Christidis <[email protected]> , Stefan Van Aelst <[email protected]> , Ruben Zamar <[email protected]>


Documentation:   PDF Manual  


GPL (>= 2) license


Imports MASS, stats

Suggests testthat


See at CRAN