Description Usage Arguments Details Value Examples
The purpose is to compare confidence intervals (CI-s) based on parametric bootstrap and nonparametric bootstrap. For a simple case, iid SNPs with frequency 0.5 and kappa2 = 0, the asymptotic counterparts are provided.
1 2 3 4 5 6 7 8 9 10 11 |
theta |
Double kappa0. |
x |
ped object with allele frequencies. |
ids |
Id of pair. |
n |
Integer. No of markers, only used in the asymptoic case |
N |
Integer. No of simulations. |
B |
Integer. No of bootstraps. |
seed |
Integer. |
bca |
Logical. |
The equations for the simple asymptotic case are documented separately. CI-s for the bootstrap are calculated using the percentile method. Only estimates in the asymptotic case are constrained by kappa2 = 0. This makes comparison between the asymptotic and the bootstrap estimates a bit unfair.
Returns a list with length 3 or 4 (if asymptotic is included). The last element of the list contains averaged CI, point estimate, coverage, and dist (as defined in 'ibdBootstrap'), the former elements contain the same information for each CI.
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 53 54 55 56 57 58 59 60 61 62 | library(forrel)
library(pedprobr)
# Example 1. Assumptions for simple asymptotics met.
x = halfSibPed(1)
n = 100# no of markers
N = 100 # no of simulations
B = 1000 # no of bootstraps
bca = FALSE
## Frequencies for bootstrap
freq = list()
for (i in 1:n)
freq[[i]] = list(alleles = 1:2, afreq = c(0.5, 0.5))
x = setMarkers(x, locusAttributes = freq)
## Parent offspring
ids = c(1, 4); theta = 0; seed = 17
foo1 = compareCI(theta, x, ids, n, N, B, bca = bca)
## half sibs
ids = c(4,5); theta = 0.5; seed = 17;
foo2 = compareCI(theta, x, ids, n, N, B, bca = bca, seed)
## Unrelated
ids = c(1,3); theta = 1
foo3 = compareCI(theta, x, ids, n, N, B, bca = bca)
cbind(theta = rep(c(0,0.5,1), each = 3),
rbind(foo1$average, foo2$average, foo3$average))
# Example 2. Strong deviation from iid
n1 = 19 # no of id markers
n2 = 1
MAF = 0.001 #minor allele frequency
n = n1 + n2 # no of markers
N = 2 # no of simulations
B = 100 # no of bootstraps
## Frequencies for bootstrap
freq = list()
for (i in 1:n1)
freq[[i]] = list(alleles = 1:2, afreq = c(0.5, 0.5))
for (i in (n1+1):n)
freq[[i]] = list(alleles = 1:2, afreq = c(MAF, 1-MAF))
x = setMarkers(x, locusAttributes = freq)
## Parent offspring
ids = c(1, 4); theta = 0; seed = 17
foo1 = compareCI(theta, x, ids, n, N, B, asymptotic = FALSE)
## half sibs
ids = c(4,5); theta = 0.5; seed = 17;
foo2 = compareCI(theta, x, ids, n, N, B, asymptotic= FALSE)
## Unrelated
ids = c(1,3); theta = 1
foo3 = compareCI(theta, x, ids, n, N, B, asymptotic = FALSE)
cbind(theta = rep(c(0,0.5,1), each = 2),
rbind(foo1$average, foo2$average, foo3$average))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.