0

I'm using the check_model function within the performance package in r (version 4.0.3) to check the assumptions of a linear mixed model I've built in lmer4. I want check_model to give me all checks apart from the check for influential observations. The problem is I can use the check = argument to specify a single check, but as soon as I ask it to perform multiple checks, it spits out an error. The reproducible code is below

library(tidyverse)
library(lme4)
test_data <- read_csv("https://raw.githubusercontent.com/gjpstrain/mixed_models_assignment/main/assignment1_data1(1).csv")`
tidy_test_data <- test_data %>%
  mutate(subj = factor(subj), item = factor(item), (condition = factor(condition))
test_model <- lmer(DV ~ condition + (1 | subj) + (1 | item), data = tidy_test_data)
check_model(test_model, dot_size = .65, check = "ncv", "qq)

When I ask for more than one check I get the following error:

Error in munched$size[start] * .pt : non-numeric argument to binary operator

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453

1 Answers1

1

This solves your problem. You should read the documentation of the function check_model() with much more attention. The argument check can be a character vector so all you were missing was to wrap up "mcv" and "qq" in a vector with c().

Also, you did not specify all the required packages. Please, edit your question accordingly to make your problem reproducible.

library(tidyverse)
library(lme4)
#> Loading required package: Matrix
#> 
#> Attaching package: 'Matrix'
#> The following objects are masked from 'package:tidyr':
#> 
#>     expand, pack, unpack
library(performance)
library(see)
library(qqplotr)
#> 
#> Attaching package: 'qqplotr'
#> The following objects are masked from 'package:ggplot2':
#> 
#>     stat_qq_line, StatQqLine

test_data <- read_csv("https://raw.githubusercontent.com/gjpstrain/mixed_models_assignment/main/assignment1_data1(1).csv")
#> 
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#>   subj = col_character(),
#>   item = col_character(),
#>   DV = col_double(),
#>   condition = col_character()
#> )
tidy_test_data <- test_data %>% 
  mutate(subj = factor(subj), item = factor(item), (condition = factor(condition)))

test_model <- lmer(DV ~ condition + (1 | subj) + (1 | item), data = tidy_test_data)                       
check_model(test_model, dot_size = .65, check = c("ncv", "qq"))
#> `geom_smooth()` using formula 'y ~ x'

Created on 2021-03-03 by the reprex package (v1.0.0)

Francesco Grossetti
  • 1,555
  • 9
  • 17