Displaying 2 results from an estimated 2 matches for "dgev".
Did you mean:
dev
2009 Aug 24
2
[] for R
I am assuming the variable out is the output parameter.
However, I don't understand what is out[1+xi*xx>0]?
Can someone explain this to me?
Thanks in advance,
Chen
dGEV <- function(x, xi, mu = 0, sigma = 1, logvalue=FALSE)
{
xx <- (x-mu)/sigma
#use the new dGumbel which passes mu and sigma:
#if (xi==0) out <- dGumbel(xx,logvalue=TRUE)-log(sigma)
if (xi==0) {
return(out <- dGumbel(x, mu, sigma, logvalue));
}
else...
2009 Aug 20
1
Understanding R code
...ion(maxima)
{
sigma0 <- sqrt((6. * var(maxima))/pi)
mu0 <- mean(maxima) - 0.57722 * sigma0
xi0 <- 0.1
theta <- c(xi0, mu0, sigma0)
#10/5/2007: removed assign() for maxima.nl
#10/5/2007: passed additional parameter to avoid using assign()
negloglik <- function(theta, maxvalue)
{
-sum(dGEV(maxvalue,theta[1],theta[2],abs(theta[3]),logvalue=TRUE));
}
#10/5/2007: passed additional 4th parameter which will be passed to
negloglik
optimfit <- optim(theta, fn=negloglik, gr=NULL, maxvalue=maxima,
method="BFGS");
par.ests <- optimfit$par;
if(optimfit$convergence == 0) #if co...