aggregate_observations | R Documentation |
This function aggregate observations with the same means while simultaneously controlling False Split Rate under a target level. The aggregation is achieved by two steps: (1) Generate p-values for each interior node through ANOVA test (2) Sequentially test on the tree.
aggregate_observations(y, sigma = NULL, tree = NULL, alpha)
y |
A length- |
sigma |
Standard deviation of noise. If given, the algorithm will compute nodewise p-values with chi-squared statistics. If sigma is unkown, the algorithm will compute p-values with F-test statistics. |
tree |
An object encoding the tree structure. Can be one of three
formats: (1) an |
alpha |
A use-specified target FSR level |
Returns the aggregation result.
alpha |
The target FSR level. |
groups |
A length- |
rejections |
A length-( |
p_vals |
A length-( |
set.seed(123)
hc = hclust(dist((1:20) + runif(20)/20), method = "complete")
k = 4 # 4 true groups
groups = cutree(hc, k = 4)
theta = runif(k, 0, 10)[groups]
y = theta + runif(20, 0, 1)
aggregate_observations(y, sigma = 1, tree= hc, alpha = 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.