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.
rdrop_annotations(
x,
pcent,
prob.drop.0 = 0.5,
informative = getOption("aphylo_informative", FALSE)
)
An object of class aphylo.
Numeric scalar. Proportion of the annotations to remove.
Numeric scalar. Probability of removing a 0, conversely,
1 - prob.drop.0
is the probability of removing a 1.
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.
x
with fewer annotations (more 9s).
# 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)
#>
#> Distribution of functions in tip.annotation :
#> 0 1 NA
#> fun0000 82 118 0
#>
#> Distribution of functions in node.annotation :
#> 0 1 NA
#> fun0000 83 116 0
# Dropping half of the annotations
summary(rdrop_annotations(x, .5))
#>
#> Distribution of functions in tip.annotation :
#> 0 1 NA
#> fun0000 36 64 100
#>
#> Distribution of functions in node.annotation :
#> 0 1 NA
#> fun0000 83 116 0
# Dropping half of the annotations, but 0 are more likely to drop
summary(rdrop_annotations(x, .5, prob.drop.0 = 2/3))
#>
#> Distribution of functions in tip.annotation :
#> 0 1 NA
#> fun0000 34 66 100
#>
#> Distribution of functions in node.annotation :
#> 0 1 NA
#> fun0000 83 116 0