Skip to content

Commit

Permalink
Contrasts fix for qdrg (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlenth committed Jul 11, 2024
1 parent f995b7b commit 9732845
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
8 changes: 0 additions & 8 deletions .gitignore

This file was deleted.

1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ title: "NEWS for the emmeans package"
* Change that allows factors to have `NA` levels (#500). This
was previously not allowed, and we added an `"allow.na.levs"` option
(defaults to `TRUE`) just in case we broke anything that used to work.
* Better default contrasts in `qdrg()` (#501)


## emmeans 1.10.3
Expand Down
8 changes: 5 additions & 3 deletions R/qdrg.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ qdrg = function(formula, data, coef, vcov, df, mcmc, object,
result$vcov = stats::vcov(object)
if(missing(df))
result$df = df.residual(object)
if(missing(contrasts))
result$contrasts = object$contrasts
if(missing(contrasts))
contrasts = object$contrasts
if(any(is.na(result$coef)))
result$qr = object$qr
}
else {
else { # missing(object) == TRUE
if(missing(formula))
stop("When 'object' is missing, must at least provide 'formula'")
result$formula = formula
Expand All @@ -169,6 +169,8 @@ qdrg = function(formula, data, coef, vcov, df, mcmc, object,
if (!missing(coef)) result$coef = coef
if (!missing(vcov)) result$vcov = vcov
if(!missing(df)) result$df = df
if(missing(contrasts))
contrasts = attr(model.matrix(result$formula, data = data[1:2, ]), "contrasts")
}
if(!missing(df)) result$df = df
if(is.null(result$df))
Expand Down
17 changes: 0 additions & 17 deletions emmeans.Rproj

This file was deleted.

0 comments on commit 9732845

Please sign in to comment.