Package HH seems provide a easy way to visualize ANCOVAs
library(HH)
data(hotdog)
ancova(Sodium ~ Calories * Type, data=hotdog)
Is there a comfortable way to combinate this with something like panel.ablineq
from latticeExtra
? (http://latticeextra.r-forge.r-project.org#panel.ablineq) to get the concrete functions (slope, intercept)?
The general answer will be to use HH::ancovaplot()
directly (rather than implicitly via HH::ancova()
) along with latticeExtra's handy layer()
function and overloaded +
operator. I'll leave it to you to work out the fiddly details required to make it look exactly how you want it to.
ancovaplot(Sodium ~ Calories * Type, data=hotdog) +
layer(panel.ablineq(lm(y ~ x), rot = TRUE, at = 0.5, pos = 3))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With