Description Usage Arguments Value See Also Examples
Unconstrained and box-constrained optimization using PORT routines.
1 2 3 4 5 6 7 8 9 10 11 |
par0 |
Initial values for the parameters to be optimized over. |
fitMeth |
Curve fitting methods, one of |
y |
Numeric vector, vegetation index time-series |
t |
Numeric vector, |
w |
(optional) Numeric vector, weights of |
ylu |
|
lower |
vectors of lower and upper bounds, replicated to be as long as
|
upper |
vectors of lower and upper bounds, replicated to be as long as
|
... |
ignored parameters |
A list object of
par
: The optimal parameters
convergence
:
0: convergent;
1: Non-convergent
iterations
evaluations: list(function, gradient)
objective
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 26 27 28 29 30 31 32 33 | ## Not run:
t = seq(1.0, 366, 8)
fun = doubleLog_Beck
par = c(0.1 , 0.7, 50, 0.1, 250, 0.1)
par0 = c(0.05, 0.6 , 45, 0.1, 200, 0.2)
ypred = t*0
y = fun(par, t)
julia_init()
r_julia <- opt_nlminb_julia(par0, "doubleLog_Beck", y, t)
r_R <- opt_nlminb(par0, f_goal, fun = fun, y = y, t = t, pred = ypred)
list(julia = r_julia, R = r_R) %>%
map(~c(.$par, .$objective, .$value)) %>%
do.call(rbind, .)# %>%
n <- length(t)
w <- rep(0.2, n)
# julia is 5 times faster
{
# microbenchmark::microbenchmark : 18.939826 ms in R
info <- rbenchmark::benchmark(
r1 <- opt_nlminb_julia(par0, "doubleLog_Beck", y, t, w),
r2 <- opt_nlminb(par0, f_goal, fun = fun, y = y, t = t, pred = ypred),
replications = 500
)
print(info)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.