HACHypothetical {HACSim} | R Documentation |
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, ci.type = "quantile", subsample = FALSE, prop = NULL,
progress = TRUE, num.iters = NULL, 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 graphical output and interval estimation |
ci.type |
Type of confidence interval for graphical output. Choose from "quantile" or "asymptotic" |
subsample |
Is a subsample of haplotype labels desired? |
prop |
If subsample = TRUE, the proportion of haplotype labels to subsample |
num.iters |
Number of iterations to compute |
progress |
Should iteration output be printed to the R console? |
filename |
Name of file where simulation results are to be saved |
Value
A list object of class "HAC" with 13 elements that can be passed to
HAC.simrep
as follows:
input.seqs |
Should a FASTA file of aligned/trimmed DNA sequences be inputted? Default is FALSE |
subset.seqs |
Should a subsample of DNA sequences be taken? Default is FALSE |
prop.seqs |
Proportion of DNA sequences to subsample. Default is NULL |
prop.haps |
Proportion of haplotype labels to subsample. Default is NULL (can be altered by user) |
subset.haps |
Should a subsample of haplotype labels be taken? Default is NULL (can be altered by user) |
N |
Number of individuals. NA by default (provided by user) |
Hstar |
Number of unique species' haplotypes. NA by default (provided by user) |
probs |
Haplotype frequency distribution vector. NA by default (provided by user) |
p |
Proportion of haplotypes to recover. |
perms |
Number of permutations (replications). |
conf.level |
Desired confidence level for graphical output and interval estimation. |
ci.type |
Type of confidence interval for graphical output.
|
num.iters |
Number of iterations to compute. |
progress |
Should iteration output be printed to the R console? Default is TRUE |
filename |
Name of file where simulation results are to be saved. |
Note
N
must be greater than 1 and greater than or equal to Hstar
.
Hstar
must be greater than 1.
probs
must have a length equal to Hstar
and its elements must sum
to 1.
Examples
## 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,
num.iters = 1, filename = "output")