Konstantinos Georgalos
2013-Mar-07 17:51 UTC
[R] initial starting values with constOptim()
Hi all,
I am trying to estimate few parameters using the constained maximum
likelihood in R and more specifically the constOptim() from the stata
package in R. I am programming in Python and using R via the RPy2.
In my model, I am assuming that the data follow the Beta-distribution, so I
created a simulated dataset by using prespecified values for the parameters
and now I am trying to estimate these parameters in order to verify that my
estimation program works fine.
What I have observed is that my estimation is quite sensitive to the
initial parameters. For example I have 11 parameters to estimate (let's
call the parameters as pam1..pam11) and their true value is:
pam1=0.2 pam2=0.3 pam3=0.4 pam4=0.7 pam5=0.55 pam6=0.45 pam7=0.1 pam8=0.01
pam9=0.01 pam10=45 pam11=45
In the contrtOptim() I am setting the starting parameters as:
start_param=FloatVector((pam1,pam2,pam3,pam4,pam5,pam6,pam7,pam8,pam9,pam10,pam,11))
where I set the starting values. I have observed that when I am using
different sets of starting values the results change. For example when I am
using the set
start_param=FloatVector((0.2,0.3,0.4,0.6,0.7,0.8,0.3,0.011,0.011,15,15))
and I obtain the following estimates
$par
[1] 0.20851065 0.30348571 0.43616932 0.73695654 0.58287221 0.45541506
[7] 0.11191879 0.02233908 0.01988878 46.57249043 45.48544918
$value
[1] -215.9711
$convergence
[1] 0
but when I am using another set as for example:
start_param=FloatVector((0.2,0.3,0.4,0.75,0.55,0.45,0.3,0.05,0.05,59,59))
the results change and it seems that I am loosing convergence
$par
[1] 0.17218738 0.27165359 0.48458978 0.80295773 0.62618983 0.43254786
[7] 0.12426385 0.02991442 0.01853252 57.78269692 59.35376216
$value
[1] -146.9858
$convergence
[1] 1
My question is the following: I have seen that in STATA, there is an option
that searches for better starting values for the numerical optimization
algorithm. I tried to set multiple starting values by setting a matrix but
this did not work. Is there an option in constrOptim that will allow me to
do something like this?
Many thanks in advance.
For additional information, the specification I use for the constrOptim()
is:
res=statsr.constrOptim(start_param,Rmaxlikelihood,grad='NULL',ui=ui,ci=ci,method="Nelder-Mead",control=list("maxit=3000,trace=F"))
[[alternative HTML version deleted]]
