temp.cont {TempCont} | R Documentation |
TempCont: Temporal contributions on trends using mixed models
Description
When using temporal data, linear models provide parameter estimates that help to understand how, for instance, interannual variability in a response variable is affected by a predictor. However, if the response variable and the predictors present trends, things get a bit more tricky. This methodology is aimed at estimating the effect of the trend in the predictors on the observed trend of the response variable. To do so, our package first calculates the observed trend of the response (slope estimate ± standard error of the slope) in the data data using GLMMs with random slopes and temporal autocorrelation structure (ARMA, p = 1, q = 0). Then it calculates the trend predicted by the model provided by the user and the trend predicted by the same model but maintaining the predictor of interest constant (i.e., using the median values per grouping level, while all other predictors change according to the observations). The difference between the temporal predictions for the whole model and the temporal predictions of the model when one variable is controlled is the average temporal contribution of that predictor to the trend in the response variable. The difference between all individual temporal contributions and the observed trend (should be calculated separately) should considered to be unknown contributions. Finally, the package also calculates the average sensitivities of the response variable to predictor changes by dividing the temporal contributions by the trends of the predictor variables. All errors are calculated using the error-propagation method. See Fernández-Martínez et al., 2017 and 2019 for further information on the methodology.
Usage
temp.cont(model, driver, random, timevar="year", plot=TRUE)
Arguments
model |
Fitted "lme" model. I must be a mixed model with gaussian distribution, and it is advisable to control for temporal autocorrelation at lag 1 (e.g., corCAR1()) |
driver |
Driver of interest. It must be a continous variable. |
random |
Grouping factor. |
plot |
if |
timevar |
name of the time variable. |
Value
A data.frame with the following variables for each driver variable. Row names correspon to the the name of the variable.
mod.slope |
Trend of the response variable predicted by the model. |
mod.slope.se |
Standard error of mod.slope. |
mod.slope.t |
t-value of mod.slope |
mod.slope.p |
P-value of mod.slope |
temp.contr |
Temporal contribution of the predictor |
temp.contr.se |
Standard error of temp.contr |
temp.contr.t |
t-value of temp.contr |
temp.contr.p |
P-value of temp.contr |
pred.trend |
Trend of the predictor |
pred.trend.se |
Standard error of pred.trend |
pred.trend.t |
t-value of pred.trend |
pred.trend.p |
P-value of pred.trend |
sensit |
Trend sensitivity of the response variable to the predictor |
sensit.se |
Standard error of sensit |
sensit.t |
t-value of sensit |
sensit.p |
P-value of sensit |
Author(s)
Marcos Fernández-Martínez, Joan Maspons
References
Fernández-Martínez et al., 2017. "Atmospheric deposition, CO2, and change in the land carbon sink". Scientific Reports 7:9632.
Fernández-Martínez et al., 2019. "Global trends in carbon sinks and their relationships with CO2 and temperature". Nature Climate Change 9:73–79.
Examples
library (nlme)
data(tempcont_data)
mod <- lme(trolls ~ bushes + temperature + rainfall + drought + gremlins +
orcs + warlocks, data=tempcont_data, random=~1|cave,
correlation=corCAR1(form=~year|cave), method="ML")
summary(mod)
temp.cont(model = mod, driver="temperature", random="cave")
# Warning: long runtime (> 20 seconds)
temp.cont(model = mod, random="cave")