## Load the Switzerland data
data(Switzerland)
## Summarise the Switzerland data
summary(Switzerland)
## Fit a DI model
m1 <- DI(y = "yield", prop = 4:7, treat = 'nitrogen', DImodel = 'AV',
density = 'density', estimate_theta = FALSE, data = Switzerland)
summary(m1)
## Basic comparison of the first five observations in the Switzeraland data
head(Switzerland, 5)
compare_communities(m1, data = Switzerland[1:5, ])
## The pairiwise comparisons between each community as well as the cld letters are returned.
## By default, single-step p-value adjustments are performed to account for multiple comparisons.
## This can be changed using adjust argument. For example, "none" would perform no adjustment
compare_communities(m1, data = Switzerland[1:5, ],
adjust = "none")
## Bonferroni adjustment
compare_communities(m1, data = Switzerland[1:5, ],
adjust = "bonferroni")
## If any variable needed for predictions is missing in the data,
## a warning will be thrown and sensible values will be used.
## In this example, we only specify the species proportions and nothing for nitrogen and density
compare_communities(m1, data = Switzerland[1:5, 4:7],
adjust = "bonferroni")
## The alpha.level and symbols to be used for cld can be changed as follows
compare_communities(m1, data = Switzerland[1:5, ],
adjust = "none", alpha.level = 0.01,
Letters = LETTERS)
## Change row.names of data to get informative labels for the tests
comp_data <- Switzerland[1:5, ]
rownames(comp_data) <- c("p1_dom", "p2_dom", "p3_dom", "p4_dom", "Centroid")
compare_communities(m1, data = comp_data,
adjust = "none", alpha.level = 0.01,
Letters = LETTERS)
## Comparisons can also be performed against a specific community as reference
## using the `ref` argument. Using "Centroid" as ref in this example,
## can also be specified using the row number, i.e., 5
compare_communities(m1, data = comp_data, ref = 5,
adjust = "none",
Letters = LETTERS)
Run the code above in your browser using DataLab