[ADMB Users] [R-sig-ME] MCMC fitting in glmmADMB

dave fournier davef at otter-rsch.com
Wed Oct 22 09:06:45 PDT 2014


On 10/22/2014 04:31 AM, maren wrote:


   I found two memory leaks in df1b2lp8.cpp which were causing
   glmmadmb to run out of memory when doing mcmc.  They would
   also affect other aspects of the analysis.

   The offending pointers are

       block_diagonal_re_list
       block_diagonal_fe_list

    In the code they should be checked to see if they are non zero and
     deleted if they are. code is like that below.

   // check if already allocated
   if (block_diagonal_re_list)
   {
     delete block_diagonal_re_list;
     block_diagonal_re_list=0;
   }
   block_diagonal_re_list = new imatrix(1,num_separable_calls,
     1,itmp);
   if (block_diagonal_re_list ==0)
   {
     cerr << "error_allocating imatrix" << endl;
     ad_exit(1);
   }
   // check if already allocated
   if (block_diagonal_fe_list)
   {
     delete block_diagonal_fe_list;
     block_diagonal_fe_list=0;
   }
   block_diagonal_fe_list = new imatrix(1,num_separable_calls,
     1,itmpf);

   if (block_diagonal_fe_list ==0)
   {
     cerr << "error_allocating imatrix" << endl;
     ad_exit(1);
   }


   Thanks to valgrind for making this easy to find.

    So we need to get this into glmmadmb somehow.



> Hi Dave,
>
> Thank you very much for offering to look into the problem. I attached 
> a shortened version of my data set (the first 2000 lines out of 
> 11195). I tried it out and the model is in principal running with this 
> shortened version. But please let me know if you need a larger part of 
> the data set.
>
> Technically the data set is not owned by us. Therefore, please don’t 
> distribute the data set further (without prior permission). For the 
> same reason I made all the variable names general. I assumed that the 
> details of what exactly is analysed here are not important for the 
> problem. But if you need more details about the study or the variables 
> please don’t hesitate to ask.
>
> I attached the R-code to run the model below. In case it is of 
> importance: I am using the R version 3.1.0 and the glmmADMB version 0.8.0.
>
> Thanks!
>
> Maren
>
> #-----------------------------------------------------------------------------------------------------------------------#
>
> # Here is the R-code:
>
> library(glmmADMB)
>
> Data <- read.csv2("Rebke_Data_sample.csv", header=TRUE, 
> colClasses="character")
>
> Data$Response<- as.numeric(Data$Response)
>
> Data$Fixed1<- as.factor(Data$Fixed1)
>
> Data$Fixed1 <- relevel(Data$Fixed1, ref="Off")
>
> Data$Fixed2<- as.factor(Data$Fixed2)
>
> Data$Fixed2 <- relevel(Data$Fixed2, ref="1")
>
> Data$Fixed3<- as.factor(Data$Fixed3)
>
> Data$Random1<- as.factor(Data$Random1)
>
> Data$Random2<- as.factor(Data$Random2)
>
> Data$Random3<- as.factor(Data$Random3)
>
> Data$Random4<- as.factor(Data$Random4)
>
> Data$Offset<- as.numeric(Data$Offset)
>
> nsim <- 2000
>
> thin <- 10
>
> Model <- glmmadmb(Response ~ Fixed1 + Fixed2 + Fixed3 + (1|Random1) + 
> (1|Random2) + (1|Random3) + (1|Random4) + offset(log(Offset)), 
> data=Data, family="poisson", zeroInflation=TRUE,mcmc=TRUE, 
> mcmc.opts=mcmcControl(mcmc=nsim, mcsave=thin))
>
> #-----------------------------------------------------------------------------------------------------------------------#
>
>
>
>
> Am 22.10.2014 04:44, schrieb dave fournier:
>> On 10/21/2014 02:48 PM, - - wrote:
>>
>> Hi,
>>
>> That sounds like a bug maybe. Maybe a memory leak.  Don't remember 
>> exactly how it is implemented, but
>> I don't think the memory use of any of the MCMC stuff should grow 
>> over time like that.  If you send me
>> what I need to run your model I'll take a look at it.
>>
>>      Dave
>>
>>
>>> Hi Dave,
>>>
>>> Sorry, I guess I didn’t explain my problem correctly in my original 
>>> request due to translation issues. It is the RAM and not the hard 
>>> drive space that is reaching its capacity. After running the MCMC 
>>> chain for 24 hours (approximately 2000 iterations for the model of 
>>> my own data) the allocated memory is already about 6 GB.
>>>
>>> I will send a follow up to the mailing list to clarify this.
>>>
>>> Best wishes,
>>> Maren
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141022/07f01e4c/attachment-0001.html>


More information about the Users mailing list