Last data update: 2014.03.03

R: LEAPFrOG
LEAPFrOGR Documentation

LEAPFrOG

Description

Provides estimates of admixture proportions and parental divergence of these admixture proportions

Usage

LEAPFrOG(data,p,Nudge=0.001,NonLinCon=TRUE)

Arguments

data

Vector of allele counts: each element either 0,1,2 or NA.

p

Matrix of allele frequencies. Each row corresponds with a SNP. Number of rows must equal length of data. Each column is a population

Nudge

D for population 1 will be initialised at 0.5+Nudge. Nudge must be greater than 0. In theory the value for Nudge shouldn't affect the final optimum, but may influence the time to convergence. Default is 0.001.

NonLinCon

If TRUE (default), the auglag optimisation function is invoked with a nonlinear constraint imposed on D*m, preventing impossible admixture totals of >1 in the parents. We strongly advise this option

Details

Standard errors returned in the order P-1 m parameters followed by P-1 D parameters. m and D for the Pth population are not estimated directly and have no standard error.

Value

A list including elements

m

A vector of admixture proportions in the genotyped offspring, one proportion per population. These sum to 1.

D

A vector of parental divergence paramaters, one per population.

mse

A vector of length number of populations-. Standard errors for all m estimates save the last populaion

Dse

A vector of length number of populations-. Standard errors for all D estimates save the last populaion

P1

Admixture proportions for each population, for parent 'A', derived from the m and D estimates.

P2

Admixture proportions for each population, for parent 'B', derived from the m and D estimates

value

Value of the optimised likelihood function.

counts

Number of times the likelihood function and gradient function were called during optimisation.

Author(s)

Daniel Crouch & Michael Weale, Department of Medical and Molecular Genetics, King's College London

See Also

LEAPFrOG_plot,LEAPFrOG_EM,BEAPFrOG

Examples

#Example with nonsense data -
#10000 random SNP genotypes 
#...and uniform, random allele frequencies from two populations.
library(LEAPFrOG)
z1=LEAPFrOG(sample(0:2,10000,replace=TRUE),cbind(runif(10000,0,1),runif(10000,0,1)))
z1

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(LEAPFrOG)
Loading required package: alabama
Loading required package: numDeriv
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LEAPFrOG/LEAPFrOG.Rd_%03d_medium.png", width=480, height=480)
> ### Name: LEAPFrOG
> ### Title: LEAPFrOG
> ### Aliases: LEAPFrOG
> 
> ### ** Examples
> 
> #Example with nonsense data -
> #10000 random SNP genotypes 
> #...and uniform, random allele frequencies from two populations.
> library(LEAPFrOG)
> z1=LEAPFrOG(sample(0:2,10000,replace=TRUE),cbind(runif(10000,0,1),runif(10000,0,1)))
Min(hin):  0.001 
Outer iteration:  1 
Min(hin):  0.001 
par:  0.5 0.501 
fval =   13920 
 
Outer iteration:  2 
Min(hin):  0.0012209 
par:  0.493621 0.501221 
fval =   13920 
 
Outer iteration:  3 
Min(hin):  0.001143117 
par:  0.493616 0.501143 
fval =   13920 
 
Outer iteration:  4 
Min(hin):  0.001032938 
par:  0.493617 0.501033 
fval =   13920 
 
Outer iteration:  5 
Min(hin):  0.0004329562 
par:  0.493618 0.500433 
fval =   13920 
 
Outer iteration:  6 
Min(hin):  0.0001262507 
par:  0.49362 0.500126 
fval =   13920 
 
Outer iteration:  7 
Min(hin):  6.81871e-05 
par:  0.493617 0.500068 
fval =   13920 
 
Outer iteration:  8 
Min(hin):  3.682766e-05 
par:  0.493618 0.500037 
fval =   13920 
 
Outer iteration:  9 
Min(hin):  1.989049e-05 
par:  0.493618 0.50002 
fval =   13920 
 
Outer iteration:  10 
Min(hin):  1.074279e-05 
par:  0.493618 0.500011 
fval =   13920 
 
Outer iteration:  11 
Min(hin):  5.802144e-06 
par:  0.493618 0.500006 
fval =   13920 
 
> z1
$m
[1] 0.4936177 0.5063823

$D
[1] 0.5000031 0.4999969

$mse
[1] 0.007413019

$Dse
[1] 0.006117227

$P1
[1] 0.4936208 0.5063792

$P2
[1] 0.4936146 0.5063854

$value
[1] 13918.16

$counts
function gradient 
     157       16 

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