Skip to content

Commit

Permalink
Added linfct accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlenth committed Feb 13, 2025
1 parent 89f84b7 commit fc452d0
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: emmeans
Type: Package
Title: Estimated Marginal Means, aka Least-Squares Means
Version: 1.10.7
Date: 2025-01-30
Version: 1.10.7-100001
Date: 2025-02-14
Authors@R: c(person("Russell V.", "Lenth", role = c("aut", "cre", "cph"),
email = "russell-lenth@uiowa.edu"),
person("Balazs", "Banfai", role = "ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ S3method(emm_basis,svyolr)
S3method(emm_basis,zeroinfl)
S3method(emmip,default)
S3method(head,emmGrid)
S3method(linfct,default)
S3method(pairs,emmGrid)
S3method(pairs,emm_list)
S3method(plot,emmGrid)
Expand Down Expand Up @@ -199,6 +200,7 @@ export(get_emm_option)
export(hpd.summary)
export(inverse)
export(joint_tests)
export(linfct)
export(lsm)
export(lsm.options)
export(lsmeans)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "NEWS for the emmeans package"
---
## emmeans 1.10.7-100xxx
* Added a `linfct()` generic and default method that returns `object@linfct`


## emmeans 1.10-7
* Spelling changes in several vignettes
Expand Down
12 changes: 12 additions & 0 deletions R/emmGrid-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ vcov.emmGrid = function(object, ..., sep = get_emm_option("sep")) {
}


#' @rdname emmGrid-methods
#'
#' @returns The \code{linfct} function and method returns the \code{linfct} slot of \code{object}.
#' @export
linfct = function(object, ...)
UseMethod("linfct")

#' @rdname emmGrid-methods
#' @export
linfct.default = function(object, ...) {
attr(object, "linfct")
}


# Method to alter contents of misc slot
Expand Down
2 changes: 1 addition & 1 deletion R/interfacing.R
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ recover_data.call = function(object, trms, na.action, data = NULL,
#' \code{tol} is the tolerance for assessing estimability. It should return a
#' matrix with 3 columns: the estimates, standard errors (\code{NA} when
#' \code{do.se==FALSE}), and degrees of freedom (\code{NA} for asymptotic). The
#' number of rows should be the same as \samp{object@linfct}. The
#' number of rows should equal \samp{nrow(linfct(object)}. The
#' \code{vcovHook} function should have arguments \samp{(object, tol, ...)} as
#' described. It should return the covariance matrix for the estimates. Finally,
#' \code{postGridHook}, if present, is called at the very end of
Expand Down
2 changes: 1 addition & 1 deletion R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ as.data.frame.summary_emm = function(x, ...) {
#' \eqn{\sqrt{rF(\alpha; r, d)}}{sqrt[r*qf(alpha, r, d)]}, where \eqn{d} is
#' the error degrees of freedom and \eqn{r} is the rank of the set of linear
#' functions under consideration. By default, the value of \code{r} is
#' computed from \code{object@linfct} for each by group; however, if the
#' computed from \code{linfct(object)} for each by group; however, if the
#' user specifies an argument matching \code{scheffe.rank}, its value will
#' be used instead. Ordinarily, if there are \eqn{k} means involved, then
#' \eqn{r = k - 1} for a full set of contrasts involving all \eqn{k} means, and
Expand Down
2 changes: 1 addition & 1 deletion R/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test = function(object, null, ...) {
#' @param joint Logical value. If \code{FALSE}, the arguments are passed to
#' \code{\link{summary.emmGrid}} with \code{infer=c(FALSE, TRUE)}. If \code{joint =
#' TRUE}, a joint test of the hypothesis L beta = null is performed, where L
#' is \code{object@linfct} and beta is the vector of fixed effects estimated
#' is \code{linfct(object)} and beta is the vector of fixed effects estimated
#' by \code{object@betahat}. This will be either an \emph{F} test or a
#' chi-square (Wald) test depending on whether degrees of freedom are
#' available. See also \code{\link{joint_tests}}.
Expand Down
8 changes: 8 additions & 0 deletions man/emmGrid-methods.Rd

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

2 changes: 1 addition & 1 deletion man/extending-emmeans.Rd

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

4 changes: 2 additions & 2 deletions man/summary.emmGrid.Rd

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

1 change: 1 addition & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ reference:
- emm
- emm_example
- emm_options
- linfct
- make.tran
- str.emmGrid

Expand Down
4 changes: 2 additions & 2 deletions vignettes/messy-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ And let's construct two different reference grids:
```{r}
rg.usual <- ref_grid(mtcars.lm)
rg.usual
nrow(rg.usual@linfct)
nrow(linfct(rg.usual))
rg.nuis = ref_grid(mtcars.lm, non.nuisance = "cyl")
rg.nuis
nrow(rg.nuis@linfct)
nrow(linfct(rg.nuis))
```
Notice that we left `am` out of `non.nuisance` and hence included it in `nuisance`.
However, it interacts with `cyl`, so it was not allowed as a nuisance factor.
Expand Down

0 comments on commit fc452d0

Please sign in to comment.