#this example not run because it takes longer than 5 secs
#note - type example(FunctionName, run.dontrun=TRUE) to run the example where FunctionName is
#the name of the function
#Data generation
SampleSites=10
NumberSNPs=4
TestData=array(sample(2*(1:30),2*SampleSites*NumberSNPs,replace=TRUE),
dim=c(2,SampleSites,NumberSNPs))
#Europe is about -9 to 38 and 34 to 60
TestCoordinates=array(0,dim=c(SampleSites,2))
TestCoordinates[,1]=runif(SampleSites,-9,38)
TestCoordinates[,2]=runif(SampleSites,34,60)
#This code simulates the number of major alleles the unknown individuals have.
NumberUnknowns=2
TestUnknowns=array(sample(0:2,NumberUnknowns*NumberSNPs,replace=TRUE),
dim=c(NumberUnknowns,NumberSNPs))
#Fitting the admixed model
#MaxGridLength is the maximum number of boxes allowed to span the region in either direction
#Note that MaxGridLength is reduced here to allow the example to run in less than 5 secs
#RhoParameter is a tuning constant
print("MaxGridLength is intentionally set really low for fast examples.
Meaningful results will most likely require a higher value.")
trials6=FitAdmixedModelFindUnknowns(TestData,TestCoordinates,
TestUnknowns,MaxGridLength=8,RhoParameter=10)
#Plots the admixed surface disregarding fractions less than 0.01
PlotAdmixedSurface(trials6)
Run the code above in your browser using DataLab