View source: R/replicate_data.R
replicate_real_phenos | R Documentation |
This function simulates phenotypes from real phenotypic data based on their
sample correlation structure. If binary data are provided, will simulate
latent Gaussian data from them (binary data can then be obtained using the
generate_dependence
function).
replicate_real_phenos(
n,
real_phenos,
input_family = "gaussian",
bl_lgth = NULL,
d = NULL,
n_cpus = 1,
user_seed = NULL
)
n |
Number of observations. |
real_phenos |
Matrix of real phenotypes (rows observations, columns phenotypic variables), without missing values. |
input_family |
Phenotype distribution assumption for the phenotypes
provided in real_phenos. Must be either " |
bl_lgth |
Number of variables per block for reproducing the dependence
structure of real phenotypes. Must be between 2 and d. Must be small enough
(e.g. 1000) for tractability reasons. Default is |
d |
Number of phenotypes. If |
n_cpus |
Number of CPUs used when simulating phenotypes by blocks. Set to 1 for serial execution. |
user_seed |
Seed set for reproducibility. Default is |
An object of class "sim_phenos
".
phenos |
Matrix containing the generated phenotypic data. |
var_err |
Vector containing the sample phenotypic variances. |
ind_bl |
List of length given by the number of blocks, containing the
indices of the phenotypes in each block. Is |
convert_snps
, generate_snps
,
replicate_real_snps
, convert_phenos
,
generate_phenos
, generate_dependence
user_seed <- 123; set.seed(user_seed)
n <- 500; d <- 1000
cor_type <- "equicorrelated"; vec_rho <- runif(100, min = 0.25, max = 0.95)
# Provided phenotypes assumed to be normally distributed
var_err <- runif(d, min = 0.1, max = 0.4)
list_fake_real_phenos <- generate_phenos(n, d, var_err, cor_type = cor_type,
vec_rho = vec_rho, n_cpus = 1,
user_seed = user_seed)
list_phenos <- replicate_real_phenos(n, list_fake_real_phenos$phenos,
input_family = "gaussian", bl_lgth = 100,
n_cpus = 1, user_seed = user_seed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.