The function takes an annotated tree and randomly selects leaf nodes to set annotations as 9 (missing). The function allows specifying a proportion of annotations to drop, and also the relative probability that has dropping a 0 with respecto to a 1.
pcent: Numeric scalar. Proportion of the annotations to remove.
prob.drop.0: Numeric scalar. Probability of removing a 0, conversely, 1 - prob.drop.0 is the probability of removing a 1.
informative: Logical scalar. If TRUE (the default) the algorithm drops annotations only if the number of annotations to drop of either 0s or 1s are less than the currently available in the data.
Returns
x with fewer annotations (more 9s).
Examples
# The following tree has roughtly the same proportion of 0s and 1s# and 0 mislabeling.set.seed(1)x <- raphylo(200, Pi=.5, mu_d=c(.5,.5), psi=c(0,0))summary(x)# Dropping half of the annotationssummary(rdrop_annotations(x,.5))# Dropping half of the annotations, but 0 are more likely to dropsummary(rdrop_annotations(x,.5, prob.drop.0=2/3))