set_params: Determine number of iterations for MCMC

View source: R/set_params.R

set_paramsR Documentation

Determine number of iterations for MCMC

Description

Determine number of iterations for MCMC

Usage

set_params(
  data,
  trait,
  qtl = NULL,
  epistasis = NULL,
  polygenic = FALSE,
  q = 0.5,
  r = 0.1,
  nIter = 2000
)

Arguments

data

variable of class diallel_geno_pheno

trait

name of trait

qtl

optional data frame, see Examples

epistasis

optional data frame, see Example

polygenic

TRUE/FALSE whether to include additive polygenic effect

q

quantile to estimate

r

tolerance for quantile

nIter

number of iterations

Details

Determines the burn-in and total number of iterations using the Raftery and Lewis diagnostic from R package coda, based on a 95% probability that the estimate for quantile q of the additive genetic variance is within the interval (q-r,q+r). If marker=NULL (default), the first marker of each chromosome is analyzed, and the largest value across this set is returned. Parameter dominance specifies which genetic model (1 = additive, 2 = digenic dominance, 3 = trigenic dominance, 4 = quadrigenic dominance) to use when determining the number of iterations, but this parameter must still be specified when calling functions such as scan1 or fitQTL. The default values of q=0.5 and r=0.1 are recommended for scan1 based on the idea of estimating the posterior mean. For estimating the 90% Bayesian CI with fitQTL, suggested values are q=0.05, r=0.025. Parameter nIter sets the number of iterations used to apply the Raftery and Lewis diagnostic; the default value is 2000, and if a larger number is needed, an error will be generated with this information.

Value

matrix showing the number of burn-in and total iterations for the genetic variances in the model

Examples

## Not run: 
  # Parameters for scan1
  par1 <- set_params(data = diallel_example,
                     trait = "tuber_shape",
                     q=0.5,
                     r=0.1)
                     
  # Parameters for fitQTL (specify the position)
  set_params(data = diallel_example,
             trait = "tuber_shape", 
             q=0.05, 
             r=0.025,
             qtl=data.frame(marker="solcap_snp_c2_25522",dominance=2))
             
  # Parameters for fitQTL (specify the position) with polygenic effects
  set_params(data = diallel_example,
             trait = "tuber_shape", 
             q=0.05, 
             r=0.025,
             qtl=data.frame(marker="solcap_snp_c2_25522",dominance=2),
             polygenic=TRUE)
             
  # Parameters for fitQTL with 2 QTLs
  set_params(data = diallel_example,
             trait = "tuber_shape", 
             q=0.05, 
             r=0.025,
             qtl=data.frame(marker=c("solcap_snp_c2_25522","solcap_snp_c2_14750"),dominance=c(2,1)))
             
  # Parameters for fitQTL with epistasis
  set_params(data = diallel_example,
             trait = "tuber_shape", 
             q=0.05, 
             r=0.025,
             epistasis = data.frame(marker1="solcap_snp_c2_25522",marker2="solcap_snp_c2_14750"),
             qtl=data.frame(marker=c("solcap_snp_c2_25522","solcap_snp_c2_14750"),dominance=c(2,1)))

## End(Not run)
  

jendelman/diaQTL documentation built on Jan. 27, 2024, 6:39 a.m.