使用 lme4 或 lmertest 包研究随机效应的策略?
我有一个训练数据集(95 840 行):
str(train)
$ NUM_DEVICE_ID_COUPON : Factor w/ 9 levels "8647","8666",..: 3 4 5 8 9 1 2 3 4 6 ...
$ TEMPERATURE_AIR : num 6.29 6.13 6 7.05 8.16 ...
$ MonthNumber : Factor w/ 12 levels "1","2","3","4",..: 10 10 10 10 10 10 10 10
$ HOURS : Factor w/ 24 levels "0","1","2","3",..: 7 7 7 7 7 8 8 8 8 8 ...
$ TEMPERATURE_COUPON : num 5.1 6.6 4.5 5.4 4.7 ...
感谢线性模型,
lm(TEMPERATURE_COUPON ~ TEMPERATURE_AIR * MonthNumber * HOURS, ...)
通过上述交互获得了最佳模型(基于 BIC)。
所以现在我想通过研究 NUM_DEVICE_ID_COUPON 的随机效应来改进我的最佳模型(减少 BIC)。
首先,从先前交互的固定效应开始是个好主意吗?
但我不知道研究哪些随机效应:对于截距,对于每个单独的协变量 TEMPERATURE_AIR、MonthNumber 和 HOURS? NUM_DEVICE_ID_COUPON 函数中每个协变量的绘图对我有帮助吗?
library(lme4)
reg_ml1 = lmer(TEMPERATURE_COUPON ~ TEMPERATURE_AIR * MonthNumber * HOURS +
(1 + TEMPERATURE_AIR | NUM_DEVICE_ID_COUPON) + ( 1 + TEMPERATURE_AIR | NUM_DEVICE_ID_COUPON) + ....)
策略是什么?
感谢您的帮助。
I have a training dataset (95 840 rows) with:
str(train)
$ NUM_DEVICE_ID_COUPON : Factor w/ 9 levels "8647","8666",..: 3 4 5 8 9 1 2 3 4 6 ...
$ TEMPERATURE_AIR : num 6.29 6.13 6 7.05 8.16 ...
$ MonthNumber : Factor w/ 12 levels "1","2","3","4",..: 10 10 10 10 10 10 10 10
$ HOURS : Factor w/ 24 levels "0","1","2","3",..: 7 7 7 7 7 8 8 8 8 8 ...
$ TEMPERATURE_COUPON : num 5.1 6.6 4.5 5.4 4.7 ...
Thanks to a Linear Model
lm(TEMPERATURE_COUPON ~ TEMPERATURE_AIR * MonthNumber * HOURS, ...)
the best model (based on BIC) is gotten with this above interaction.
So now I want to improve my best model (reduce BIC) by studying random effects of NUM_DEVICE_ID_COUPON.
First is it a good idea to start from fixed effects with the previous interaction?
But I have no idea to study which random effects: for the intercept, for each individual covariable TEMPERATURE_AIR, MonthNumber and HOURS?
Plots of each covariable in function of NUM_DEVICE_ID_COUPON will help me?
library(lme4)
reg_ml1 = lmer(TEMPERATURE_COUPON ~ TEMPERATURE_AIR * MonthNumber * HOURS +
(1 + TEMPERATURE_AIR | NUM_DEVICE_ID_COUPON) + ( 1 + TEMPERATURE_AIR | NUM_DEVICE_ID_COUPON) + ....)
What's the strategy?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论