x <- c(0.08, 0.2, 0.4, 0.42, 0.51, 0.67, 0.9, 1.5, 2.7, 4.9) lambda <- 1 # fixed U <- function(theta,x,lambda) { ret <- length(x)/theta - lambda*sum(x^theta*log(x)) + sum(log(x)) } I <- function(theta,x,lambda) { ret <- length(x)/theta^2 + lambda*sum(x^theta*(log(x))^2) } tol <- .00001 oldtheta <- 0 theta <- 2 iter <- 1 while (abs(oldtheta-theta)>tol) { oldtheta <- theta theta <- theta + U(theta,x,lambda)/I(theta,x,lambda) cat("iter=",iter," theta=",theta,"\n") iter <- iter + 1 }