[R] maxLik: different estimations from different packages

alfonso.carfora at uniparthenope.it alfonso.carfora at uniparthenope.it
Fri May 10 12:51:35 CEST 2013


Dear all,

we are computing maximum likelihood estimations using maxLik package  
and we realized that the results of the estimation depend on the  
version of the package installed

for example if we try to estimate this function with an old version of  
maxLik under R 2.13.1 (32 bit version installed 2 years ago):


L<-function (param) {b0t<-param[1]
                      p1t<-param[2]
                      p2t<-param[3]
                      p3t<-param[4]
                      p4t<-param[5]

for(i in 17:T) {n[i,]<- b0t + p1t*a[i-1] + p2t*sum(a[(i-4):(i-1)]) +  
p3t*(sum(a[(i-8):(i-1)])) + p4t*(sum(a[(i-16):(i-1)]))
                m[i,]<-exp(n[i])/(1+exp(n[i]))
                ll[i-16,]<-a[i]*log(m[i])+(1-a[i])*log(1-m[i]) }
                      sum(ll)}
b2<-maxLik(L, start=c(-2.8158,5,-1,0.3213,-0.3112))


we obtain this results:

summary(b2)

Maximum Likelihood estimation
Newton-Raphson maximisation, 16 iterations
Return code 2: successive function values within tolerance limit
Log-Likelihood: -38.11285
5  free parameters
Estimates:
       Estimate Std. error t value   Pr(> t)
[1,]  -2.81578    0.43548 -6.4660 1.007e-10 ***
[2,]  50.50024   13.17046  3.8344 0.0001259 ***
[3,] -11.53344    3.31075 -3.4836 0.0004947 ***
[4,]   0.32130    0.42978  0.7476 0.4547096
[5,]  -0.31121    0.23245 -1.3388 0.1806280
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
--------------------------------------------

NB: a is a binary time series

if we try to estimate the same function using the last version of  
maxLik under R.3.0 (64 bit latest version) the estimation do not  
converge and this is the error message:

Iteration 15
Parameter:
[1]  -2.8146429  51.3042554 -11.7373313   0.3245214  -0.3125767
Gradient:
[1] NaN NaN NaN NaN NaN
Errore in maxNRCompute(fn = logLikAttr, fnOrig = fn, gradOrig = grad, 
hessOrig = hess,  :
   NA in gradient

What causes this?

Thanks
Alfonso





******************************************************************************	
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO
 
Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 
 
http://www.uniparthenope.it/index.php/it/avvisi-sito-di-ateneo/2943-la-parthenope-premia-il-tuo-voto-di-diploma-ed-il-tuo-imegno-con-i-proventi-del-5-per-mille
 
Questa informativa e' inserita in automatico dal sistema al fine esclusivo della realizzazione dei fini istituzionali dell'ente.



More information about the R-help mailing list