fitGwexModel {GWEX} | R Documentation |
fitGwexModel: fit a GWex model to observations.
Description
fitGwexModel: fit a GWex model to observations.
Usage
fitGwexModel(objGwexObs, parMargin = NULL, listOption = NULL)
Arguments
objGwexObs |
an object of class |
parMargin |
(not required for temperature) list parMargin where and each element corresponds to a month (1...12) and contains a matrix nStation x 3 of pre-estimated parameters of the marginal distributions (EGPD or Mixture of Exponentials) |
listOption |
for precipitation, a list with the following fields:
and for temperature, a list with the following fields:
|
Value
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 parameterslistPar
.
Author(s)
Guillaume Evin
Examples
# 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