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

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

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)

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

## 全部精选博文导读

GMT+8, 2024-5-28 21:55