remove_dependence: Remove all dependence in a random structure

View source: R/dependentsim.R

remove_dependenceR Documentation

Remove all dependence in a random structure

Description

Remove all dependence in a random structure

Usage

remove_dependence(random_structure)

Arguments

random_structure

A random structure from get_random_structure()

Value

The random structure with dependency removed, so all data generated from it will be independent.

Examples

library(MASS)
Sigma = matrix(c(
  1,      0.8,    0,  0,  0,  0,
  0.8,    1,      0,  0,  0,  0,
  0,      0,      1,  0,  0,  0,
  0,      0,      0,  1,  0,  0,
  0,      0,      0,  0,  1,  0.3,
  0,      0,      0,  0,  0.3, 1
), nrow=6, ncol=6)
norm_data <- t(mvrnorm(n=20, mu=c(0,0,0,0,0,0), Sigma=Sigma))

# Simulate draws mimicking that data but without any dependence
rs_normal <- get_random_structure(list(data=norm_data), method="pca", rank=2, type="normal")
rs_indep <- remove_dependence(rs_normal)
draws_indep <- draw_from_multivariate_corr(rs_indep, n_samples=30)

dependentsimr documentation built on Aug. 8, 2025, 6:23 p.m.