Learn R Programming

polySegratioMM (version 0.6-2)

dosagesJagsMix: Compute dosages under specified Bayesian mixture model

Description

Computes and returns estimated dosages under specified model using posterior probabilities derived from mcmc chains by the proportion of samples in each dosage class.

Usage

dosagesJagsMix(mcmc.mixture, jags.control, seg.ratio, chain = 1,
max.post.prob = TRUE, thresholds = c(0.5, 0.6, 0.7, 0.8, 0.9, 0.95,
0.99), print = FALSE, print.warning = TRUE, index.sample = 20)

Arguments

mcmc.mixture
Object of type segratioMCMC produced by coda usually by using readJags
jags.control
Object of class jagsControl for setting up JAGS command file
seg.ratio
Object of class segRatio contains the segregation ratios for dominant markers and other information such as the number of dominant markers per individual
chain
Which chain to use when compute dosages (Default: 1)
max.post.prob
Logical for producing dose allocations based on the maximum posterior probability (Default: TRUE)
thresholds
Numeric vector of thresholds for allocating dosages when the posterior probabilty to a particular dosage class is above the threshold
print
Logical indicating whether or not to print intermediate results (Default: FALSE)
print.warning
Logical to print warnings if there is more than one marker with the maximum posterior probability
index.sample
Numeric vector indicating which markers to print if print is TRUE. If index.sample is of length 1 then a random sample of size index.sample is selected

Value

  • An object of class dosagesMCMC is returned with components:
  • p.dosageMatrix of posterior probabilities of dosages for each marker dosage
  • dosageMatrix of allocated dosages based on posterior probabilities. The columns correspond to different 'thresholds' and if requested, the last column is allocated on basis of max.post
  • thresholdsvector of cutoff probabilities for dosage class
  • chainChain used to compute dosages
  • max.postmaximum dosage posterior probabilties for each marker
  • index.sampleNumeric vector indicating which markers to print if print is TRUE. If index.sample is of length 1 then a random sample of size index.sample is selected

concept

  • segregation ratio
  • dominant marker
  • autopolyploid

See Also

dosagesMCMC readJags

Examples

Run this code
## simulate small autooctaploid data set
a1 <- sim.autoMarkers(8,c(0.7,0.2,0.1),n.markers=100,n.individuals=50)

## compute segregation ratios
sr <-  segregationRatios(a1$markers)

## set up model, priors, inits etc and write files for JAGS
x <- setModel(3,8)
x2 <- setPriors(x)
dumpData(sr, x)
inits <- setInits(x,x2)
dumpInits(inits)
writeJagsFile(x, x2, stem="test")

## run JAGS
small <- setControl(x, burn.in=200, sample=500)
writeControlFile(small)
rj <- runJags(small)  ## just run it
print(rj)

## read mcmc chains and produce dosage allocations
xj <- readJags(rj)
dd <- dosagesJagsMix(xj, small, sr)
print(dd)

Run the code above in your browser using DataLab