You are on page 1of 1

nMonte is an R-program that takes as input a calculator file and a targetfile.

The program calculates mixtures of all the populations in the calculator file;
it searches for the mixture which has the shortest distance to the target file.
Technically the program performs a Monte Carlo simulation, evolutionary guided by
the computed distances.

The calculator file should be a comma-separated csv-file of averaged population


values.
The targetfile should also be comma-separated, unlike the first version of 4Mix.
An example of a correct targetfile is:
,ENF,WHG,W_African,CHG,E_Asian,Papuan,EHG,San
huijbregts,0.325803,0.316518,0.00001,0.187518,0.00001,0.00001,0.170121,0.00001
Remember that the files should be terminated with an empty line.
Both files and the file nMonte.R should be present in the active directory of R.

A valid specification is:

source('nMonte2.R')
getMonte('k12b.csv', 'test.csv')

The output in the R-window can be pasted to a spreadsheet.

If you want to save the output, you can also specify a file to save the output to:
getMonte(calculatorfile, targetfile, save='myResults_001.txt')
If the specified file does already exist in the active directory, you are prompted
to specify another filename.

Because the program is a Monte-Carlo simulation, it has a runtime of about a minute


before it returns the result.
The runtime can be reduced by lowering the number of iterations with the optional
parameter 'Ncycles'.
getMonte(calculatorfile, targetfile, Ncycles=300)
If Ncycles is set to lower value than the default 1000, the accuracy is reduced.
Check this by repeating the run with the same data.

Ger Huijbregts

You might also like