#
# The Landis et al. (2013) example has two factors, program of treatment and provider of services.
LandisBarrettGalvin2013
# This examine the omnibus analysis, that is, a 5 (provider) x 3 (program):
w <- anofa(obsfreq ~ provider * program, LandisBarrettGalvin2013)
# Once processed into w, we can ask for a standard plot
anofaPlot(w)
# We place the factor `program` on the x-axis:
anofaPlot(w, factorOrder = c("program","provider"))
# The above example can also be obtained with a formula:
anofaPlot(w, ~ program * provider)
# Change the style for a plot with bars instead of lines
anofaPlot(w, plotStyle = "bar")
# Changing the error bar style
anofaPlot(w, plotStyle = "bar", errorbarParams = list( width =0.1, linewidth=0.1 ) )
# An example with 4 factors:
if (FALSE) {
dta <- data.frame(Detergent)
dta
w <- anofa( Freq ~ Temperature * M_User * Preference * Water_softness, dta )
anofaPlot(w)
anofaPlot(w, factorOrder = c("M_User","Preference","Water_softness","Temperature"))
# Illustrating the main effect of Temperature (not interacting with other factors)
# and the interaction Preference * Previously used M brand
# (Left and right panels of Figure 4 of the main article)
anofaPlot(w, ~ Temperature)
anofaPlot(w, ~ Preference * M_User)
# All these plots are ggplot2 so they can be followed with additional directives, e.g.
library(ggplot2)
anofaPlot(w, ~ Temperature) + ylim(200,800) + theme_classic()
anofaPlot(w, ~ Preference * M_User) + ylim(100,400) + theme_classic()
}
# etc. Any ggplot2 directive can be added to customize the plot to your liking.
# See the vignette `Example2`.
Run the code above in your browser using DataLab