Re-Scale Effects of a Simulation Object
Usage
rescale_sumstats(
dat,
output_geno_scale = c("allele", "sd"),
output_pheno_sd = 1,
af = NULL,
verbose = TRUE
)
Arguments
- dat
A sim_mv object
- output_geno_scale
Desired genotype scale of output. Either "allele" or "sd".
- output_pheno_sd
Desired sd of phenotype, scalar or vector with length equal to the number of traits.
- af
If converting from sd to allele scale, provide a vector of allele frequencies.
- verbose
Print messages?
Details
This function can be used to change the genotype and phenotype scaling. To check the scaling
of the current object, look at the gneo_scale
and pheno_sd
elements.
If the current object is already on the allele scale and you desire the output to also
be on the allele scale, do not supply af
(doing so will generate an error). If you
convert an "allele" scale object to an "sd" scale object, allele frequencies will be remoed.
Examples
# generate an initial data set
N <- matrix(10000, nrow = 2, ncol =2)
G <- matrix(c(0, 0.5, 0, 0), nrow = 2, ncol = 2)
dat <- sim_mv(N = N,
G = G,
J = 20000,
h2 = c(0.4, 0.3),
pi = 1000/20000,
af = function(n){rbeta(n, 1, 5)})
#> SNP effects provided for 20000 SNPs and 2 traits.
# check scaling
dat$geno_scale # "allele"
#> [1] "allele"
dat$pheno_sd # 1 1
#> [1] 1 1
# rescale phenotypes and convert to per-sd scale
dat2 <- rescale_sumstats(dat = dat,
output_geno_scale = "sd",
output_pheno_sd = c(1.5, 0.3))