Build Status CRAN_Status_Badge Downloads


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) (


You can install the stable version on R CRAN.

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

You can install the development version from GitHub.



# 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))

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

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


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

Try the simTargetCov package in your browser

Any scripts or data that you put into this service are public.

simTargetCov documentation built on March 26, 2020, 8:02 p.m.