simulations failed

announcements (new versions, changes, bugs, installation problems...) related to program DENSITY and the R package secr

simulations failed

Postby ndusit » Sat Jan 28, 2012 12:15 am

Hi Murray
I tried simulation with 50 replicates, which set up parameters, D=8, g0 = 0.2, sigma = 2000 m. I want to try the sigma vary from 3000, 4000, 5000, 6000m, and occasion vary from 4, 6, 8, 10. I set priority below normal in Task Manager as well.

After 46 replicates (15 hr) the computer shown massage "R for windows gui front-end has stopped working" and "A problem caused the program to stop working correctly"

Is this limitation of my computer? or something else.

I used Fujitsu laptop Window 7 professional 64-bit with ram 4GB CPU Intel-Corei5@2.30GHz and ran with R v2.13.0. I used "secr" v 2.3.2.

Thanks,
Dusit
ndusit
 
Posts: 5
Joined: Fri Jan 20, 2012 5:03 am

Re: simulations failed

Postby murray.efford » Sat Jan 28, 2012 1:09 am

Hi Dusit

So close! I have no idea what went wrong. It is possible some memory limit was exceeded. Sorry I can't be specific, but can only offer general suggestions. The buffer bias check in secr.fit() can be a weak point, so it's a good idea to set verify = FALSE.

For big simulations like this I always save results to a disk file after each replicate (e.g. save(output, file='output.Rdata') if the output are accumulating in object 'output'). That way if there is a problem I can restart for the remaining simulations rather than going back to the beginning.

I also like to try generating a lot of datasets (fast) and saving only a summary of each (e.g., number of capture histories) without actually fitting a model (slow), just to check that part of the system is working. You can even split the process into two steps: (1) generate all the capthist objects and save them as a list (2) fit a model to each component of the list.

That's quite large range of sigma values, especially as you have held g0 constant (expected number of captures varies roughly with the square of sigma). You need to ensure the buffer size is appropriate for each sigma.

I guess you mean density 8 per 100km^2?

Hope you can crack this.
Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: simulations failed

Postby ndusit » Sat Jan 28, 2012 12:10 pm

Hi Murray
Thanks. I applied and used your simulation code from KL workshop. I set verify = FALSE, and save my output = outputfile. How can restart for the remaining simulations? It's above of my head. :shock:

Best,
Dusit
ndusit
 
Posts: 5
Joined: Fri Jan 20, 2012 5:03 am

Re: simulations failed

Postby murray.efford » Sat Jan 28, 2012 4:50 pm

I think you need to modify the simulation function something like this:

Code: Select all
runsim.restart <- function(nrepl = 50, outputfile = 'sim.output.RData', startfrom = 1) {
    ...
    ## optionally reload partial output
    if (startfrom > 1)
        load('sim.output.RData')
    ## loop over replicates
    for (r in startfrom:nrepl) {
        ## simulate replicate r for all parameter combinations
        ...
        save(output, file = outputfile)
    }
    ...
}


and then run with 'startfrom' set to wherever it finished (46?). For example
runsim.restart(nrepl = 50, startfrom = 46).

The dots represent all the code to set up the parameter combinations and output array and to perform the simulations. As written this could also be used for any new batch of simulations, because with the default startfrom = 1 it won't try and load an output file.

Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: simulations failed

Postby ndusit » Sun Jan 29, 2012 11:14 am

Hi Murray
Thank you very much. :D

Best regards,
Dusit
ndusit
 
Posts: 5
Joined: Fri Jan 20, 2012 5:03 am

Re: simulations failed

Postby murray.efford » Sun Jan 29, 2012 4:01 pm

I rushed that reply - the code will only work if your original call used the default name for the output file. It would be better to replace load('sim.output.RData') with load(outputfile).
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand


Return to software problems/news

Who is online

Users browsing this forum: No registered users and 16 guests