bootPhi | R Documentation |
The purpose is to compare parametric and nonparametric confidence intervals in kinship applications, currently only for the kinship coefficient.
bootPhi( ped, ids = NULL, N, B, CItype = "perc", conf.level = 0.95, plot = F, seed = NULL, verbose = F )
ped |
ped object with allele frequencies. |
ids |
Id of pair. |
N |
Integer. No of simulations. |
B |
Integer. No of bootstraps. |
CItype |
Logical. See |
conf.level |
Double |
plot |
Logical |
seed |
Integer. |
verbose |
Logical. |
Marker data are simulated N
times giving N
estimates of (kappa0, kappa1, kappa2).
For each simulation, the realised
phi is found. Parametric and nonparametric bootstrapping
is done giving boot
(the averaged kinship coefficient from B
bootstrap simulations)
and bias
= realised
- boot
is found. There are various
ways to calculate the confidence interval. One option is bca
as implemented in coxed::bca
.
This method fails if the input is a vector of constant values. The default is 'perc', the standard percentile interval. The
variable cover
is 1 if the confidence interval contains phi
and 0 otherwise.
A list with the following sif elements:
phi
: The kinship coefficient of the pedigree.
averaged
: A data frame with two lines, one for parametric
and one for nonParametric
. The values are averaged over the N
simulations.
The columns realised
, boot
, bias
, lower
, upper
, and cover
are explained
in Details
.
simParametric
. The entries are as for averaged
but for each parametric simulation.
simNonparametric
The entries are as for averaged
but for each nonparametric simulation.
bootParametric
The result of the last parametric bootstrap simulation.
bootParametric
The result of the last nonparametric bootstrap simulation.
library(forrel) library(ribd) library(coxed) # for bca confidence intervals # Example 0 ped = doubleFirstCousins() ped = setMarkers(ped, locusAttributes = NorwegianFrequencies) ids = leaves(ped) res1 = bootPhi(ped, ids, N = 1, B = 2) Example 2 # The example considers the kinship coefficients between # brothers named `B1` and `B2` using the 35 markers in # forrel::NorwegianFrequencies. ids = c("B1", "B2") ped = nuclearPed(2, children = ids) ped = setMarkers(ped, locusAttributes = NorwegianFrequencies) N = 10 # no of confidence intervals. Increase B = 100 # no of bootstraps. Increase res1 = bootPhi(ped, ids, N = N, B = B, seed = 17) # Basic output res1[1:2] # Compare parametric and nonparametric estimates y1 = res1$simParametric$boot y2 = res1$simNonparametric$boot boxplot(y1, y2, names = c("parametric", "nonparametric"), main = "Bootstrap estimates of kinship coefficient", sub = "Red stapled line: theoretical value") abline(h = res1$phi, col = 'red', lty = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.