wavesum {adwave} | R Documentation |

Produces wavelet summaries for each individual and group. Returns the wavelet variance and average block size metric (ABS).

```
wavesum(x, populations, popA = NA, popB = NA, ml = NULL, type = "la8",
t.factor = 1, fullWT = FALSE)
```

`x` |
object of class |

`populations` |
list containing a vector of individual IDs for each population in the analysis. |

`popA` |
name of ancestral population 1 (used for forming the axes of variation). Must match one of the names in |

`popB` |
name of ancestral population 2 (used for forming the axes of variation). Must match one of the names in |

`ml` |
number of wavelet scales in the decomposition. Must not exceed |

`type` |
name of the wavelet to use in the decomposition. The default, “la8”, is Daubechies Least Asymmetric wavelet of length 8. Other options include “haar”. |

`t.factor` |
multiplicative factor for thresholding. See paper for details. Default is 1. |

`fullWT` |
if |

Produces wavelet summaries for objects of class `adsig`

. The function computes the wavelet variance for each individual and population, extracts the informative wavelet variance based on levels observed in the ancestral populations, and computes summary measures of average block size metric (ABS) and peak wavelet scale for each individual and population.

See `waveslim`

documentation for details of the `modwt`

function and alternative wavelet options.

The code returns a list with the following components:

`n.ind` |
number of individuals in the analysis. |

`n.group` |
number of groups in the analysis. |

`rv.ind` |
matrix of dimension |

`rv.group` |
matrix of dimension |

`threshold` |
vector of length |

`iv.ind` |
matrix of dimension |

`iv.group` |
matrix of dimension |

`abs.ind` |
vector of length |

`abs.group` |
vector of length |

`pws.ind` |
vector of length |

`pws.group` |
vector of length |

`wtmatrix` |
`T x n x ml` , containing squared wavelet coefficients for each individual. |

`wtmatrix.group` |
`T x n.group x ml` , squared wavelet coefficients, averaged for each group. |

Jean Sanderson

Sanderson J, H Sudoyo, TM Karafet, MF Hammer and MP Cox. 2015. Reconstructing past admixture processes from local genomic ancestry using wavelet transformation. *Genetics* 200:469-481. https://doi.org/10.1534/genetics.115.176842

```
data(admix)
# Generate the admixture signal
AdexPCA <- signal(admix$data,popA="popA",popB="popB",populations=admix$populations,
tol=0.001, n.signal=NULL)
# Compute wavelet summaries
WSN <- wavesum(AdexPCA,populations=admix$populations,popA="popA",popB="popB")
# Plot raw wavelet variance for each population
barplot(WSN$rv.group[3,],ylim=c(0,0.9),col="red", names.arg=1:11,border=NA)
barplot(WSN$rv.group[1,],ylim=c(0,0.9),col="green3",names.arg=1:11,border=NA,add=TRUE)
barplot(WSN$rv.group[2,],ylim=c(0,0.9),col="blue", names.arg=1:11,border=NA,add=TRUE)
legend("topright",c("popA","popB","popAB"),col=c(3,4,2),pch=15)
box()
# Plot informative wavelet variance for admixed population
barplot(WSN$iv.group[3,],ylim=c(0,0.15),col="red",names.arg=1:11,border=NA)
ABS <- round(WSN$abs.group[3],2)
text(11,0.13,paste("ABS=",ABS))
box()
```

[Package *adwave* version 1.3 Index]