Displaying 20 results from an estimated 4692 matches for "seed".
Did you mean:
see
2009 Mar 21
2
factor with numeric names
...;t
seem to be able to find answer so I am hoping someone here can help. I
found that if the factor names are all in numbers, fitting the model
in lm would return labels that are not very recognizable.
# Example: let's just assume that we want to fit this model
fit <- lm(height ~ age + Seed, data=Loblolly)
# See the category names are all mangled up here
fit
Call:
lm(formula = height ~ age + Seed, data = Loblolly)
Coefficients:
(Intercept) age Seed.L Seed.Q Seed.C
Seed^4
-1.31240 2.59052 4.86941 0.87307 0.37894
-0.46...
2000 Aug 31
1
slightly overzealous RNG seeding?
Hello again,
I was testing today's SNAP (openssh-SNAP-20000830.tar.gz) in my
Solaris 2.6-8 environment, when I found some problems with the ssh2
support.
While connecting, it seeds the RNG something like 32 times! And then
once connected, it seeds again 2 or 3 times with *every* keystroke! This
makes for some slow going. This happens on all of the Solaris boxes I
tried. Binary was compiled on 2.6 against OpenSSL 0.9.5a.
Output follows:
6:19pm.orangecrush: ~# ssh -2...
1999 May 05
1
RNG R/Splus compatibility
...ction(){T or F}
# is.Splus <- function(){T or F}
if (is.S())
{
RNGkind <- function(kind=NULL)
{# With a null argument this returns the current kind.
# kind = "default" resets the RNG to the Splus default.
# Splus does not allow arbitrary setting of .Random.seed so
# .RandomSeed is used. The existence of .RandomSeed is
# used to indicate whether an alternate RNG is used and the
# first element of .RandomSeed indicates the generator.
if ( is.null(kind))
{if(exists(".RandomSeed")) kind <- c("...
2013 May 08
4
Correctly Setting New Seed
Could someone please suggest a method to store the current random seed. I'm having trouble understanding how to correctly use set.seed and .Random.seed.
Specifically, I have the following code that crashes:
set.seed(seed)
for(i in 1:10){
print( runif(1))
}
To get around this I need to split the number of iterations into chunks:
set.seed(seed)
for(i...
2017 Dec 08
2
Curiously short cycles in iterated permutations with the same seed
I have noticed that when I iterate permutations of short vectors with the same seed, the cycle lengths are much shorter than I would expect by chance. For example:
X <- 1:10
Xorig <- X
start <- 112358
N <- 10
for (i in 1:N) {
seed <- start + i
for (j in 1:1000) { # Maximum cycle length to consider
set.seed(seed) # Re-seed RNG to same initial state
X...
2013 Jan 23
3
How to construct a valid seed for l'Ecuyer's method with given .Random.seed?
Dear expeRts,
I struggle with the following problem using snow clusters for parallel computing: I would like to specify l'Ecuyer's random number generator. Base R creates a .Random.seed of length 7, the first value indicating the kind fo random number generator. I would thus like to use the components 2 to 7 as the seed for l'Ecuyer's random number generator.
By doing so, I receive (see the minimal example below):
,----
| > Loading required package: Rmpi
| Loading req...
2003 Oct 16
2
.Random.seed
I am writing a function for the purposes of a simulation. Due to memory
problems, the function sometimes crashes. In order to get around this
problem, I would like to include to be able to save the "last" seed, so I
can pick up with the next run of the simulation after a "crash". I am
having trouble understanding what is going on with .Random.seed!
For each run of the following function, a random uniform and the current
.Random.seed should be printed:
test<-function(runs,seed){
.Random...
1997 Sep 13
1
R-alpha: compatibility
Two compatibility issues found while trying to convert a simulation from S
to R.
1. set.seed() We don't have this function. According to Venables &
Ripley it just picks a seed from a list of 1000 possibilities. How about
"set.seed" <-function (i)
{
if (any(i > 1000) | any(i < 1))
stop("argument to set.seed() must be in 1:1000"...
2008 Feb 13
3
Best way to reset random seed when using set.seed() in a function?
Hi,
this is related to a question just raised on Bioconductor where one
function sets the random seed internally but never resets it, which
results in enforced down streams random samples being deterministic.
What is the best way to reset the random seed when you use set.seed()
within a function? Is it still to re-assign '.Random.seed' in the
global environment as following example illust...
2012 Jan 06
1
How to properly re-set a saved seed? I've got the answer, but no explanation
Hello, happy new year.
I've come back to a problem from last spring. I need to understand
what what is the technically correct method to save a seed and then
re-set it. Although this example arises in the context of MT19937,
I'm needing to do this with other generators as well, including
L'Ecuyer streams.
The puzzle is this comment in ?Random: "?set.seed? is the recommended
way to specify seeds."
What I did not understand b...
2007 Sep 23
0
initial scrambling of seed in do_setseed / RNG_Init
I would like to suggest a modification of initial scrambling of the
seed in RNG_Init (called from do_setseed). The modified code is
equivalent, but faster. Patch against R-devel_2007-09-22 follows
--- R-devel-orig/src/main/RNG.c 2007-09-02 07:49:35.000000000 +0200
+++ R-devel-modif/src/main/RNG.c 2007-09-23 10:51:59.234566440 +0200
@@ -216,8 +216,8 @@
BM_norm_keep...
2012 Nov 07
3
c weirdness
is there a way to avoid c() appending ".0" and ".1" to seed?
--8<---------------cut here---------------start------------->8---
> c("nons"=1, "seed"=3)
nons seed ## good!
1 3
> c("nons"=1, "seed"=tab[1])
nons seed.0 ## don't want ".0"!
1 2...
2005 Dec 06
2
Constructing a transition matrix
Hi,
I would like to construct a transition matrix from a data frame with
annual transitions of marked plants.
plant<-c(1:6)
class<-c("seed","seed", "seed", "veg", "rep", "rep")
fate<-c("dead", "veg","veg","rep", "rep", "veg")
trans<-data.frame(plant, class, fate)
plant class fate
1 1 seed dead
2 2 see...
2017 Dec 08
0
Curiously short cycles in iterated permutations with the same seed
...a permutation is decomposed
into cycles and how the order relates to a partition of n (n=10 in your
case).
Enjoy!
Eric
On Fri, Dec 8, 2017 at 6:39 AM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:
> I have noticed that when I iterate permutations of short vectors with the
> same seed, the cycle lengths are much shorter than I would expect by
> chance. For example:
>
> X <- 1:10
> Xorig <- X
> start <- 112358
> N <- 10
>
> for (i in 1:N) {
> seed <- start + i
> for (j in 1:1000) { # Maximum cycle length to consider
> set.se...
2019 Oct 30
2
set.seed() in a package
> On 30/10/2019 9:08 a.m., peter dalgaard wrote:
> > You can fairly easily work around that by saving and restoring .Random.seed.
This is actually quite tedious to get correct; it requires you to
under how and when .Random.seed is set, and what are valid values on
.Random.seed. For instance, a common mistake (me too) is to reset to
.GlobalEnv$.Random.seed <- NULL in a fresh R session but this will
produce a warning on:...
2007 May 31
1
Restoring .Random.seed
Hi.
Suppose I have a function which does some random number generation within.
The random number generation inside the function changes the value of
.Random.seed in the calling environment. If I want to restore the
pre-function call .Random.seed, I can do:
save.seed<-.Random.seed
result<-myfunction()
.Random.seed<-save.seed
Is there a way to do the restoration inside the function? I tried putting
the "save.seed<-.Random.seed" and...
2008 Aug 20
2
Reading in a value of .Random.seed in .Rprofile
For reasons that are best known to myself [ ;-) ] I have a value
of .Random.seed
saved (via dput()) in a file ``.Random.seed.save''.
In my .Rprofile I have the lines:
.Random.seed <- dget(".Random.seed.save")
Junk <- dget(".Random.seed.save")
print(all.equal(.Random.seed,dget(".Random.seed.save")))
print(all.equal(Junk,dget(".R...
2017 Nov 03
1
Extreme bunching of random values from runif with Mersenne-Twister seed
...Regardless, let me try to address some of the concerns related to the
construction of the MRE itself and try to see if we can clean away the
shrubbery & zero down on the core issue, since I continue to believe that
this is an issue with either R's implementation or a bad interaction of the
seeds supplied with the Mersenne-Twister algorithm itself. The latter would
require a deeper understanding of the algorithm than I have at the moment.
If we can rule out the former through this thread, then I will pursue the
latter solution path.
Responses inline below, but summarizing:
1. All example...
2018 Mar 04
2
Random Seed Location
The following helps identify when .GlobalEnv$.Random.seed has changed:
rng_tracker <- local({
last <- .GlobalEnv$.Random.seed
function(...) {
curr <- .GlobalEnv$.Random.seed
if (!identical(curr, last)) {
warning(".Random.seed changed")
last <<- curr
}
TRUE
}
})
addTaskCallback(rng_tracker, name...
2018 Mar 04
0
Random Seed Location
On 04/03/2018 5:54 PM, Henrik Bengtsson wrote:
> The following helps identify when .GlobalEnv$.Random.seed has changed:
>
> rng_tracker <- local({
> last <- .GlobalEnv$.Random.seed
> function(...) {
> curr <- .GlobalEnv$.Random.seed
> if (!identical(curr, last)) {
> warning(".Random.seed changed")
> last <<- curr
> }...