search.best.n.bisection: Method of bisection for estimating optimal sample size

Description Usage Arguments Value Examples

View source: R/powercalc.R

Description

A grid [nstart, nmax] for possible sample size is considered. Instead of executing a time-consuming grid search, the method of bisection is applied to this interval. For each step, the function pwr.normtest is called for the given set of parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
search.best.n.bisection(
  R,
  betaSE,
  lambda,
  pos,
  nstart,
  nmax,
  weights = 1,
  typeII = 0.2,
  alpha = 0.01
)

Arguments

R

(p x p) matrix containing theoretical correlation between SNP pairs

betaSE

effect size relative to residual standard deviation

lambda

shrinkage parameter

pos

vector (LEN nqtl) of SNP indices for assumed QTL positions

nstart

minimum value for grid search

nmax

maximum value for grid search

weights

vector (LEN p) of SNP-specific weights or scalar if weights are equal for all SNPs; default value 1

typeII

type-II error level; default value 0.2

alpha

type-I error level; default value 0.01

Value

integer of optimal sample size

Examples

1
2
3
4
5
6
  ### correlation matrix (should depend on sire haplotypes)
  R <- AR1(100, rho = 0.1)
  ### positions of putative QTL signals
  pos <- c(14, 75)
  ### optimal sample size
  search.best.n.bisection(R, 0.35, 1200, pos, 10, 5000)

hscovar documentation built on April 13, 2021, 9:06 a.m.