Closed thoree closed 5 years ago
Ok, nice example. I see that the output of profileSim()
was not optimal. I have modified this now, so that you don't have to reorganise manually.
Below is my version of the code, with a couple of simplifications:
ids
parameter is not necessary in this case)ch
and fa
is the label, you can make ch
in one line using relabel()
.transferMarkers()
part is a one-liner! library(forrel, quietly = T)
### F and C unrelated singletons
fa = singleton("F")
fa = setMarkers(fa, marker(fa, name = "L1"))
ch = relabel(fa, "C")
# Simulate 5 profiles
simUN = profileSim(list(fa, ch), N = 5, cond = "L1", seed = 123)
# LRs
LR(simUN, 1)$likelihoodsPerSystem
#> [,1] [,2] [,3] [,4] [,5]
#> L1 0.25 0.125 0.25 0.0625 0.25
### F is the true father
x = nuclearPed(1, father = "F", children = "C")
# Transfer genotypes from each sim
simPO = lapply(simUN, function(s) transferMarkers(s, x))
# LRs
LR(simPO, 1)$likelihoodsPerSystem
#> [,1] [,2] [,3] [,4] [,5]
#> L1 0.25 0.125 0.25 0 0.25
Great - thanks!
Below I explore the
profileSim
function and rearrange the output allowing fortransferMarkers
and likelihood calculations. Any comments on improved code is appreciated.Created on 2018-11-07 by the reprex package (v0.2.1)