r - 在 R 中运行具有预定义方差分量的线性混合模型(lmer,lme4)
问题描述
我正在创建一个线性混合模型,我确实提前估计/定义了我的方差分量。现在我想将它们添加到函数中,但我不知道该怎么做。目前使用的“lme4”包中的“lmer”函数确实估计了方差分量,我不知道如何预先定义它们。
提前致谢!
For Example this data:
library(lme4)
f <- rnorm(10, mean=1.4025, sd=0.101)
m <- rnorm(10, mean=1.9025, sd=0.15)
gain <- c(f,m,f,m)
s <- c("f","f","f","f","f","m","m","m","m","m")
sex <- c(s,s,s,s)
i <- c(1:10)
anim <- as.factor(c(i,i,i,i))
invented <- data.frame(gain,sex,anim)
# model
lmm <- lmer(gain ~ sex + (1|anim), data = d)
summary(lmm)
# How can I add variance components to the model?
# Fixed-effect-variance = 0.0135
# Random-effect-variance = 0.0045
解决方案
推荐阅读
- javascript - 每次输入更改时如何使用服务器数据制作 antd 自动完成更新下拉列表
- reactjs - 在 Next.js 版本 9.1.1 的 tsx 文件中找不到 .less 模块
- twilio - Twilio - getSubscribedChannels / getLocalChannels 在首次加载时返回错误排序
- laravel - MPDF作为奇怪的字符串输出到浏览器
- apache - 如何检查导致 EC2 实例 CPU 使用率高的原因
- php - 我的 ajax 函数不能在某些视图中运行
- javascript - 为什么在使用打字稿装饰器时为descriptor.value分配不同的函数
- ruby-on-rails - link_to 重定向到“SHOW”方法而不是“DELETE”
- angular - 如何从 ngOnInit Angular 中的服务获取数据
- tabulator - 制表数据树扩展