[R] optim hangs without warnings or error

Ben Bolker bbolker at gmail.com
Thu Mar 7 23:34:08 CET 2013


Katja Hebestreit <katja.hebestreit <at> uni-muenster.de> writes:

> 
> Hello,
> 
> optim hangs for some reason when called within the betareg function
> (from the betareg package).
> 
> In this special case, the arguments which are passed to optim cause
> never ending calculations.
> 
> I uploaded the arguments passed to optim on:
> https://www.dropbox.com/s/ud507gbpt3gkbcp/optim_arguments.RData
> 
> I appreciate any help.
> Cheers,
> Katja
> 

 Hmm, it works fine for me (thank you for the very reproducible
example!)

L <- load("/tmp/optim_arguments.RData")
arglist <- setNames(lapply(L,get),L)
do.call(optim,arglist)

Results:

$par
 mean.(Intercept) mean.groupcontrol   mean.gendermale        precision1       
precision2 
    -2.522996e+00     -5.018542e-01      6.197797e-13      4.445938e+00     
2.871008e+01 

$value
[1] 274.5367

$counts
function gradient 
     552       87 

$convergence
[1] 0

$message
NULL

> sessionInfo()
R Under development (unstable) (2012-12-14 r61321)
Platform: i686-pc-linux-gnu (32-bit)

locale:
[snip]

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] betareg_3.0-2     flexmix_2.3-8     lmtest_0.9-30     modeltools_0.2-19
[5] multcomp_1.2-15   sandwich_2.2-9    stats4_2.16.0     tools_2.16.0    


> > sessionInfo()
> R version 2.15.3 (2013-03-01)
> Platform: x86_64-pc-linux-gnu (64-bit)
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
>  [7] LC_PAPER=C                 LC_NAME=C                 
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods
> base     
> 
> loaded via a namespace (and not attached):
> [1] betareg_3.0-2     flexmix_2.3-8     lmtest_0.9-30
> modeltools_0.2-19
> [5] multcomp_1.2-15   sandwich_2.2-9    stats4_2.15.3
> tools_2.15.3
> 
>



More information about the R-help mailing list