#| label = "{{DataName}}Plot",
#| fig.cap = "Plot of {{ResponseName}} versus {{Covariate}} with fitted lines
#| added for each {{FactorName}}."
library(ggplot2)
{{DataName}} |> ggplot(aes(y = {{ResponseName}}, x = {{Covariate}}, group = {{FactorName}})) + geom.point() + geom_smooth(method="lm")
#| label = "{{DataName}}.lm"
{{DataName}}.lm1 = lm({{ResponseName}} ~ {{FactorName}}, data = {{DataName}})
{{DataName}}.lm2 = lm({{ResponseName}} ~ {{FactorName}}+{{Covariate}}, data = {{DataName}})
{{DataName}}.lm3 = lm({{ResponseName}} ~ {{FactorName}}*{{Covariate}}, data = {{DataName}})
anova({{DataName}}.lm1, {{DataName}}.lm2, {{DataName}}.lm3)
#| label = "glance{{DataName}}.lm"
library(broom)
glance({{DataName}}.lm1, {{DataName}}.lm2, {{DataName}}.lm3) |> kable(caption=Comparison of three models relating to ANCOVA of {{ResponseName}} using {{FactorName}} for groups and the {{covariate}} Covariate.")
#| label = "plot{{DataName}}.lm",
#| fig.cap = "Residual analysis for {{DataName}}.lm"
library(ggfortify)
{{DataName}}.lm3 |> autoplot()


Try the BrailleR package in your browser

Any scripts or data that you put into this service are public.

BrailleR documentation built on July 26, 2023, 5:46 p.m.