Skip to content

Commit

Permalink
add AddHealth example to HE_manova vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
friendly committed Apr 27, 2024
1 parent 2257c42 commit c16e280
Show file tree
Hide file tree
Showing 87 changed files with 388 additions and 144 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## Version 1.6.3 (2024-03-05)

* Correct documentation error in `cqplot`
* Correct documentation error in `cqplot()`
* `cqplot()` now returns DSQ values for identified points
* Fixed small buglet re: labeling of hypothesis ellipses in `heplot()`
* Added a new example (`AddHealth` data) to the `HE_manova` vignette

## Version 1.6.2 (2024-02-14)

Expand Down
2 changes: 1 addition & 1 deletion R/cqplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ cqplot.default <-
noteworthy <- car::showLabels(chi2q, y, labels=labs, id.method=id.method,
id.n=id.n, id.cex = id.cex, id.col = id.col)

res <- data.frame(dsq[noteworthy])
res <- data.frame(DSQ = dsq.y[noteworthy], quantile = chi2q[noteworthy])
rownames(res) <- labs[noteworthy]
return(invisible(res))
}
Expand Down
37 changes: 34 additions & 3 deletions R/datasets.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


#' Adolescent Health Data
#' Adolescent Mental Health Data
#'
#' This data was taken from the National Longitudinal Study of Adolescent
#' Health. It is a cross-sectional sample of participants from grades 7--12,
Expand Down Expand Up @@ -34,13 +34,44 @@
#' @examples
#'
#' data(AddHealth)
#'
#' if(require(dplyr) & require(ggplot2)) {
#' # find means & std.errors by grade
#' means <- AddHealth |>
#' group_by(grade) |>
#' summarise(
#' n = n(),
#' dep_se = sd(depression, na.rm = TRUE) / sqrt(n),
#' anx_se = sd(anxiety, na.rm = TRUE) / sqrt(n),
#' depression = mean(depression),
#' anxiety = mean(anxiety) ) |>
#' relocate(depression, anxiety, .after = grade) |>
#' print()
#'
#' # plot means with std.error bars
#' ggplot(data = means, aes(x = anxiety, y = depression,
#' color = grade)) +
#' geom_point(size = 3) +
#' geom_errorbarh(aes(xmin = anxiety - anx_se,
#' xmax = anxiety + anx_se)) +
#' geom_errorbar(aes(ymin = depression - dep_se,
#' ymax = depression + dep_se)) +
#' geom_line(aes(group = 1), linewidth = 1.5) +
#' geom_label(aes(label = grade),
#' nudge_x = -0.015, nudge_y = 0.02) +
#' scale_color_discrete(guide = "none") +
#' theme_bw(base_size = 15)
#' }
#'
#' # fit mlm
#' AH.mod <- lm(cbind(depression, anxiety) ~ grade, data=AddHealth)
#' AH.mod <- lm(cbind(anxiety, depression) ~ grade, data=AddHealth)
#'
#' car::Anova(AH.mod)
#' summary(car::Anova(AH.mod))
#'
#' heplot(AH.mod, hypotheses="grade.L", fill=c(TRUE, FALSE))
#' heplot(AH.mod, hypotheses="grade.L",
#' fill=c(TRUE, FALSE),
#' level = 0.4)
#'
NULL

Expand Down
2 changes: 1 addition & 1 deletion R/heplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ heplot.mlm <-
ell <- n.terms + hyp
# lines(H.ellipse[[ell]], col=col[ell], lty=lty[ell], lwd=lwd[ell])
polygon(H.ellipse[[ell]], col=fill.col[ell], border=col[ell], lty=lty[ell], lwd=lwd[ell])
label.ellipse(H.ellipse[[ell]], hyp.labels[hyp], col=col[ell], label.pos=label.pos[ell], ...)
label.ellipse(H.ellipse[[ell]], hyp.labels[hyp], col=col[ell], label.pos=label.pos[hyp], ...)
}
if (!add && (!is.logical(factor.means) || factor.means)){
for (fac in factors){
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/articles/HE_manova.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/articles/HE_mmra.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pkgdown_sha: ~
articles:
HE_manova: HE_manova.html
HE_mmra: HE_mmra.html
last_built: 2024-02-15T15:34Z
last_built: 2024-03-05T16:38Z
urls:
reference: https://friendly.github.io/heplots/reference
article: https://friendly.github.io/heplots/articles
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/AddHealth.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions docs/reference/Adopted.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Bees.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Diabetes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Ellipsoid.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/FootHead.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Headache.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Hernior.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Iwasaki_Big_Five.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/Mahalanobis.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/MockJury.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/NLSY.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/NeuroCog.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c16e280

Please sign in to comment.