mbistato
mbistato

Reputation: 169

Different random number between SPSS and R by using the same seed

I'm generating random values from a Bernoulli distribution in both SPSS and R.

In R:

set.seed(9191972)
Y1C <- rbinom(nrow(data3), 1, 0.70)

In SPSS:

SET SEED=9191972.
IF  (MISSING(Y1) = 0) Campione=RV.BERNOULLI(0.70).
EXECUTE.

I don't get why the generated distributions differ. I've also tried to set the parameter "kind" in the function set.seed() in R but still got different values from those of SPSS. Also, I run R in SO Windows while SPSS in Mac. I'm wondering whether it could be due to the different SO used.

Upvotes: 2

Views: 114

Answers (1)

nograpes
nograpes

Reputation: 18323

R and SPSS don't use the same random number generator. Even if they used very similar generators, it is unlikely that any specific implementation would be the same.

You need to think of another way to solve your problem.

Upvotes: 2

Related Questions