Description Usage Arguments Value Author(s) Examples
fitGwexModel: fit a GWex model to observations.
1 | fitGwexModel(objGwexObs, listOption = NULL)
|
objGwexObs |
an object of class |
listOption |
for precipitation, a list with the following fields:
and for temperature, a list with the following fields:
|
Return an object of class GwexFit
with:
p: The number of station,
version: package version,
variable: the type of variable,
fit: a list containing the list of options listOption
and the list of estimated parameters listPar
.
Guillaume Evin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # Format dates corresponding to daily observations of precipitation and temperature
vecDates = seq(from=as.Date("01/01/2005",format="%d/%m/%Y"),
to=as.Date("31/12/2014",format="%d/%m/%Y"),by='day')
###############################################################
# FIT THE PRECIPITATION MODEL
###############################################################
# Format observations: create a G-Wex object
myObsPrec = GwexObs(variable='Prec',date=vecDates,obs=dailyPrecipGWEX[,1:2])
# Example of a data.frame which can be used for 'xiHat'. For each month, xi values
#can be prescribed, for example using a regionalisation method.
xiReg = data.frame(station=c('S1','S2','S3'),JAN=c(0,0,0.06),FEB=c(0,0,0.06),
MAR=c(0,0,0.01),APR=c(0,0,0.01),MAY=c(0,0,0.01),
JUN=c(0,0.01,0.14),JUL=c(0,0.01,0.14),AUG=c(0,0.01,0.14),
SEP=c(0,0,0.02),OCT=c(0,0,0.02),NOV=c(0,0,0.02),
DEC=c(0,0,0.06))
# Options: specify the threshold for precipitation (0.5 mm) to distinguish wet and
# dry states (th), xi values for the DGPD distribution (xiHat), a Student copula for
# the spatial dependence (copulaInt), a model based on 3-day aggregated values
# (is3Damount), a MAR(1) process (isMAR), a EGPD distribution for marginal intensities
# ('typeMargin'), and 200 replicates for the runs used during the fitting process
# (this value being 100,000 by default, in order to obtain a reasonable precision of the
# estimates)
list.options = list(th=0.5,nLag=1,xiHat=xiReg,copulaInt='Student',is3Damount=TRUE,isMAR=TRUE,
typeMargin='EGPD',nChainFit=200)
# Fit precipitation model
myParPrec = fitGwexModel(myObsPrec,list.options) # fit model
myParPrec # print object
###############################################################
# FIT THE TEMPERATURE MODEL, COND. TO PRECIPITATION
###############################################################
# Format observations: create a G-Wex object
myObsTemp = GwexObs(variable='Temp',date=vecDates,obs=dailyTemperGWEX)
# Fit temperature model with a long-term linear trend ('hasTrend'), Gaussian margins
# ('typeMargin') and Gaussian spatial dependence ('depStation')
myParTemp = fitGwexModel(myObsTemp,listOption=list(hasTrend=TRUE,typeMargin='Gaussian',
depStation='Gaussian'))
myParTemp # print object
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.