[英]How do I specify arguments with the check_model function in the performance package in R?
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'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.我希望
check_model
给我除了检查有影响的观察之外的所有检查。 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.问题是我可以使用
check =
参数来指定一个检查,但是一旦我要求它执行多个检查,它就会吐出一个错误。 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
munched$size[start] *.pt 中的错误:二进制运算符的非数字参数
This solves your problem.这解决了你的问题。 You should read the documentation of the function
check_model()
with much more attention.您应该更加注意阅读 function
check_model()
的文档。 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()
.参数
check
可以是字符向量,因此您所缺少的只是用c()
将"mcv"
和"qq"
包装在一个向量中。
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)由reprex package (v1.0.0) 于 2021 年 3 月 3 日创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.