Set Seed in R and SPSS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Set Seed in R and SPSS

88videos
hello,

*Is it possible to get the same result with using set.seed in R and SET SEED
in SPSS?
*

For example.

*SPSS code

set SEED=123.

DATA LIST list
/ID (F8.0).
begin data.
1
end data.
EXECUTE.
DATASET NAME example01.
DATASET ACTIVATE example01.

COMPUTE random_val = RV.UNIFORM(0,11).
EXECUTE.


*R code

rm(list=ls())

set.seed(123)

random_val<-runif(1, 0, 11)








--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Set Seed in R and SPSS

Jon Peck
No.  The algorithms that generate the random numbers are undoubtedly different even if they are implementing the same strategy.  The only way would be to generate the numbers in one program and import that as data in the other.

On Fri, Aug 23, 2019 at 9:45 AM 88videos <[hidden email]> wrote:
hello,

*Is it possible to get the same result with using set.seed in R and SET SEED
in SPSS?
*

For example.

*SPSS code

set SEED=123.

DATA LIST list
/ID (F8.0).
begin data.
1
end data.
EXECUTE.
DATASET NAME example01.
DATASET ACTIVATE example01.

COMPUTE random_val = RV.UNIFORM(0,11).
EXECUTE.


*R code

rm(list=ls())

set.seed(123)

random_val<-runif(1, 0, 11)








--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Set Seed in R and SPSS

Mario Giesel-2
A short addition:

In R write (write.table()) your random numbers into csv files, e.g. rand1.csv to rand999.csv. Then get these files with GET DATA ... to generate your analyses in SPSS. You can do this with a loop macro.

Mario Giesel
Munich, Germany
---

Am Freitag, 23. August 2019, 23:25:59 MESZ hat Jon Peck <[hidden email]> Folgendes geschrieben:


No.  The algorithms that generate the random numbers are undoubtedly different even if they are implementing the same strategy.  The only way would be to generate the numbers in one program and import that as data in the other.

On Fri, Aug 23, 2019 at 9:45 AM 88videos <[hidden email]> wrote:
hello,

*Is it possible to get the same result with using set.seed in R and SET SEED
in SPSS?
*

For example.

*SPSS code

set SEED=123.

DATA LIST list
/ID (F8.0).
begin data.
1
end data.
EXECUTE.
DATASET NAME example01.
DATASET ACTIVATE example01.

COMPUTE random_val = RV.UNIFORM(0,11).
EXECUTE.


*R code

rm(list=ls())

set.seed(123)

random_val<-runif(1, 0, 11)








--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]


===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD