Nothing
m_causal=1
bug (used to die, now works correctly).sigmaSq
to sigma_sq
(parameter of sim_trait
and cov_trait
).sim_trait
return list has more descriptive names:trait
(old y
)causal_indexes
(old i
)causal_coeffs
(old beta
)popkin
1.2.0.9000 changes.README
changes in parallel with bnpsd
1.1.0.9000 changes.allele_freqs
, which handles BEDMatrix
objects correctly.
Rest of sim_trait
doesn't handle BEDMatrix
objects yet.sim_trait
, and consequently the whole package, supports BEDMatrix
objects.
This is ideal for simulating traits from real and potentially very large genotype data.allele_freqs
to load genotype chunks from a BEDMatrix
object more efficiently, using as much available memory as possible.
Requires an updated popkin
package (>= 1.2.6.9000).class
usage now that matrices return a two-element array in R-develman/figures/
sim_trait
changed default maf_cut
from 0.05 to NA
, and in that case code no longer computes marginal allele frequencies unless they are needed because p_anc
is missing (and kinship
is provided).
This is much faster and memory efficient in extremely large simulations, and just makes more sense to me generally (the MAF threshold was a quirky feature, still available but non-default now).sim_trait
now delays calculating allele frequencies if maf_cut = NA
and p_anc
is missing (and kinship
is provided), so that these frequencies are only calculated on the small subset of loci selected to be causal (rather than the whole genome, which was the original behavior).
This is expected to speed-up trait simulations from real genotypes.sim_trait_mvn
, which draws traits from the multivariate normal distribution with covariance structure matching that of genetic traits (also called "infinitesimal" model).
These traits are useful for testing heritability estimation.
A visual validation of these simulated traits is available in the vignette.alelle_freq
was modified to reduce memory usage for the BEDMatrix case.sim_trait
, the BEDMatrix-specific options mem_factor
and mem_lim
were replaced by the option m_chunk_max
.popkin
is no longer a dependency of this simtrait
package.
However, popkin
is still recommended for estimating the kinship matrices required by some of the functions of this simtrait
package.simtrait
:rmsd
: General root-mean-square deviation (RMSD) functionpval_srmsd
: Signed RMSD between observed and expected (uniform) p-valuespval_aucpr
: Area under the curve (AUC) of precision-recall (PR) curvePRROC
package dependencypval_infl
(classic inflation factor, but from p-values) to complement yesterday's new functionsallele_freqs
added option fold
, which if TRUE
returns folded i.e. minor allele frequencies.
Default is FALSE
, to return allele frequencies for the alternative allele (the allele counted as it given in the genotype matrix, whether it is the minor or major allele).sim_trait
added option const_herit_loci
, which when TRUE
constructs causal coefficients as inversely proportional to the square root of p*(1-p)
, where p
is the ancestral allele frequency.
This ensures equal per-causal-locus contribution to trait variance.
Default draws causal coefficients randomly from a standard normal distribution, rescaled to result in the desired heritability, for unequal per-locus contribution to trait variance.herit_loci
, which calculates per-locus heritabilities based on variance formula (in terms of allele frequencies, coefficients, and overall trait variance factor).sim_trait
in unit tests.sim_trait
with option const_herit_loci = TRUE
now adds random signs (+/-) to the causal coefficients.sim_trait
now requires that p_anc
have the same length as the number of loci in X
(stops with an error otherwise). Previously this was not checked and could return traits that were NA
for all individuals without clear indications that anything was wrong.pval_srmsd
now accepts causal_indexes = NULL
to handle cases where all p-values are null (before a NULL
input would cause an error).sim_trait
renamed option const_herit_loci
to fes
(fixed effect sizes), the language used in the paper.NEWS.md
slightly to improve its automatic parsing.LazyData: true
(to avoid a new "NOTE" on CRAN).URL
and BugReports
)par()
in vignette examples.sim_trait
fixed an important bug resulting in misspecified heritability!rnorm
the desired variance (1 - herit) * sigma_sq
where the standard deviation (its square root) was required!herit
value by herit / ( herit + (1-herit)^2 * sigma_sq )
. If sigma_sq = 1
(default), the effective heritability was always larger than desired!sim_trait
bug and its fix.inbr_diag
in plot_popkin
calls, which in this case made diagonal values larger (as they were larger than 1), among other minor adjustments.sim_trait
, sim_trait_mvn
, and cov_trait
: added parameters labs
and labs_sigma_sq
to simulate/model non-genetic group effects.sim_trait
also now returns group_effects
as one of the named elements of the return list.sim_trait
parameters p_anc
and kinship
now have default NULL
values (used to not have default values), to facilitate scripting in cases that can be either simulated or real genotypes.pval_type_1_err
and pval_power_calib
for calculating type I error rates and calibrated power, respectively.pval_type_1_err
and pval_power_calib
:alpha
can be a vector, and return value is a vector of estimates, one for each alpha
.1/alpha
.pval_type_1_err
and pval_power_calib
:pvals
is NULL
and alpha
had more than one value, these functions incorrectly returned a scalar NA
, now they return a vector with NA
s the length of alpha
.pval_infl
if input pvals = NULL
now returns NA
(used to return numeric(0)
).sim_trait
, sim_trait_mvn
, cov_trait
:check_labs
renamed to check_herit_labs
and:herit
is now firstherit
checks that used to be in upstream functions into hereAny scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.