全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SPSS论坛
14161 31
2012-02-17
Random Sampling with SPSS
Random sampling need not always be done by hand.  Sometimes random sampling may be completed as part of a computer analysis.  SPSS permits us to select a sample and then to determine if it possesses qualities that indicate that it captures characteristics of the entire sample.   Xcell does not include routines
to complete similar sampling.  This exercise is designed to give you a chance to examine this use of computers to help you secure a random sample.

As a starting point, we need a data set for analysis.
If you have not already done so, go to the Data Sets location and download the file nca.sav  
under the category, "NCA Study of  'How Americans Communicate.'"   If this source no longer
is available from the NCA website, then, download the file
nca.sav from the "SPSS Files"
category on the "Data Sets" web page.
Start your SPSS program.  From the "File" menu load the data file "nca.sav" from the location
where the you saved it after downloading.
Purpose of the Exercise:
The purpose of this activity to to complete a random sample of 200 individuals (20% of the total
sample) from the original survey of 1001 Americans.   Then, there will be an effort to see if the sample
is representative of the population on a key survey and population characteristic.

In the original sample, 52.2% (523) were women and 47.8% (478) were men.  In the original survey,
the variable of respondent sex was identified by the variable called "sex."  This item coded a person as
male (coded as 1) or female (coded as 2).

Steps in Conducting the Analysis
The process involves drawing a sample and then running a simple descriptive output with SPSS.  We
will guide you through these steps.

Draw the random sample. To draw a random sample of 200 (20%) at random from
the original survey, you need to follow several steps. From the "Data" menu click "Select Cases."  From the dialog box that emerges, select "Random sample of cases."  For the options
"Unselected Cases Are" select "filtered" if it is not already selected.  The dialog box should appear
as follows:

        Click on "Sample..." to bring up the Sample Size dialog box.  Select the "Approximately"
        option and insert 20% in the adjacent box to indicate a random sample of "20% of all
        cases."  The dialog box should resemble this on
e.      

Click on "Continue" and "OK" on the subsequent menu box.  Now a random sample has
been completed.  The unselected cases have not disappeared from the file, but they are
not used in subsequent analyses.

Check for a representative sample.  To determine if this sample is
representative, a descriptive output should be run for the SEX variable. To do so, click
on the"Analyze" menu, and on other menus select "Descriptive Statistics" and then
"Frequencies."  In the dialog box for "Frequencies," click on "sex" variable that appears in
the left window of the dialog box. Transfer this variable to the window marked
"Variable(s):" by clicking on the arrow key in the middle of the dialog box.  When you
have completed this process the dialog box should look as follows.

Click on the "Statistics" button, to open the following dialog box:

Place check marks in the boxes to select "Mean," "Std. deviation," and "S.E. mean."

Click on "Continue," and then click "OK" in the "Frequencies" dialog box.

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-2-17 16:26:26
The following SPSS programs will show how to select either type.
* random_sample.sps .
** Create 100000 cases for this example .
INPUT PROGRAM.
LOOP #I=1 TO 100000.
COMPUTE case = 1 .
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.
* Create a random variable .
* The following command will create a random variable with .
* values ranging from 1 to 100.
** If you want to be able to replicate your sample - set the "seed" .
** to some nomber .
set seed 10 .
compute randvar = uniform(100) .
save outfile = 'c:\tr\totalN.sav' .
** Demonstrate how to get an approximate 20% sample .
get file =  'c:\tr\totalN.sav' .
** If I don't need an exact N I can select based on this variable .
select if randvar ge 0 and randvar le 20 .
desc var = all .
** Demonstrate how to get an EXACT 20% sample (20,000 of 100,000 cases .
get file =  'c:\tr\totalN.sav' .
** If I don't need EXACT N I can sort by randvar,
** number the cases, and the select the first case .
** Since the cases will be in random order, it will be a random selection .
sort cases by randvar .
compute idvar = 1 .
* Use "create" and "csum" to create an incremented variable.
* The first case will be 1, second 2, and so on.
create idvar = csum(idvar) .
variable label idvar ‘Identification Variable’ .
select if idvar le 20000 .
desc var = all .
From: http://staff.washington.edu/glynn/RandomSampleSPSS.pdf
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-18 14:01:16
英文版的啊?看不太懂的,平时都用中文版的
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-18 14:06:55
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-18 15:16:28
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-18 15:53:34
spss还挺复杂的吗?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群