Skip to content

Commit

Permalink
MM-136 another one
Browse files Browse the repository at this point in the history
  • Loading branch information
jdstamp committed Jun 6, 2024
1 parent 3311081 commit e73213a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions R/binary_to_liability.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#' Convert binary traits to liabilities
#' Convert binary traits to liabilities for low prevalence
#'
#' This function implements the conversion of binary traits to liabilties as
#' @description
#' This function implements an approximate conversion of binary traits to liabilties as
#' proposed in the LT-MAPIT model (Crawford and Zhou 2018,
#' https://doi.org/10.1101/374983).
#' https://doi.org/10.1101/374983). Note that this is only good for low prevalence.
#' To run LT-MAPIT (MAPIT on case-control traits), convert the binary traits to
#' liabilities using this function and pass the liabilities to mvmapit as trait.
#'
Expand Down
8 changes: 4 additions & 4 deletions man/binary_to_liability.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/tutorial-lt-mapit.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ sample_size <- 500
## Simulate random genotypes

Simulate the genotypes such that all variants have minor allele frequency (MAF) > 0.05.
**NOTE:** As in the paper, we center and scale each genotypic vector such that every SNP has mean 0 and standard deviation 1.

```{r random_genotypes, eval = F}
maf <- 0.05 + 0.45 * runif(n_snps)
Expand Down Expand Up @@ -90,6 +89,7 @@ X <- simulated_data$genotype[c(cases, controls), ]

To run MAPIT with case-control traits, we need to convert the traits back to liabilities.
The function `binary_to_liability` provides this conversion.
**NOTE:** The `binary_to_liability` function is an approximation that is only suited for low prevalence in the disease trait.

```{r mapit, eval = F}
y_liabilities <- binary_to_liability(y, disease_prevalence)
Expand Down

0 comments on commit e73213a

Please sign in to comment.