View source: R/gt_impute_xgboost.R
gt_impute_xgboost | R Documentation |
This function provides a simple imputation algorithm for gen_tibble
objects based on local XGBoost models.
gt_impute_xgboost(
x,
alpha = 1e-04,
size = 200,
p_train = 0.8,
n_cor = nrow(x),
seed = NA,
n_cores = 1,
append_error = TRUE
)
x |
a gen_tibble with missing data |
alpha |
Type-I error for testing correlations. Default is |
size |
Number of neighbour SNPs to be possibly included in the model
imputing this particular SNP. Default is |
p_train |
Proportion of non missing genotypes that are used for training
the imputation model while the rest is used to assess the accuracy of
this imputation model. Default is |
n_cor |
Number of rows that are used to estimate correlations. Default uses them all. |
seed |
An integer, for reproducibility. Default doesn't use seeds. |
n_cores |
the number of cores to be used |
append_error |
boolean, should the xgboost error estimates be appended as an attribute to the genotype column of the gen_tibble. If TRUE (the default), a matrix of two rows (the number of missing values, and the error estimate) and as many columns as the number of loci will be appended to the gen_tibble. attr(missing_gt$genotypes, "imputed_errors") |
This function is a wrapper around bigsnpr::snp_fastImpute()
. The error
rates from the xgboost, if appended, can be retrieved with
attr(x$genotypes, "imputed_errors")
where x
is the gen_tibble
.
a gen_tibble with imputed genotypes
example_gt <- load_example_gt("gen_tbl")
# Impute the gen_tibble
example_gt <- example_gt %>% gt_impute_xgboost()
# And we can check it has been imputed
example_gt %>% gt_has_imputed()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.