knitr::opts_chunk$set(fig.width = 5, fig.height = 5)
This vignette shows how to use the R package disclapmix
that implements the method described in [@AndersenDisclap2013] and [@AndersenDisclapMixture2015]. For a more gentle introduction to the method, refer to the introduction vignette and [@AndersenDisclapIntroduction2013].
We again use the Danish reference database [@Hallenberg2005YchromosomeSH] with $n = 185$ observations (male Y-STR haplotypes) at $r=10$ loci is available in the danes
dataset.
Let us load the package as well as the data:
library(disclapmix) data(danes)
The database is in compact format, i.e. one unique haplotype per row. To fit the model, we need one observation per row. This is done for example like this:
db <- as.matrix(danes[rep(seq_len(nrow(danes)), danes$n), seq_len(ncol(danes)-1)]) str(db)
Also, note that the database is now an integer matrix.
Assume now that we have a mixture and that the reference database are without these two contributors:
donor1 <- db[1, ] donor2 <- db[20, ] refdb <- db[-c(1, 20), ]
We now construct the mixture:
mix <- generate_mixture(list(donor1, donor2))
We can then see some properties of possible pairs:
pairs <- contributor_pairs(mix) pairs
To do much more, we need a model assigning hpalotype probabilies. In the introduction vignette, we found that 4 clusters seemed fine, so let us fit this model:
fit <- disclapmix(x = refdb, clusters = 4L)
We can now use this model to e.g. rank the contributor pairs:
ranked_pairs <- rank_contributor_pairs(pairs, fit) ranked_pairs
We can get the ranks for the donors:
get_rank(ranked_pairs, donor1) get_rank(ranked_pairs, donor2)
Any 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.