# NOT RUN {
## Calculate temporal trends of spatial synchrony for conifersIP data:
data(conifersIP)
##Fit the null.model temporal trend (mBE)
#using taxonomic grouping criteria (i.e. Species)
mBE.trend <- sync.trend(TRW ~ Code, varTime = "Year", varGroup = "Species",
data = conifersIP, null.mod = TRUE, window = 30, lag = 5)
mBE.trend# it returns a data.frame
# }
# NOT RUN {
##Fit homoscedastic within-group trends (mBE, mNE, mCS, mUN)
# using geographic grouping criteria (i.e. Region)
geo.trend <- sync.trend(TRW ~ Code, varTime = "Year", varGroup = "Region",
data = conifersIP, window = 30, lag = 5,
null.mod = FALSE, homoscedastic = TRUE)
geo.trend#a data.frame with varGroup syncrony for each time window.
##Fit heteroscedastic between-group trends (mBE, mHeNE, mHeCS, mHeUN)
#using geographic grouping criteria (i.e. Region) and BIC
geo.het.trend <- sync.trend(TRW ~ Code, varTime = "Year", varGroup = "Region",
data = conifersIP, window = 30, lag = 5, null.mod = FALSE,
selection.method = c("BIC"), homoscedastic = FALSE,
between.group = TRUE)
geo.het.trend
##Fit homoscedastic and heterocedastic within-group trends
# using taxonomic grouping criteria (i.e. Species) and BIC
geo.tot.trend <- sync.trend(TRW ~ Code, varTime = "Year", varGroup = "Species",
data = conifersIP, window = 30, lag = 5,
selection.method = c("BIC"), all.mod = TRUE)
geo.tot.trend
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab