Displaying 4 results from an estimated 4 matches for "logvalue".
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
{ out <- rep(-Inf,length(x))
out[1+xi*x...
2009 Aug 17
2
Newbie that don't understand R code
...(t, theta)
{
lambda <- theta[1]
chi <- theta[2]
psi <- theta[3]
if (chi==0)
out <- (1+2*t/psi)^(-lambda)
else if (psi==0)
out <- 2^(lambda+1)*exp(besselM3(lambda,sqrt(2*chi*t),log
value=TRUE)-lambda*log(2*chi*t)/2)/gamma(-lambda)
else
out <- exp(besselM3(lambda,sqrt(chi*(psi+2*t)),logvalue=T
RUE)+lambda*log(chi*psi)/2-besselM3(lambda,sqrt(chi*psi),logvalue=TRUE)-lambda*log(chi*(psi+2*t))/2)
out
}
)
phi.inverse( - log(U)/Y, theta)
}
--
View this message in context: http://www.nabble.com/Newbie-that-don%27t-understand-R-code-tp25009034p25009034.html
Sent from the R help mailing list a...
2010 Sep 21
2
Need help for EM algorithm ASAP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
...-mu
gammathelda<-thelda*gamma
sigmathelda<-(thelda^2)*sigma
betathelda<-(thelda^2)*sigma*beta
lambdastar<-lambda-0.5
theldastar[i]<-sqrt(1+((y[i]-muthelda)/sigmathelda)^2)
gammastar<-sqrt((gammathelda^2)+((betathelda/sigmathelda)^2))
klambda1<-besselM3(lambdastar+1, x=2, logvalue=FALSE)
klambda<-besselM3(lambdastar,x=2,logvalue=FALSE)
klambda2<-besselM3(lambdastar-1,x=2,logvalue=FALSE)
zi[i]<-((theldastar[i]*klambda1*(theldastar[i]*gammastar))/(gammastar*klambda*theldastar[i]*gammastar))
ti[i]<-((gammastar*klambda2*(theldastar[i]*gammastar))/(theldastar[i]*k...
2009 Aug 20
1
Understanding R code
...ma))/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 code is 0 we are OK;
converged <- TRUE
else
conv...