zhang2sha的个人博客分享 http://blog.sciencenet.cn/u/zhang2sha

博文

时空自相关数据的处理--Science案例

已有 453 次阅读 2024-3-9 08:43 |系统分类:科研笔记

时间,空间自相关会影响数据的独立性,也是审稿人问无可问时,经常顺道来一嘴的问题,当然更是时常困扰我们,一句话把我们打进万丈深渊的的问题之一。上周五(2月29号),Science上发表的Divergent responses of pelagic and benthic fish body-size structure to remoteness and protection from humans这篇文章,研究了两类群鱼类对不同因素相应的变化,其中就涉及到了时空自相关数据的处理问题(Letessier et al. 2024)。

图片1.png

该研究考虑了众多因素,以及一些因素之间的交互作用,对鱼类的体型大小的影响。其主模型可以用以下公式表示:

图片2.png

在这些模型中,作者采用nlme包下的gls函数,对数据存在的时空自相关进行了考虑,其文中讲到:

图片3.png

由于gls中提供了不同的自相关类型,作者便将所有的类型都跑了一遍,然后用AIC值选择哪种结构与其数据最为匹配,即按照以下代码操作:

### 定义模型因变量和自变量的关系

formula<-"betaslope ~ bruvs*protection_use*(logBathy + Slope + logDistP +

logDistSM + logTTM + logDistCR + logDistC+ poly(logSST, 2) + poly(logCHL,2))"

### 构建具有不同自相关结构的模型

mod1 <- nlme::gls(formular, data = data, correlation = nlme::corAR1(form=~1))

mod2 <- nlme::gls(formular, data = data, correlation = nlme::corExp(form=~1))

mod3 <- nlme::gls(formular, data = data, correlation = nlme::corGaus(form=~1))

mod4 <- nlme::gls(formular, data = data, correlation = nlme::corLin(form=~1))

mod5 <- nlme::gls(formular, data = data, correlation = nlme::corRatio(form=~1))

mod6 <- nlme::gls(formular, data = data, correlation = nlme::corSpher(form=~1))

mod7 <- nlme::gls(formular, data = data, correlation = nlme::corAR1(form=~mean_long+mean_lat))

mod8 <- nlme::gls(formular, data = data, correlation = nlme::corExp(form=~mean_long+mean_lat))

mod9 <- nlme::gls(formular, data = data, correlation = nlme::corGaus(form=~mean_long+mean_lat))

mod10 <- nlme::gls(formular, data = data, correlation = nlme::corLin(form=~mean_long+mean_lat))

mod11 <- nlme::gls(formular, data = data, correlation = nlme::corRatio(form=~mean_long+mean_lat))

mod12 <- nlme::gls(formular, data = data, correlation = nlme::corSpher(form=~mean_long+mean_lat))

###根据AIC值,选出与数据最为匹配的结构

a <- AIC(mod1, mod2, mod3, mod4, mod5, mod6, mod7, mod8, mod9, mod10, mod11, mod12)

print(a)

欢迎大家关注我的个人微信公众号:二傻统计

 二傻统计.jpg

参考文献:

Letessier, T. B., D. Mouillot, L. Mannocci, H. Jabour Christ, E. M. Elamin, S. M. Elamin, A. M. Friedlander, A. Hearn, J.-B. Juhel, A. R. Kleiven, E. Moland, N. Mouquet, P. J. Nillos-Kleiven, E. Sala, C. D. H. Thompson, L. Velez, L. Vigliola, and J. J. Meeuwig. 2024. Divergent responses of pelagic and benthic fish body-size structure to remoteness and protection from humans. Science 383:976-982.

 



https://blog.sciencenet.cn/blog-3442043-1424619.html

上一篇:混合模型为何能如此风靡?
下一篇:Biological review: 如何正确检验与解读交互作用
收藏 IP: 103.47.100.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-28 04:11

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部