Last data update: 2014.03.03

R: Computes the alpha_m variants and their weights.
noaTabsR Documentation

Computes the alpha_m variants and their weights.

Description

Computes the alpha_m-vectors and their weights, c(alpha_m), in order to compute the exact distribution of the number of alleles in a m-person DNA mixture.

Usage

noaTabs(alpha=NULL,m=2,weight=1)

Arguments

alpha

If noaTabs has been evaluated for n<m, then providing this object to noaTabs reduces the number of recursions needed to evaluate for m.

m

The number of contributors

weight

See the paper for details. Usually, this should be set to 1

Details

Computes the alpha_m-vectors and their weights, c(alpha_m), by recursion over the number of contributors m. That is, alpha_m is obtained based on alpha_(m-1) – see paper for details.

Value

Returns a named vector of counts, where the names denotes the alpha_m-vectors and the countes is the associated weights, c(alpha_m).

Author(s)

Torben Tvedebrink

References

T Tvedebrink (2013). 'On the exact distribution of the number of alleles in DNA mixtures', International Journal of Legal Medicine: (under review).

Examples

  ## Simulate some allele frequencies:
  freqs <-  structure(replicate(10, { g = rgamma(n=10,scale=4,shape=3); g/sum(g)},
              simplify=FALSE),.Names=paste("locus",1:10,sep="."))
  ## Compute alpha_2
  noa.tab2 <- noaTabs(m=2)
  ## Use alpha_2 to compute alpha_3
  noa.tab3 <- noaTabs(alpha=noa.tab2, m=3)

  ## Compute P(N(m=3)=n), n=1,...,2*L*m, where L=10 here
  pNoA(freqs,m=3,theta=0,noa.tabs=noa.tab3)
  ## Same, but locuswise results
  pNoA(freqs,m=3,theta=0,noa.tabs=noa.tab3,locuswise=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DNAtools)
Loading required package: Rsolnp
Loading required package: multicool
Loading required package: Rcpp
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DNAtools/noaTabs.Rd_%03d_medium.png", width=480, height=480)
> ### Name: noaTabs
> ### Title: Computes the alpha_m variants and their weights.
> ### Aliases: noaTabs
> 
> ### ** Examples
> 
>   ## Simulate some allele frequencies:
>   freqs <-  structure(replicate(10, { g = rgamma(n=10,scale=4,shape=3); g/sum(g)},
+               simplify=FALSE),.Names=paste("locus",1:10,sep="."))
>   ## Compute alpha_2
>   noa.tab2 <- noaTabs(m=2)
>   ## Use alpha_2 to compute alpha_3
>   noa.tab3 <- noaTabs(alpha=noa.tab2, m=3)
> 
>   ## Compute P(N(m=3)=n), n=1,...,2*L*m, where L=10 here
>   pNoA(freqs,m=3,theta=0,noa.tabs=noa.tab3)
           1            2            3            4            5            6 
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
           7            8            9           10           11           12 
0.000000e+00 0.000000e+00 0.000000e+00 2.747024e-40 2.681576e-37 1.197459e-34 
          13           14           15           16           17           18 
3.247185e-32 5.989256e-30 7.980956e-28 7.973212e-26 6.123531e-24 3.683019e-22 
          19           20           21           22           23           24 
1.760674e-20 6.775488e-19 2.122810e-17 5.470813e-16 1.170583e-14 2.096964e-13 
          25           26           27           28           29           30 
3.168476e-12 4.064813e-11 4.453276e-10 4.187727e-09 3.395264e-08 2.382642e-07 
          31           32           33           34           35           36 
1.452147e-06 7.709205e-06 3.574040e-05 1.450103e-04 5.158374e-04 1.611162e-03 
          37           38           39           40           41           42 
4.423581e-03 1.068499e-02 2.271731e-02 4.252058e-02 7.005384e-02 1.015390e-01 
          43           44           45           46           47           48 
1.293648e-01 1.446827e-01 1.417979e-01 1.215025e-01 9.076326e-02 5.889542e-02 
          49           50           51           52           53           54 
3.304923e-02 1.594947e-02 6.574215e-03 2.294515e-03 6.706367e-04 1.618017e-04 
          55           56           57           58           59           60 
3.160882e-05 4.867547e-06 5.679852e-07 4.714464e-08 2.477480e-09 6.190006e-11 
>   ## Same, but locuswise results
>   pNoA(freqs,m=3,theta=0,noa.tabs=noa.tab3,locuswise=TRUE)
$locus.1
           1            2            3            4            5            6 
0.0001598674 0.0092251274 0.1079770145 0.3707172575 0.4000119282 0.1119088050 

$locus.2
           1            2            3            4            5            6 
6.417165e-05 7.793342e-03 1.088014e-01 3.809235e-01 3.970492e-01 1.053684e-01 

$locus.3
           1            2            3            4            5            6 
4.767136e-05 5.749567e-03 9.162953e-02 3.629827e-01 4.189371e-01 1.206535e-01 

$locus.4
           1            2            3            4            5            6 
0.0001020095 0.0092315730 0.1153029998 0.3836269398 0.3897593435 0.1019771344 

$locus.5
           1            2            3            4            5            6 
0.0001607878 0.0121538342 0.1336196375 0.3982906983 0.3674823629 0.0882926793 

$locus.6
           1            2            3            4            5            6 
4.212132e-05 6.449803e-03 1.017996e-01 3.794668e-01 4.050862e-01 1.071555e-01 

$locus.7
          1           2           3           4           5           6 
0.000148705 0.014616520 0.158389722 0.424365218 0.335449005 0.067030830 

$locus.8
           1            2            3            4            5            6 
0.0000616178 0.0072556681 0.1042062890 0.3768224947 0.4029111433 0.1087427870 

$locus.9
           1            2            3            4            5            6 
5.254371e-05 6.151359e-03 9.393245e-02 3.639072e-01 4.162303e-01 1.197261e-01 

$locus.10
          1           2           3           4           5           6 
0.001688705 0.040679599 0.222620404 0.411614536 0.271722917 0.051673839 

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>