November 2019 No. 14 Wang Tengfei spss

Set random seed

Conversion Select [1] - [] random number generator, checking the 'set the starting point' and 'fixed value'

Under 'value' a user inputs numerical values ​​given. The starting point for recording values ​​of random number generation, need to be repeated if the next generation, the same results, as long as re-enter the process, the initialization of the event generator 'fixed value' is set to the same number, the same group can be generated random number. In statistical simulation, set this value is called random number seed. Of course, need not be repeated if the set of random numbers to generate the future, they can not carry out the step. Here we set event generator, a fixed part of the initialization value is '123456'.

Conversion Select [2] - [] calculated variables, enter the variable name 'Spinn' box in the target variable

Enter 'Numeric Expression' box 'TRUNC (RV.UNIFORM (1,5))', and then click

[OK] button to generate a random number in 1000 spss data editor, they are other possible values ​​between 1 and 4. 

(1) Select the [Analysis] - Description Statistical] - [frequency], and the variable 'Spinn' is selected from the 'variable' box.

(2) Click [Chart] button, 'Frequency: chart' dialog box, select the 'histogram' option

(3) Click [Continue] button to return to 'frequency' dialog box, and then click [OK] button.

1, is a continuous random variable normally distributed random variable, which may be all values ​​and model, theoretical analysis of the data of all real numbers normally distributed data are required, so normally distributed random number in the simulation, a broad generating random numbers normally distributed and the application section 4.11 of generating a random number, except that the word similar expression evaluation variables using a different random number function.

(1) There is still first set the random number seed is '123456', and to open the data file chapter 'sim.sav'. And select [conversion] - [] calculated variables calculated variables dialog box to set the target variable 'Rnorp01' in the portion of the input 'numerical expressions' 'RV.Normal (0,1)' clicking [OK] button.

Save the file as 'Sim norm.sav'. Here we observe the distribution of random numbers generated. First, the drawing of FIG random number generated sequence and choose the graphic] [-] [Chart Builder Select 'bar' to the right of the template and then double-bar, the 'Rnorm01 at a' choice 'library' tag 'onto the canvas of the y-axis variable .'xid' onto the x-axis variable, and then set the element properties 'edit properties' box, select 'article 1' 'statistics' statistic selection list box section 'value' and then click [applications] and [Close button. Back 'Chart Builder' window, and finally click [OK] button. Get a bar graph of random variables

In fact, the bar chart shows the sequence of random numbers, and the horizontal axis is the serial number, and the vertical axis is the value of the random variable, which is called timing chart in time series. Here most of the generated random number zero fluctuations, fluctuations in the range substantially between -3 and 3, both the so-called 'white noise' sequence.

(1) Select [pattern] → [the section available program chart] Select "histogram" in the "Select" and "library" tab, the "Rnorm01" drag and drop on the horizontal axis. Then, the right hand lower corner "Element Properties" button to obtain a "Element Properties' dialog box, check box in which" displays normal curve. "

(2) to give "Rnorm01" histogram, seen from the histogram, the distribution of the generated random number has indeed normal, -0.016 their mean, the standard deviation of a sample size of 600.

Guess you like

Origin www.cnblogs.com/wangtengfei123/p/11862884.html