Description Usage Arguments Details Value See Also Examples

View source: R/variancecomponentFunctions.R

correlatedBgEffects computes a background effect that simulates structured correlation between the phenotypes.

1 2 3 4 5 6 7 8 9 10 11 |

`N` |
Number [integer] of samples to simulate. |

`P` |
Number [integer] of phenotypes to simulate. |

`pcorr` |
Initial strength of correlation [double] between neighbouring traits. Decreases by pcorr^(distance); distance from 0 to P-1. See details. |

`corr_mat` |
[P x P] correlation matrix [double] as covariance component for the multivariate normal distribution. If not provided, pcorr is used to construct the correlation matrix. |

`sampleID` |
Prefix [string] for naming samples. |

`phenoID` |
Prefix [string] for naming traits. |

`id_samples` |
Vector of [NrSamples] sample IDs [string]; if not provided constructed by paste(sampleID, 1:N, sep=""). |

`id_phenos` |
Vector of [NrTraits] phenotype IDs [string]; if not provided constructed by paste(phenoID, 1:P, sep=""). |

`verbose` |
[boolean] If TRUE, progress info is printed to standard out. |

correlatedBgEffects can be used to simulate phenotypes with a
defined level of correlation between traits. If the corr_mat is not provided,
a simple correlation structure based on the distance of the traits will be
constructed. Traits of distance d=1 (adjacent columns) will have correlation
cor=*pcorr^1*, traits with d=2 have cor=*pcorr^2*
up to traits with d=(P-1) cor=*pcorr^{(P-1)}* and
0 < pcorr < 1. The correlated background effect correlated is simulated based
on this correlation structure C:
*correlated ~ N_{NP}(0,C)*.

Named list with [N x P] matrix of correlated background effects ( correlatedBg) and the correlation matrix (cov_correlated). If corr_mat provided corr_mat == cov_correlated.

`rmvnorm`

which is used to simulate the
multivariate normal distribution

1 | ```
correlatedBg <- correlatedBgEffects(N=100, P=20, pcorr=0.4)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.