Genetic Factor Analysis
gfa_fit.Rd
Genetic Factor Analysis
Arguments
- Z_hat
A matrix of z-scores with rows for variants and columns for traits.
- N
Vector of sample sizes length equal to number of traits. If not provided, N will default to the vector of 1's and the factor matrix will be returned on the "z-score scale".
- B_hat
A matrix of GWAS effect estimates. B_hat is an alternative to Z_hat (only provide one of these). If using B_hat, you must also provide S.
- S
If using B_hat, provide the corresponding matrix of standard errors.
- R
Estimated residual correlation matrix. This can be produced for example using R_ldsc or R_pt.
- params
List of parameters. For most users this can be left at the default values. See details.
- method
Either "fixed_factors" or "random_effect". "random_effect" is experimental. See details.
- mode
Either "z-score" or "b-std". See details.
Value
A list with elements L_hat and F_hat for estimated variant-factor and factor-trait effects, gfa_pve which contains the proportion of heritability explained by each factor, and some other objects useful internally.
Details
The method argument can be either fixed_factors or random_effect. These are different methods for fitting the GFA model. The random_effect method requires installing a fork of the flashier package using `install_github("jean997/flashier", ref = "random-effect")`. Most users can stick with the fixed_factors method.
The mode option tells GFA to either fit using z-scores as the outcome and then convert the factor matrix to the standardized scale (mode = "z-score") or to fit directly using standardized effect estimates as the outcome (mode = "b-std"). These give very similar results and the z-score mode is faster and so recommended.
The params list includes the following elements which can be modified. Most users will not need to modify any of these, except possibly `max_iter`.
kmax: Maximum number of factors. Defaults to twice the number of traits
cond_num: Maximum allowable condition number for R. Defaults to 1e5.
max_iter: Maximum number of iterations. Defaults to 1000.
extrapolate: Passed to flashier, defaults to TRUE
ebnm_fn_F and ebnm_fn_L: Prior families for factors and loadings. Defaults to point-normal.
init_fn: Flashier initialization function.