##########################################################################
# 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)
ClimateProjections = cbind(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 = data.frame(GCM=c('GCM1','GCM1','GCM2'),RCM=c('RCM1','RCM2','RCM1'))
listOption = list(nBurn=20,nKeep=30,type.temporal.dep="iid",type.hetero="constant")
QUALYPSOSSOUT = QUALYPSOSS(ClimateProjections=ClimateProjections,scenAvail=scenAvail,
listOption=listOption)
# QUALYPSOSSOUT output contains many different information about climate projections uncertainties,
# which can be plotted using the following functions.
# plotQUALYPSOSSClimateResponse draws the climate responses, for all simulation chains,
# in comparison to the raw climate responses.
plotQUALYPSOSSClimateResponse(QUALYPSOSSOUT)
# plotQUALYPSOSSClimateChangeResponse draws the climate change responses, for all simulation chains.
plotQUALYPSOSSClimateChangeResponse(QUALYPSOSSOUT)
# plotQUALYPSOSSeffect draws the estimated effects, for a discrete predictor specified by iEff,
# as a function of the continuous predictor.
plotQUALYPSOSSeffect(QUALYPSOSSOUT, iEff = 1)
plotQUALYPSOSSeffect(QUALYPSOSSOUT, iEff = 2)
# plotQUALYPSOSSgrandmean draws the estimated grand mean, as a function of the continuous predictor.
plotQUALYPSOSSgrandmean(QUALYPSOSSOUT)
# plotQUALYPSOSSTotalVarianceDecomposition draws the decomposition of the total variance responses,
# as a function of the continuous predictor.
plotQUALYPSOSSTotalVarianceDecomposition(QUALYPSOSSOUT)
Run the code above in your browser using DataLab