search for: t_init

Displaying 1 result from an estimated 1 matches for "t_init".

Did you mean: __init
2008 Oct 15
0
Maximizing a function - optim does not always converge
...sometimes not.   Since I¢m planning to do this 5000 times, is there a way where I can make sure the solution always converge?   size <- 25 n <- rbinom(1, size, 0.6) data <- log(rlnorm(n, -0.075, sqrt(.15))) xbar <- mean(data) sigma2 <- var(data) s <- n*xbar tsq <- sum(data^2) t_init <- xbar-2*sqrt(sigma2/n)   l2 <- function(x){         x1 <- x[1]         x2 <- x[2]         (size - n)*log(1 - exp(t_init - x1 - x2/2)) + n*(t_init -x1 - x2/2) - (n/2)*log(2*pi) - (n/2)*log(x2) - tsq/(2*x2) + x1*s/x2 - n*(x1^2)/(2*x2)   }     gr.l2 <- function(x){         x1 <- x...