Skip to content

Floating simulation error

4 messages · Brendan Morse, Bert Gunter, David Smith +1 more

#
?traceback
options("error")  ( ?options)
?debug
?try
?tryCatch

R has facilities to help you with such problems. Please use them -- and then
repost with more specific info if you still cannot solve it.

-- Bert Gunter

 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Brendan Morse
Sent: Thursday, April 23, 2009 9:12 AM
To: r-help at r-project.org
Subject: [R] Floating simulation error


Hi all, I am running a simulation and a curious error keeps coming up  
that stops the whole process. The error is a subscript out of bounds  
error, and it seems to happen at different points (floating around)  
throughout the looping simulation. Say, for example, it crashes on  
sample 1 - iteration 200. I can force it to start again on iteration  
202 with all of the same settings, and it is fine. I can also force it  
to start again on iteration 201 if I modify the starting seed value  
and it goes on its merry way. What I think is happening is that  
certain seed values are disrupting something and causing the subscript  
error.

My seeds are set as follows: The simulation has x number of  
conditions. The starting seeds are set to equal the condition number  
(1 to x). The program runs 500 iterations within each condition, and  
the seed values for each iteration are set as x+iteration number. So,  
for condition 1, iteration 1, the starting seed value would be 2, then  
3 etc. etc. At some point, I will get the subscript error but it seems  
unpredictable.

Has anyone had a similar problem or an idea as to what might be  
happening?

- Brendan


Brendan Morse, M.S.
Industrial/Organizational Psychology
Ohio University
Office: 335 Porter Hall
Website: http://oak.cats.ohiou.edu/~bm123504





______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
Cosmic rays, perhaps? :)
http://blog.revolution-computing.com/2009/04/blame-it-on-cosmic-rays.html

Seriously though, my guess is that the simulation data from your 201st
iteration is tickling some subtle bug in your code. This has happened
to me before where I generate a random matrix that happens to be
non-invertible, for example.

I'd suggest grabbing the data from your 201st iteration (a simple way
would be to run your RNG 200 times at the start of your code) and
debug from there.

# David Smith
On Thu, Apr 23, 2009 at 11:12 AM, Brendan Morse <morse.brendan at gmail.com> wrote:

  
    
#
Brendan,

This is one of those situations where a self-contained, reproducible example would be really helpful.  In the absence of that, seeing your actual code is absolutely necessary.  I can't imagine anyone being able to provide any useful help here otherwise.

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204