match.layers.x.runs {conStruct}R Documentation

Match layers up across independent conStruct runs

Description

match.layers.x.runs

Usage

match.layers.x.runs(admix.mat1, admix.mat2, admix.mat1.order = NULL)

Arguments

admix.mat1

A matrix of estimated admixture proportions from the original conStruct analysis, with one row per sample and one column per layer.

admix.mat2

A matrix of estimated admixture proportions from a second conStruct analysis, with one row per sample and one column per layer, for which the layer order is desired. Must have equal or greater number of layers to admix.mat1.

admix.mat1.order

An optional vector giving the order in which the layers of admix.mat1 are read.

Details

This function takes the results of two independent conStruct analyses and compares them to identify which layers in a new analysis correspond most closely to the layers from an original analysis.

This function compares admixture proportions in layers across independent conStruct runs, and compares between them to identify the layers in admix.mat2 that correspond most closely to those in admix.mat1. It then returns a vector giving an ordering of admix.mat2 that matches up the order of the layers that correspond to each other. This can be useful for:

  1. Dealing with "label switching" across independent runs with the same number of layers;

  2. Plotting results from independent runs with different numbers of layers using consistent colors (e.g., the "blue" layer shows up as blue even as K increases);

  3. Examining results for multimodality (i.e., multiple distinct solutions with qualitatively different patterns of membership across layers).

The admix.mat1.order argument can be useful when running this function to sync up plotting colors/order across the output of more than two conStruct runs.

Value

This function returns a vector giving the ordering of the layers in admix.mat2 that maximizes similarity between admix.mat1 and re-ordered admix.mat2.

Examples


# compare the estimated admixture proportions from 
# two different conStruct runs to determine which 
# layers in one run correspond to those in the other
match.layers.x.runs(admix.props1,admix.props2)


[Package conStruct version 1.0.6 Index]