This function finds the appropriate value of the tuning constant, RhoParameter, via a leave one sample site out cross validation.

1 | ```
FindRhoParameterCrossValidation(PlinkFileName,LocationFileName,MaxIts=6,MaxGridLength=20)
``` |

`PlinkFileName` |
Base name of Plink PED file (i.e. without ".ped" or ".map") |

`LocationFileName` |
Space or tab delimited text file with Longitude and Latitude coordinates for each individual listed in the 4th and 5th columns respectively. Note that rows should correspond to the individuals in the Plink File. Also, this file should have a header row. |

`MaxIts` |
An integer giving the number of iterations before selecting the rho parameter. Note that this is a long process so it is best to start small. |

`MaxGridLength` |
An integer giving the maximum number of boxes to fill the longer side of the region. Note that computation time increases quadratically as this number increases, but this number also should be high enough to separate different sample sites otherwise they will be binned together as a single site. |

List with the following components:

`PlinkFileName` |
This shows the inputted PlinkFileName with ".ped" attached. |

`LocationFile` |
This shows the inputted LocationFileName. |

`NumberSNPs` |
This shows the integer number of SNPs found. |

`MaxIts` |
An integer giving the number of iterations before selecting the rho parameter. Note that this is a long process so it is best to start small. This number is inputted into the function. |

`MaxGridLength` |
An integer giving the maximum number of boxes to fill the longer side of the region. Note that computation time increases quadratically as this number increases, but this number also should be high enough to separate different sample sites otherwise they will be binned together as a single site. This number was part of the inputs. |

`RhoVector` |
An array giving the tested values of RhoParameter along with the resulting cross validation results where lower is better. |

`GridLength` |
An array giving the number of longitudinal and latitudinal divisions. The dimension of this array is [2], where the first number is longitude and the second is latitude. |

`RhoParameter` |
A real value showing the best RhoParameter value found. |

`SampleSites` |
This shows the integer number of sample sites found. |

John Michael Ranola, John Novembre, and Kenneth Lange

Ranola J, Novembre J, Lange K (2014) Fast Spatial Ancestry via Flexible Allele Frequency Surfaces. Bioinformatics, in press.

`ConvertPEDData`

for converting Plink PED files into a format appropriate for analysis,

`FitOriGenModel`

for fitting allele surfaces to the converted data,

`PlotAlleleFrequencySurface`

for a quick way to plot the resulting allele frequency surfaces from `FitOriGenModel`

,

`ConvertUnknownPEDData`

for converting two Plink PED files (known and unknown)into a format appropriate for analysis,

`FitOriGenModelFindUnknowns`

for fitting allele surfaces to the converted data and finding the locations of the given unknown individuals,

`PlotUnknownHeatMap`

for a quick way to plot the resulting unknown heat map surfaces from `FitOriGenModelFindUnknowns`

,;

`FitAdmixedModelFindUnknowns`

for fitting allele surfaces to the converted data and finding the locations of the given unknown individuals who may be admixed,

`PlotAdmixedSurface`

for a quick way to plot the resulting admixture surfaces from `FitAdmixedFindUnknowns`

,

`RankSNPsLRT`

for reducing the number of SNPs using a likelihood ratio test criteria or informativeness for assignment,

1 2 3 4 5 6 7 8 9 | ```
#Note that Plink files "10SNPs.ped", "10SNPs.map" and also "Locations.txt"
#are included in the data folder of the OriGen package.
#Please navigate to the appropriate location before testing
#the following commands.
## Not run: trials5=FindRhoParameterCrossValidation("10SNPs","Locations.txt",
MaxIts=4,MaxGridLength=20)
## End(Not run)
## Not run: trials5
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.