HACSim (version 1.0.1)

HACHypothetical: Set up an object to simulate haplotype accumulation curves for a hypothetical species

Description

Helper function which creates an object containing necessary information to run a simulation of haplotype accumulation for a hypothetical species of interest

Usage

HACHypothetical(N, Hstar, probs, perms = 10000, p = 0.95, 
conf.level = 0.95, subsample = FALSE, prop = NULL,
progress = TRUE, filename = NULL)

Arguments

N

Number of individuals

Hstar

Number of unique species' haplotypes

probs

Haplotype frequency distribution vector

perms

Number of permutations (replications)

p

Proportion of haplotypes to recover

conf.level

Desired confidence level for gaphical output and interval estimation

subsample

Is a subsample of haplotype labels desired?

prop

If subsample = TRUE, the proportion of haplotype labels to subsample

progress

Should iteration output be printed to the R console?

filename

Name of file where simulation results are to be saved

Value

An object with 13 elements that can be passed to HAC.simrep

Examples

Run this code
# NOT RUN {
  ## Simulate hypothetical species ##
  
  N <- 100 # total number of sampled individuals
  Hstar <- 10 # total number of haplotypes
  probs <- rep(1/Hstar, Hstar) # equal haplotype frequency distribution
  
  # outputs a CSV file called "output.csv"
  HACSObj <- HACHypothetical(N = N, Hstar = Hstar, probs = probs, filename = "output") 
  
  ## Simulate hypothetical species - subsampling ##
  # subsamples 25% of haplotype labels
  HACSObj <- HACHypothetical(N = N, Hstar = Hstar, probs = probs, 
  perms = 1000, p = 0.95, subsample = TRUE, prop = 0.25, 
  conf.level = 0.95, filename = "output") 
  
  ## Simulate hypothetical species and all paramaters changed - subsampling ##
  HACSObj <- HACHypothetical(N = N, Hstar = Hstar, probs = probs, 
  perms = 10000, p = 0.90, subsample = TRUE, prop = 0.15, conf.level = 0.95, 
  filename = "output")
  
# }

Run the code above in your browser using DataLab