如何从模型结构中删除数据的某些元素
以下是我的数据示例:
> dput(mydata1)
structure(list(subject = c("E1", "E1", "E1", "E1", "E1", "E1",
"E1", "E1", "E1", "E1", "E1", "E1"), block = c(3, 3, 3, 4, 4,
4, 5, 5, 5, 6, 6, 6), condition = c("EI", "EI", "I", "EI", "EI",
"I", "EI", "EI", "I", "EI", "EI", "I"), RT = c(271, 370, 469,
409, 560, 1506, 544, 544, 978, 452, 340, 645), Item_number = c(1,
2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)), row.names = c(NA, -12L), class = c("tbl_df",
"tbl", "data.frame"))
> mydata1
# A tibble: 12 x 5
subject block condition RT Item_number
<chr> <dbl> <chr> <dbl> <dbl>
1 E1 3 EI 271 1
2 E1 3 EI 370 2
3 E1 3 I 469 3
4 E1 4 EI 409 1
5 E1 4 EI 560 2
6 E1 4 I 1506 3
7 E1 5 EI 544 1
8 E1 5 EI 544 2
9 E1 5 I 978 3
10 E1 6 EI 452 1
11 E1 6 EI 340 2
12 E1 6 I 645 3
我可以使用LME4运行混合效应模型。
library(lme4)
mydata1_model <- lmer(RT ~ block + (1|Item_number), REML = F, data=mydata1, na.action= na.exclude)
summary(mydata1_model)
在从模型结构中删除item_number = 3之后,我正在尝试重新运行此分析。我可以轻松地从数据集中删除它,但是由于我正在运行多个模型,出于我正在执行的任务目的,从模型结构中删除item_number 3是更有意义的。基本上,我试图查看与此item_number有或没有的模式是否相同。
1)我想知道是否有任何方法可以修改下面模型的内部结构以适应此更改:
mydata1_model <- lmer(RT ~ block + (1|Item_number), REML = F, data=mydata1, na.action= na.exclude)
- 是否可以删除多个元素,例如item_number 3和item_number 2?
请注意,在实际数据中,有很多主题,当然我需要在所有数据集中进行此更改工作。
预先感谢您的帮助,
Below is the sample of my data:
> dput(mydata1)
structure(list(subject = c("E1", "E1", "E1", "E1", "E1", "E1",
"E1", "E1", "E1", "E1", "E1", "E1"), block = c(3, 3, 3, 4, 4,
4, 5, 5, 5, 6, 6, 6), condition = c("EI", "EI", "I", "EI", "EI",
"I", "EI", "EI", "I", "EI", "EI", "I"), RT = c(271, 370, 469,
409, 560, 1506, 544, 544, 978, 452, 340, 645), Item_number = c(1,
2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)), row.names = c(NA, -12L), class = c("tbl_df",
"tbl", "data.frame"))
> mydata1
# A tibble: 12 x 5
subject block condition RT Item_number
<chr> <dbl> <chr> <dbl> <dbl>
1 E1 3 EI 271 1
2 E1 3 EI 370 2
3 E1 3 I 469 3
4 E1 4 EI 409 1
5 E1 4 EI 560 2
6 E1 4 I 1506 3
7 E1 5 EI 544 1
8 E1 5 EI 544 2
9 E1 5 I 978 3
10 E1 6 EI 452 1
11 E1 6 EI 340 2
12 E1 6 I 645 3
I could run mixed-effects model using lme4.
library(lme4)
mydata1_model <- lmer(RT ~ block + (1|Item_number), REML = F, data=mydata1, na.action= na.exclude)
summary(mydata1_model)
I am trying to re-run this analysis after removing the Item_number = 3 from the model strucure. I could easily remove it from the dataset, however since I am running multiple models, for the purpose of the task I am doing, it would make more sense to remove Item_number 3 from the model structure. Basically, I am trying to see if the patterns would be the same with or without this Item_number.
1)I am wondering if there is any way I could modify the internal structure of the model below to accommodate this change:
mydata1_model <- lmer(RT ~ block + (1|Item_number), REML = F, data=mydata1, na.action= na.exclude)
- Would it be possible to remove more than one element, for example Item_number 3 and Item_number 2?
Please note that in the actual data, there are many subjects and of course I need this change work across all data set.
Thanks in advance for your help,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论