简体   繁体   English

如何在 ZE1E1D3D40573127E9EE0 中的性能 package 中使用 check_model function 指定 arguments?

[英]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.

相关问题 在 R 的性能 package 中,check_model function 中的“viewport has zero dimensions”是什么意思? - What does "viewport has zero dimensions" mean in check_model function in the performance package for R? R:nlme 包中具有自相关错误的混合效应模型:如何检查模型的 ARMA 假设? - R: Mixed effects model with autocorrelated errors in nlme Package: How do I check model the ARMA assumptions? 如何在 R 中的三元 plot (ggtern) 中指定 model? - How do I specify a model in a ternary plot (ggtern) in R? 如何优化 R 中词干提取和拼写检查的性能? - How do i optimize the performance of stemming and spell check in R? 如何在 R 中的函数(写为字符串)中提取参数? - How do I extract arguments in a function (written as a string) in R? 如何在 R ZEFE90A8E604A7C840E88D03A7DZ 中为 function arguments 设置别名? - How to set aliases for function arguments in an R package? 如何指定要在R包eHOF中使用的模型类型? - How to specify the model type to be used in R package eHOF? 在R中,如何检查卸载包中是否存在函数? - In R, how can I check for the existence of a function in an unloaded package? How to specify all levels for R{stats} predict() function in non linear mixed model after model fit with package medrc - How to specify all levels for R{stats} predict() function in non linear mixed model after model fit with package medrc 如何将函数参数传递给R模型对象 - How to pass function arguments to R model object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM