# 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 Gwex object for one station only to show a quick
# example. The syntax is similar for multi-site applications.
myObsPrec = GwexObs(variable='Prec',date=vecDates,obs=dailyPrecipGWEX[,1,drop=FALSE])
# Fit precipitation model with a threshold of 0.5 mm to distinguish wet and dry
# states (th) and keep default options otherwise, e.g. a Gaussian
# copula for the spatial dependence (copulaInt) and a mixExp distribution for
# marginal intensities ('typeMargin')
myParPrec = fitGwexModel(myObsPrec,listOption=list(th=0.5))
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
Run the code above in your browser using DataLab