Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rpackages
IDF
Commits
3994dcb6
Commit
3994dcb6
authored
Feb 05, 2019
by
Jana Ulrich
Browse files
added example for fit with covariates
parent
99a34ee6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
R/IDF.R
R/IDF.R
+15
-1
data/example.RData
data/example.RData
+0
-0
man/gev.d.fit.Rd
man/gev.d.fit.Rd
+15
-1
No files found.
R/IDF.R
View file @
3994dcb6
...
...
@@ -333,6 +333,20 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
#' @seealso \code{\link{IDF.agg}}, \code{\link{gev.fit}}, \code{\link{optim}}
#' @author Jana Ulrich \email{jana.ulrich@@met.fu-berlin.de}
#' @export
#'
#' @examples
#' # sampled random data from d-gev with covariates
#' # GEV parameters:
#' # mu = 4 + 0.2*cov1 +0.5*cov2
#' # sigma = 2+0.5*cov1
#' # xi = 0.5
#' # theta = 0
#' # eta = 0.5
#'
#' data('example',package ='IDF')
#'
#' gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')])
#' ,mul=c(1,2),sigl=1)
'gev.d.fit'
<-
function
(
xdat
,
ds
,
ydat
=
NULL
,
mul
=
NULL
,
sigl
=
NULL
,
shl
=
NULL
,
thetal
=
NULL
,
etal
=
NULL
,
...
...
@@ -429,7 +443,7 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
y
<-
xdat
/
sigma.d
-
mu
y
<-
1
+
xi
*
y
if
(
any
(
eta
<=
0
)
||
any
(
ds.t
<=
0
)
||
any
(
sigma.d
<=
0
)
||
any
(
y
<=
0
))
return
(
10
^
6
)
if
(
any
(
eta
<=
0
)
||
any
(
theta
<=
-0.5
)
||
any
(
sigma.d
<=
0
)
||
any
(
y
<=
0
))
return
(
10
^
6
)
sum
(
log
(
sigma.d
))
+
sum
(
y
^
(
-1
/
xi
))
+
sum
(
log
(
y
)
*
(
1
/
xi
+
1
))
}
...
...
data/example.RData
0 → 100644
View file @
3994dcb6
File added
man/gev.d.fit.Rd
View file @
3994dcb6
...
...
@@ -8,7 +8,7 @@ gev.d.fit(xdat, ds, ydat = NULL, mul = NULL, sigl = NULL,
shl = NULL, thetal = NULL, etal = NULL, mulink = identity,
siglink = identity, shlink = identity, thetalink = identity,
etalink = identity, muinit = NULL, siginit = NULL, shinit = NULL,
thetainit =
0
, etainit = NULL, show = TRUE,
thetainit =
NULL
, etainit = NULL, show = TRUE,
method = "Nelder-Mead", maxit = 10000, ...)
}
\arguments{
...
...
@@ -60,6 +60,20 @@ Maximum-likelihood fitting for the duration dependent generalized extreme
value distribution, following Koutsoyiannis et al. (1988), including generalized linear
modelling of each parameter based on \code{\link{gev.fit}}.
}
\examples{
# sampled random data from d-gev with covariates
# GEV parameters:
# mu = 4 + 0.2*cov1 +0.5*cov2
# sigma = 2+0.5*cov1
# xi = 0.5
# theta = 0
# eta = 0.5
data('example',package ='IDF')
gev.d.fit(xdat=example$dat,ds = example$d,ydat=as.matrix(example[,c('cov1','cov2')])
,mul=c(1,2),sigl=1)
}
\seealso{
\code{\link{IDF.agg}}, \code{\link{gev.fit}}, \code{\link{optim}}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment