data(freqsNLngm)
# dist of PI for true parent/offspring pairs
hp <- ki.dist(hyp.1="PO",hyp.2="UN",hyp.true="PO",freqs.ki=freqsNLngm)
# dist of PI for unrelated pairs
hd <- ki.dist(hyp.1="PO",hyp.2="UN",hyp.true="UN",freqs.ki=freqsNLngm)
set.seed(100)
# estimate P(PI>1e6) for true PO
sim.q(t=1e6,dists=hp)
# estimate P(PI>1e6) for unrelated pairs
sim.q(t=1e6,dists=hd) # small probability, so no samples exceed t=1e6
# importance sampling can estimate the small probability reliably
# by sampling from H_p and weighting the samples appropriately
sim.q(t=1e6,dists=hd,dists.sample=hp)
Run the code above in your browser using DataLab