R set random seed

1 view
Skip to first unread message

Daniel Gates

unread,
May 31, 2012, 1:20:57 AM5/31/12
to treevo-discuss
Greetings,

I've been running profiles on the TreEvo code this week and it seems
like I'm getting different results from the same seeds (like we talked
about in Friday's meeting). I've added the code that Barb sent to me
that looks like this:

system(command=paste('rm .RData'))

but when I try to execute this is R it tells me:

rm: .RData: No such file or directory

So I don't think I've got it right...

Is this what it should be doing? Also, I'm still not clear on why this
phenomenon exists, if anyone could shed (or reshed, since we talked
about it Friday but I didn't fully comprehend) any light on this for
me it would be greatly appreciated.

Thanks!
-Dan

Barb Banbury

unread,
May 31, 2012, 9:44:04 AM5/31/12
to treevo-...@googlegroups.com, treevo-discuss
Hi Dan,
Have you reported the seeds at the end of the run? If not that is probably a good idea to make sure that it was set right.

As for the system call, it is because R saves a hidden file (.RData) after you work in a directory. When R opens, it automatically imports this information (including the previously used seed). So this is a double check that you are calling the seed. If there is no .RData file, then you will see that statement back, so that is fine--nothing wrong.
Barb

Sent from my iPhone

Derrick Zwickl

unread,
May 31, 2012, 10:48:44 AM5/31/12
to treevo-...@googlegroups.com

Hi Dan,

Just to check, when you say that you are getting different results from
the same seeds, what are you seeing? Certainly the profile results
themselves will vary a bit run to run because it is a random sampling
process and it competes with other things going on on the system.
That's why profiled runs should always be reasonably long. Are the run
results themselves varying? That would suggest that the seed isn't
getting set properly.

Incidentally, if you do this it won't complain if the .RData file isn't
found:

system(command=paste('rm -f .RData'))

Cheers,
Derrick

dga...@huskers.unl.edu

unread,
May 31, 2012, 11:15:32 AM5/31/12
to treevo-...@googlegroups.com
Ok that makes more sense, I was just looking at the profiles so they were off but the results of the run seemed to be the same from when I checked, I'll report the profiling later today as I have some questions regarding that too. Also what would the best way to report the seed at the end of the run?

Thanks
Dan

Reply all
Reply to author
Forward
0 new messages