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
99a34ee6
Commit
99a34ee6
authored
Jan 25, 2019
by
Jana Ulrich
Browse files
Fehler bei covariaten für eta und theta gefixt
parent
0b17c3d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
R/IDF.R
R/IDF.R
+7
-7
No files found.
R/IDF.R
View file @
99a34ee6
...
...
@@ -337,7 +337,7 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
'gev.d.fit'
<-
function
(
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
,
muinit
=
NULL
,
siginit
=
NULL
,
shinit
=
NULL
,
thetainit
=
NULL
,
etainit
=
NULL
,
show
=
TRUE
,
method
=
"Nelder-Mead"
,
maxit
=
10000
,
...
)
{
#
...
...
@@ -357,7 +357,7 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
z
$
trans
<-
FALSE
# indicates if fit is non-stationary
# calculate initial values for mu.d, sigma_0, xi, eta using IDF.init: (thetainit=0)
init.vals
<-
gev.d.init
(
xdat
,
ds
,
thetainit
)
init.vals
<-
gev.d.init
(
xdat
,
ds
,
ifelse
(
is.null
(
thetainit
),
0
,
thetainit
[
1
])
)
# generate covariates matrices:
if
(
is.null
(
mul
))
{
...
...
@@ -392,12 +392,12 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
}
if
(
is.null
(
thetal
))
{
thmat
<-
as.matrix
(
rep
(
1
,
length
(
xdat
)))
#
if (is.null(thetainit))
#
thetainit <- 0
if
(
is.null
(
thetainit
))
thetainit
<-
0
}
else
{
z
$
trans
<-
TRUE
thmat
<-
cbind
(
rep
(
1
,
length
(
xdat
)),
ydat
[,
thetal
])
if
(
is.null
(
thetainit
))
if
(
is.null
(
thetainit
))
thetainit
<-
c
(
0
,
rep
(
0
,
length
(
thetal
)))
}
if
(
is.null
(
etal
))
{
...
...
@@ -408,13 +408,13 @@ IDF.nll <- function(mu=0,sigma=1,xi=0,theta=0,eta=1,x,d,use.log=F,DEBUG=F) {
z
$
trans
<-
TRUE
etmat
<-
cbind
(
rep
(
1
,
length
(
xdat
)),
ydat
[,
etal
])
if
(
is.null
(
etainit
))
etainit
<-
c
(
init.vals
$
eta
,
rep
(
0
,
length
(
th
etal
)))
etainit
<-
c
(
init.vals
$
eta
,
rep
(
0
,
length
(
etal
)))
}
z
$
model
<-
list
(
mul
,
sigl
,
shl
,
thetal
,
etal
)
z
$
link
<-
deparse
(
substitute
(
c
(
mulink
,
siglink
,
shlink
,
thetalink
,
etalink
)))
init
<-
c
(
muinit
,
siginit
,
shinit
,
thetainit
,
etainit
)
# function to calculate neg log-likelihood:
gev.lik
<-
function
(
a
)
{
# computes neg log lik of gev(d) model
...
...
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