FamiliasConditional: Conditional simulation of marker data on pedigrees and...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Marker data is simulated for a specified person and several markers using FamiliasConditionalOne for each marker. The only difference between FamiliasConditional and paramlinkConditional is that the former uses the C implementation of FamiliasPosterior for likelihood calculation while the latter is based on the R implementation in paramlink.

Usage

1
2
3
4
5
FamiliasConditional(Nsim = 5, datamatrix, loci, pedigrees, truePed = 1, available = NULL,
                  ref = 2, prior = NULL, seed = NULL)
FamiliasConditionalOne(Nsim = 5, mark = 1, ref = 2, datamatrix, 
          persons, loci, pedigrees,truePed = 1, available = NULL, 
          prior = NULL, seed = NULL)

Arguments

Nsim

Integer. Number of simulations.

ref

Integer Denominator of LR.

datamatrix

A data frame or a matrix. The row names must be the names of the persons you have data for. The columns contain the alleles, two columns for each marker, in the same order used in the loci list.

loci

A list of FamiliasLocus objects.

pedigrees

An list with elements of type 'FamiliasPedigree'.

truePed

Integer. Index of pedigree from which marker data are simulated.

available

A character giving the name of the person to be simulated or the integer ID.

prior

Double vector. The prior on pedigrees.

seed

Integer used to fix simulations.

mark

Integer. Index of \[link[paramlink]{marker} used in FamiliasConditionalOne

persons

Character vector. Names of persons.

Details

Marker data is simulated for a specified person and one specified marker using FamiliasConditional which calls markerSim of paramlink. The marker data is then loaded into a datamatrix and likelihoods calculated using Familias.

Value

LR.All.Markers

One LR for each simulation for each pedigree.

lik.All.Markers

One likehood for each simulation for each pedigree.

LR.Per.Marker

One LR for each simulation and marker for each pedigree.

lik.Per.Marker

Onelikelihood for each simulation and marker for each pedigree.

first.Sim

Marker data for first marker.

Author(s)

Thore Egeland <Thore.Egeland@gmail.com> and Magnus Dehli Vigeland

References

Kling et al. (2017)

See Also

See also markerSim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Example. Mutation.
# See documentation of conditionalLR for examples without mutation
data(grandmother)
pedigrees = grandmother$pedigrees
datamatrix = grandmother$datamatrix
persons = rownames(datamatrix)
Nsim = 100 
p = c(0.5,0.5)
loci = list(FamiliasLocus(p, 1:2, "L1", MutationModel = "Proportional",
                          MutationRate=0.005))
res1 = FamiliasConditional(Nsim = Nsim, datamatrix,  loci, pedigrees, 
                           truePed = 1, available = "GS", ref=2, seed=17)
LR1 = table(res1$LR.All.Markers[,1])/Nsim 
# Next, we calculate genotype probabilities for GS exactly
x = Familias2linkdat(pedigrees[[1]], datamatrix, loci)
m = marker(x, 1:2)
x = addMarker(x,m)
p.GS = oneMarkerDistribution(x, 3, partialmarker=1, verbose = FALSE)
# The difference between simulated and exact probabilities are
LR1 - p.GS[c(2,3,1)]

### Example 
data(Demo3Markers)
pedigrees = Demo3Markers$pedigrees
datamatrix = Demo3Markers$datamatrix
loci = Demo3Markers$loci
x = Familias2linkdat(pedigrees, datamatrix, loci)  
P.mother.H1 = oneMarkerDistribution(x[[1]], ids=3, partialmarker=3,
  ignore.affection=TRUE)
P.mother.H2 = oneMarkerDistribution(x[[2]][[1]], ids=3,
  partialmarker=3, ignore.affection=TRUE)
all(round(P.mother.H1/P.mother.H2,10) == 1)
# The probability distribution of the mother is the same for both hypotheses
# and therefore we always get the same LR.

# Example 
data(symmetric)
pedigrees = symmetric$pedigrees
datamatrix = symmetric$datamatrix
loci = symmetric$loci
persons = rownames(datamatrix)
## Not run: 
# Plot with newdev=TRUE, resize plot window and then plot with newdev=FALSE
x = Familias2linkdat(pedigrees, datamatrix, loci)
plotPedList(x, newdev=FALSE, frametitles=c("H1", "H2", "H3"), 
  available="shaded", marker=1:2, skip.empty.genotypes = TRUE)

## End(Not run)
res1 = FamiliasConditional(Nsim = 2, datamatrix,  loci, pedigrees, 
                truePed = 1, available = "MO", ref = 2, seed = 17)
# Without mutation, all LRs 1. With mutation:
res1$LR.All.Markers

fam2r documentation built on May 2, 2019, 1:09 p.m.