You could do it using the emmeans package.
Then simply do:
m_means <- emmeans(NegativeBinomalLatencyModel, ~ Resource)
#TO GET PAIRWISE COMPARISONS WITH DIFFERENCES INDICATED AS LETTERS
cld(m_means, Letters = letters)
The emmeans package has a very good documentation (see link above).
Edit to address OPs comments:
If you want to plot the data, you can do it simply via the emmip() function (from the emmeans package). Have look at ?emmip for details. Using your specific example a basic plot could be generated like this:
#BASIC PLOT
emmip(m_means, ~ Resource)
#BASIC PLOT WITH CONFIDENCE LIMITS
emmip(m_means, ~ Resource, CIs=T)
#BASIC PLOT WITH CONFIDENCE LIMITS ON THE RESPONSE SCALE
emmip(m_means, ~ Resource, CIs=T, type="response")
Another way of plotting can be achieved by simply using the plot() function. For that have a look at ?plot.emmGrid.
If you want more control, you can store the output of cld() in an object such as this:
m_means_table <- cld(m_means, Letters = letters)
This can then be used in ggplot2 for example:
require(ggplot2)
ggplot(m_means_table, aes(x=Resource, y=emmean)) + geom_point() +
geom_errorbar(aes(ymin=emmean-SE, ymax=emmean+SE))
If you want upper and lower confidence limits, you can simply replace emmean-SE with asymp.LCL and emmean+SE with asymp.UCL, respectively (from the m_means_table object).
Also have a look at my answer on poisson and glm.nb models here:
poisson glm to observe whether effects of artificial light on the number of bat passes in each location were significant
Resource emmean SE df asymp.LCL asymp.UCL .group 4 None 4.723694 0.2927040 Inf 4.150004 5.297383 a 1 Burrow 4.941642 0.3054607 Inf 4.342951 5.540334 a 3 Food 5.129405 0.2922820 Inf 4.556543 5.702268 a 2 Female 5.270799 0.3825413 Inf 4.521032 6.020567 a
Is there a way to plot this?
– Harry Mar 09 '18 at 11:40