Visualize ANCOVA, including formulas (e.g. HH library)

HH package seems like an easy way to visualize ANCOVAs

library(HH) data(hotdog) ancova(Sodium ~ Calories * Type, data=hotdog) 

enter image description here

Is there a convenient way to combine this with something like panel.ablineq from latticeExtra ? ( http: //latticeextra.r-forge.r-project.org#panel.ablineq ) to get specific functions (tilt, intercept)?

+7
r plot lattice
source share
1 answer

The general answer will be to use HH::ancovaplot() directly (and not implicitly through HH::ancova() ) together with the HH::ancova() grid with the convenient layer() function and the overloaded + operator. I will leave it to you to figure out the details necessary to make them look exactly the way you want it.

 ancovaplot(Sodium ~ Calories * Type, data=hotdog) + layer(panel.ablineq(lm(y ~ x), rot = TRUE, at = 0.5, pos = 3)) 

enter image description here

+5
source share

All Articles