QUALYPSO | R Documentation |
Partition uncertainty in climate responses using an ANOVA applied to climate change responses.
QUALYPSO(Y, scenAvail, X = NULL, Xfut = NULL, iFut = NULL, listOption = NULL)
Y |
matrix |
scenAvail |
data.frame |
X |
(optional) predictors corresponding to the projections, e.g. time or global temperature.
It can be a vector if the predictor is the same for all scenarios (e.g. |
Xfut |
(optional) |
iFut |
index in |
listOption |
(optional) list of options
|
List providing the results for each of the n
values of Xfut
if Y
is a matrix or for each grid point if Y
is an array, with the following fields:
CLIMATERESPONSE: list of climate change responses and
corresponding internal variability. Contains phiStar
(climate change
responses), etaStar
(deviation from the climate change responses as
a result of internal variability), Ystar
(change variable from the
projections),and phi
(fitted climate responses).
GRANDMEAN: List of estimates for the grand mean:
MEAN: vector of length n
of means.
SD: vector of length n
of standard dev.
if ANOVAmethod=="QUALYPSO"
.
CI: matrix n
x 2 of credible intervals of
probability probCI
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
QUANT: matrix n
x nQ
of quantiles of
probability quantilePosterior
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
MAINEFFECT: List of estimates for the main effects. For each main effect (GCM, RCM,..), each element of the list contains a list with:
MEAN: matrix n
x nTypeEff
SD: matrix n
x nTypeEff
of standard dev.
if ANOVAmethod=="QUALYPSO"
.
CI: array n
x 2 x nTypeEff
of credible
intervals of probability probCI
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
QUANT: array n
x nQ
x nTypeEff
of
quantiles of probability quantilePosterior
given in
listOption
if ANOVAmethod=="QUALYPSO"
.
CHANGEBYEFFECT: For each main effect, list of estimates for the mean change by main effect, i.e. mean change by scenario. For each main effect (GCM, RCM,..), each element of the list contains a list with:
MEAN: matrix n
x nTypeEff
SD: matrix n
x nTypeEff
of standard dev.
if ANOVAmethod=="QUALYPSO"
.
CI: array n
x 2 x nTypeEff
of credible
intervals of probability probCI
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
QUANT: array n
x nQ
x nTypeEff
of
quantiles of probability quantilePosterior
given in
listOption
if ANOVAmethod=="QUALYPSO"
.
EFFECTVAR: Matrix n
x nTypeEff
giving, for each
time variability related to the main effects (i.e.
variability between the different RCMs, GCMs,..).
CONTRIB_EACH_EFFECT: Contribution of each individual effect
to its component (percentage), e.g. what is the contribution of GCM1 to the
variability related to GCMs. For each main effect (GCM, RCM,..), each
element of the list contains a matrix n
x nTypeEff
RESIDUALVAR: List of estimates for the variance of the residual errors:
MEAN: vector of length n
.
SD: vector of length n
of standard dev.
if ANOVAmethod=="QUALYPSO"
.
CI: matrix n
x 2 of credible intervals of
probability probCI
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
QUANT: matrix n
x nQ
of quantiles of
probability quantilePosterior
given in listOption
if
ANOVAmethod=="QUALYPSO"
.
INTERNALVAR: Internal variability (constant over time)
TOTALVAR: total variability, i.e. the sum of internal variability, residual variability and variability related to the main effects
DECOMPVAR: Decomposition of the total variability for each component
RESERR: differences between the climate change responses and the additive anova formula (grand mean + main effects)
Xmat: matrix of predictors
Xfut: future predictor values
paralType: type of parallelisation (Time or Grid)
namesEff: names of the main effects
Y: matrix of available combinations given as inputs
listOption: list of options used to obtained these results
(obtained from QUALYPSO.check.option
)
listScenarioInput: list of scenario characteristics
(obtained from QUALYPSO.process.scenario
)
Guillaume Evin
Evin, G., B. Hingray, J. Blanchet, N. Eckert, S. Morin, and D. Verfaillie (2020) Partitioning Uncertainty Components of an Incomplete Ensemble of Climate Projections Using Data Augmentation. Journal of Climate. <doi:10.1175/JCLI-D-18-0606.1>.
##########################################################################
# SYNTHETIC SCENARIOS
##########################################################################
# create nS=3 fictive climate scenarios with 2 GCMs and 2 RCMs, for a period of nY=20 years
n=20
t=1:n/n
# GCM effects (sums to 0 for each t)
effGCM1 = t*2
effGCM2 = t*-2
# RCM effects (sums to 0 for each t)
effRCM1 = t*1
effRCM2 = t*-1
# These climate scenarios are a sum of effects and a random gaussian noise
scenGCM1RCM1 = effGCM1 + effRCM1 + rnorm(n=n,sd=0.5)
scenGCM1RCM2 = effGCM1 + effRCM2 + rnorm(n=n,sd=0.5)
scenGCM2RCM1 = effGCM2 + effRCM1 + rnorm(n=n,sd=0.5)
Y.synth = rbind(scenGCM1RCM1,scenGCM1RCM2,scenGCM2RCM1)
# Here, scenAvail indicates that the first scenario is obtained with the combination of the
# GCM "GCM1" and RCM "RCM1", the second scenario is obtained with the combination of
# the GCM "GCM1" and RCM "RCM2" and the third scenario is obtained with the combination
# of the GCM "GCM2" and RCM "RCM1".
scenAvail.synth = data.frame(GCM=c('GCM1','GCM1','GCM2'),RCM=c('RCM1','RCM2','RCM1'))
##########################################################################
# RUN QUALYPSO
##########################################################################
# call main QUALYPSO function: two arguments are mandatory:
# - Y: Climate projections for nS scenarios and nY time steps. if Y is a matrix nS x nY, we
# run QUALYPSO nY times, for each time step. If Y is an array nG x nS x nY, for nG grid points,
# we run QUALYPSO nG times, for each grid point, for one time step specified using the argument
# iFut
# - scenAvail: matrix or data.frame of available combinations nS x nEff. The number of
# characteristics nEff corresponds to the number of main effects that will be included in the
# ANOVA model. In the following example, we have nEff=2 main effects corresponding to the GCMs
# and RCMs.
# Many options can be specified in the argument "listOption". When ANOVAmethod=="QUALYPSO"
# a Bayesian inference is performed. Here, we change the default values for nBurn and nKeep
# in order to speed up computation time for this small example. However, it must be noticed
# that convergence and sampling of the posterior distributions often require higher values
# for these two arguments.
listOption = list(nBurn=100,nKeep=100,ANOVAmethod="QUALYPSO",quantilePosterior=c(0.025,0.5,0.975))
# run QUALYPSO
QUALYPSO.synth = QUALYPSO(Y=Y.synth, scenAvail=scenAvail.synth, X=2001:2020, listOption=listOption)
##########################################################################
# SOME PLOTS
##########################################################################
# plot grand mean
plotQUALYPSOgrandmean(QUALYPSO.synth,xlab="Years")
# plot main GCM effects
plotQUALYPSOeffect(QUALYPSO.synth,nameEff="GCM",xlab="Years")
# plot main RCM effects
plotQUALYPSOeffect(QUALYPSO.synth,nameEff="RCM",xlab="Years")
# plot fraction of total variance for the differences sources of uncertainty
plotQUALYPSOTotalVarianceDecomposition(QUALYPSO.synth,xlab="Years")
# plot mean prediction and total variance with the differences sources of uncertainty
plotQUALYPSOMeanChangeAndUncertainties(QUALYPSO.synth,xlab="Years")
#____________________________________________________________
# EXAMPLE OF QUALYPSO WHEN THE PREDICTOR IS TIME
#____________________________________________________________
# list of options
listOption = list(typeChangeVariable='abs')
# call QUALYPSO
QUALYPSO.time = QUALYPSO(Y=Y,scenAvail=scenAvail,X=X_time_vec,
Xfut=Xfut_time,listOption=listOption)
# grand mean effect
plotQUALYPSOgrandmean(QUALYPSO.time,xlab="Years")
# main GCM effects
plotQUALYPSOeffect(QUALYPSO.time,nameEff="GCM",xlab="Years")
# main RCM effects
plotQUALYPSOeffect(QUALYPSO.time,nameEff="RCM",xlab="Years")
# mean change and associated uncertainties
plotQUALYPSOMeanChangeAndUncertainties(QUALYPSO.time,xlab="Years")
# variance decomposition
plotQUALYPSOTotalVarianceDecomposition(QUALYPSO.time,xlab="Years")
#____________________________________________________________
# EXAMPLE OF QUALYPSO WHEN THE PREDICTOR IS THE GLOBAL TEMPERATURE
#____________________________________________________________
# list of options
listOption = list(typeChangeVariable='abs')
# call QUALYPSO
QUALYPSO.globaltas = QUALYPSO(Y=Y,scenAvail=scenAvail,X=X_globaltas,
Xfut=Xfut_globaltas,listOption=listOption)
# grand mean effect
plotQUALYPSOgrandmean(QUALYPSO.globaltas,xlab="Global warming (Celsius)")
# main GCM effects
plotQUALYPSOeffect(QUALYPSO.globaltas,nameEff="GCM",xlab="Global warming (Celsius)")
# main RCM effects
plotQUALYPSOeffect(QUALYPSO.globaltas,nameEff="RCM",xlab="Global warming (Celsius)")
# mean change and associated uncertainties
plotQUALYPSOMeanChangeAndUncertainties(QUALYPSO.globaltas,xlab="Global warming (Celsius)")
# variance decomposition
plotQUALYPSOTotalVarianceDecomposition(QUALYPSO.globaltas,xlab="Global warming (Celsius)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.