lundi 14 décembre 2015

Find the seed from set.seed() associated with a fixed random simulation in R

My problem is :

I've already saved a workspace with a fixed simulation that I called X1 from :

alpha=c(0,0.05,0.25,0.5,0.75,0.95,1)
w1=alpha
w2=1-alpha
n=100
m1=2
m2=6
X=matrix (nrow=n,ncol=length(w1))   # on l'appelle X ici mais cela est également notre X1 dans le rapport. 
for (i in 1:length(w1))
   { 
w=sample(c(1,2), size = n, replace = TRUE, prob = c(w1[i],w2[i]))
X[,i]=(w==1)*rnorm(n,m1,1)+(w==2)*rnorm(n,m2,1)         
}    

My problem is that I want to get the seed associated to this particular simulation of X(nrow=100,ncol=7) so that I could re-use it more easily.

I don't know if this could be implemented numerically in R ? And in general ?




Aucun commentaire:

Enregistrer un commentaire