Skip to content

Commit

Permalink
Kludge to fix mishandling of lmerModTest objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-long committed Jun 2, 2019
1 parent d9b360d commit ddef0b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Thanks to [Paul Djupe](http://pauldjupe.com/) for alerting me to this.
* The `tidy()` method for `sim_slopes` objects no longer returns numbers as
strings. This had downstream effects on, e.g., the `plot()` method for
`sim_slopes`. (#22; thanks to Noah Greifer)
* `sim_slopes()` now handles `lmerModTest` objects properly. Thanks to Eric
Shuman for bringing it to my attention.

# interactions 1.1.0

Expand Down
10 changes: 1 addition & 9 deletions R/simple_slopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ sim_slopes <- function(model, pred, modx, mod2 = NULL, modx.values = NULL,
tcol <- try(colnames(summary(model)$coefficients)[3], silent = TRUE)
if (class(tcol) != "try-error") {
tcol <- gsub("value", "val.", tcol)
if (tcol == "df") tcol <- "t val." # kludge for lmerModTest
which.cols <- c("Est.", "S.E.", unlist(make_ci_labs(ci.width)), tcol)
if (pvals == TRUE) {which.cols <- c(which.cols, "p")}
} else {
Expand Down Expand Up @@ -464,15 +465,6 @@ sim_slopes <- function(model, pred, modx, mod2 = NULL, modx.values = NULL,
newmod <- update(model, data = dt)
}

# Need proper name for test statistic
tcol <- try(colnames(summary(newmod)$coefficients)[3], silent = TRUE)
if (class(tcol) != "try-error") {
tcol <- gsub("value", "val.", tcol)
which.cols <- c("Est.", "S.E.", unlist(make_ci_labs(ci.width)), tcol, "p")
} else {
which.cols <- NULL
}

# Getting SEs, robust or otherwise
if (robust == TRUE) {
if (!is.null(v.cov)) {
Expand Down

0 comments on commit ddef0b9

Please sign in to comment.