||
最近有个glmm.hp的用户反馈他获得每个固定效应因子的(fixed effect)的Individual值的和并不等于总的marginal R2。
通过我排查后,发现问题是他的原始数据中,有一些没有应用到模型中的有些列里面具有NA值(红色的地方)引起的。
glmm.hp函数输入对象很非常简单,即lme4包、nlme包和glmmTMB包运行(G)LMM得到模型对象均可。glmm.hp运行过程需要从“模型对象”中获取原始的data, 我之前在运行过程加上na.omit函数对所提取的原始数据先删除含有NA的行,目的是为了保证如果预测变量带有NA(黄色标识),需要将这些行去掉,否则会导致在模型子集过程每次所运行的数据不一样,比如运行单独含有“focal”作为predictor的时候,第一行会被去掉,而运行单独有“difference”作为predictor的时,第二行会被去掉,第一行则会被保留的,这样导致两次运行的数据不一样,这样就会导致结果不准。如果非使用的列变量中含有NA,提前用na.omit进行处理,就会把例如图中第21行也去掉,而这一行所用到的数据列是完整的,这就会导致用于分解的数据会比原始数据少,导致了分解前全模型跟后面用于分解的子模型的数据不一样,所以导致基于原始数据算出来的总marginal R2跟分解后的总和不匹配。现在已经新的包已经考虑的这个问题,先去判predictor中是否有NA,如果有,找到NA的行并去掉,而不是将全部含有NA的行去掉。所以目前解决这个问题,请大家更新包,CRAN和github均已经更新,如果您之前的数据出现过这种情况,请您更新包后重新计算。R包总是在用户不断尝试反馈过程中完善,这是R开源的优势和魅力所在!
glmm.hp的文章已经在Journal of Plant Ecology今年最后一期上正式发表,请各位及时重新安装,(install.packages("glmm.hp"))即可。另外,请各位使用glmm.hp的用户在文章中务必使用如下的引用:Jiangshan Lai, Yi Zou, Shuang Zhang, Xiaoguang Zhang,Lingfeng Mao(2022). glmm.hp: an R package for computing individual effect of predictors in generalized linear mixed models. Journal of Plant Ecology,15(6):1302-1307
目前已经有6篇SCI文章引用JPE的文章,列表如下:
1. Wan, J.-Z., Wang, Q., and Wang, C.-J. (2023). Biomass and nitrogen content of petiole and rachis predict leaflet trait variation in compound pinnate leaves of plants. Flora 298, 152207. doi: https://doi.org/10.1016/j.flora.2022.152207.
2. Wang, C., Wang, S., Fu, B., Li, Z., and Lü, Y. (2022). Plantation understorey legume functional groups enhance soil organic carbon sequestration by promoting species richness. Land Degrad. Dev.. doi: https://doi.org/10.1002/ldr.4598.
3. Yunwei, H., Qing, W., Fucheng, L., Yalin, G., Weipo, Y., Yida, A., et al. (2023). The difference in soil organic carbon distribution between natural and planted forests: A case study on stony soils mountainous area in the Upper Min River Arid Valley, China. Soil Use and Management 39(1), 147-160. doi: https://doi.org/10.1111/sum.12860.
4. Zhang, M., Gao, H., Chen, S., Wang, X., Mo, W., Yang, X., et al. (2022). Linkages between stomatal density and minor leaf vein density across different altitudes and growth forms. Front. Plant Sci. 13. doi: 10.3389/fpls.2022.1064344.
5. Yong Cao, Lizhu Wang (2023)How to Statistically Disentangle the Effects of Environmental Factors and Human Disturbances: A Review . Water, 15(4) https://doi.org/10.3390/w15040734
6. Jiqi Gu, Xiaotong Song, Yujia Liao, Yanhui Ye, Ruihong Wang, Heping Ma, Xiaoming Shao.(2022)Tree Species Drive the Diversity of Epiphytic Bryophytes in the Alpine Forest Ecosystem: A Case Study in Tibet. Forests, 13(12), https://doi.org/10.3390/f13122154
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-25 03:41
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社