Displaying 4 results from an estimated 4 matches for "myoptim".
2003 Oct 31
1
Optimization of objective function with generic number of arguments (R-Extension with C code)
...####
############### IPOTETICAL MAIN ###############
#################################################
#Objective func with only one parameter
ObjectiveFunction1<-function(a){
...
}
#Objective func with two arguments
ObjectiveFunction2<-function(a,b){
...
}
#Minimize the first function
MyOptim(pars,ObjectiveFunction1)
#Minimize the second function over the first argument
MyOptim(pars,ObjectiveFunction2,b=xxx)
#Minimize the second function over the second argument
MyOptim(pars,ObjectiveFunction2,a=xxx)
######################################################
############## EXCER...
2004 Aug 11
0
always NaN after some running in R, but all fine in S-plus
...ore details below and really appreciate any help from
you!
R:1.9.0 S-plus:6.2 OS: Windows 2000
Best Regards,
Yingfu
The output in R are:
> symbol.C("like")
[1] "like"
> likelihood(data=data03) # The likelihood function calling .C("like",...)
[1] 5850.12
> myoptim(data=data03) # Optimization using optim with fn=likelihood
Initial parameters are
1 10 0.2 0.2 0.2 0.1 0.1 0.1 0.1 0.2 0.3 0.5
1 10 0.2 0.2 0.2[1] 5850.154 #I print first 5 parameters and the value
1.001 10 0.2 0.2 0.2[1] 5850.308 #of the minus log-likelihood every run
0.999 10 0.2 0.2 0.2[1...
2011 Dec 29
0
problem of "constrOptim.nl", no hessian and convergence values
...h<-rep(NA,2)
h[1]<-mean(u)-0
h[2]<-var(u)-1
h
}
heq.jac<-function(par){
u<-par[1:m]
a<-par[(m+1):(m+n)]
b<-par[(m+n+1):(m+2*n)]
j <- matrix(NA, 2, length(par))
j[1,]<-c(rep(1,m),rep(0,2*n))
j[2, ] <- c(2/(m-1)*(u-mean(u)),rep(0,2*n))
j
}
# use optim
library(alabama)
myoptim<-constrOptim.nl(par=par0, fn=obj, heq=heq, heq.jac=heq.jac,
control.outer=list(maxit=5000000,method="L-BFGS-B"))
--
View this message in context: http://r.789695.n4.nabble.com/problem-of-constrOptim-nl-no-hessian-and-convergence-values-tp4242031p4242031.html
Sent from the R help mai...
2008 Jul 05
3
Editing the "..." argument
Dear all,
I'd like tweaking the ... arguments that one user can pass in my
function for fitting a model. More precisely, my objective function is
(really) problematic to optimize using the "optim" function.
Consequently, I'd like to add in the "control" argument of the latter
function a "ndeps = rep(something, #par)" and/or "parscale =