Description Usage Arguments Details Value Author(s) References See Also Examples
Optimizes a function using Powell's UObyQA algorithm.
1 | powell(par, fn, control = powell.control(), check.hessian = TRUE, ...)
|
par |
Starting values for objective function |
fn |
A function to be optimized. The function takes the
parameters ( |
control |
A list of control parameters |
check.hessian |
logical; if |
... |
Additional arguments to be passed to |
This function seeks the least value of a function of many variables, by a trust region method that forms quadratic models by interpolation. The algorithm is described in "UOBYQA: unconstrained optimization by quadratic approximation" by M.J.D. Powell, Report DAMTP 2000/NA14, University of Cambridge.
A list with components
par |
The final values of the parameters. |
value |
The final value of the function being optimized. |
counts |
The number of times the function is called. |
hessian |
A symmetric matrix of the estimated Hessian. |
eigen.hessian |
If |
convergence |
0 if converged, 1 otherwise. |
control |
The input control parameters. |
message |
Information about the model fit. This will be non-null
only if |
call |
The original call to the optimizer. |
Sundar Dorai-Raj
http://plato.asu.edu/topics/problems/nlounres.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | set.seed(1)
fn <- function(beta, y, x, w) {
# binomial deviance using double log link
mu <- exp(x %*% beta)
logLik <- - y * mu + (w - y) * log(1 - exp(-mu))
-2 * sum(logLik)
}
n <- 1000
beta <- c(-1, 0.5)
w <- rpois(n, 100)
x <- rep(c("A", "B"), length = n)
X <- model.matrix(~ x, data.frame(x))
y <- rbinom(n, w, exp(-exp(X %*% beta)))
x1 <- powell(beta, fn, y = y, x = X, w = w)
x2 <- optim(beta, fn, y = y, x = X, w = w, hessian = TRUE)
x3 <- glm(1 - y/w ~ x, data = data.frame(x, y, w),
family = binomial("cloglog"), weights = w)
# compare coefficients from 3 fits
rbind(powell = x1$par, optim = x2$par, glm = coef(x3))
# compare standard errors from 3 fits
rbind(powell = sqrt(diag(2 * solve(x1$hessian))),
optim = sqrt(diag(2 * solve(x2$hessian))),
glm = sqrt(diag(vcov(x3))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.