Spss Tutorial
Spss Tutorial
a c h i l l i b r e e z e p u b l i c a t i o n
a c h i l l i b r e e z e p u b l i c a t i o n
analyze your data or for your class. You must have realized that
it is not child’s play to use the multiple features that SPSS has to
offer. Don’t worry. Our SPSS tutorial will help you navigate through
the whole process and take you through a journey that covers the
basic features of SPSS that everyone uses. You might not turn into
using SPSS. Our examples and exercise problems will help you
Contents
SECTION I
Back to Basic
A Review of the Statistics that you learnt (or did not learn?) in College.... 6
I. Research Design.............................................................................................................. 7
a. ANIMAL RESEARCH ............................................................................. 7
a) Selection of species...............................................................................7
b) Selection of controls..............................................................................7
c) Feeding of controls................................................................................7
d) Treatment of controls............................................................................8
e) Ethical guidelines..................................................................................8
b. HUMAN RESEARCH............................................................................... 8
a) Case histories ......................................................................................9
b) Descriptive studies ...............................................................................9
c) Prospective studies (cohort studies).......................................................9
d) Retrospective studies (case-control studies):........................................ 10
e) Retrospective-prospective study: a combination....................................12
f) Open trials:.........................................................................................12
g) Cross-over trials:.................................................................................12
h) Blind trials:.........................................................................................12
i) Double-blind cross-over interventional trial:...........................................13
j) Metabolic studies:................................................................................13
k) In vitro studies:...................................................................................13
e) Chi-Square test...................................................................................22
f) McNemar test......................................................................................23
g) Sign test.............................................................................................24
h) Mann-Whitney U test...........................................................................25
h) Statistical Abuses...............................................................................26
j) Quiz to test yourself.............................................................................27
SECTION II
SPSS at Last
SPSS at last.......................................................................................................................... 32
Creating and Editing a Data File...........................................................33
Research Design
Evaluation of Measuring Instruments
Sampling and Sample Size
Mean, variance, Standard deviation, Degrees of freedom
T-test
Analysis of variance
Correlation and Regression
Chi-square test, Sign test, Man-Whitney U test etc
Statistical abuses
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
I. Research Design
In order to get good data, you need good research design skills. Even if you are
reading someone else’s research, to understand it better, it helps to know something
about correct and incorrect research design. There are lots of ways to design a research
project and not all of it is documented. Here, we will describe some of the more common
methods plus will give you a few tips for your research design too.
a. ANIMAL RESEARCH
Most biomedical research is first conducted using animal models. Much of this
initial animal research cannot be performed in humans due to ethical, cost and/or time
considerations.
a) Selection of species
The particular species to be used as a model is chosen for one/more of the following
reasons:
1. Similarity of the organ system, disease, metabolic pathways, etc. to the
equivalent in human beings.
2. Small size for ease and economy in housing, feeding, manipulation, etc.
3. Relatively short life span to allow for life-time studies, studies over more than
one generation, etc.
b) Selection of controls
This is one of the most important considerations in the design of an animal experiment.
Let us say the investigator is performing a study to determine the deficiency of a
particular nutrient on some measurable parameter. Animals in the experimental group
would be fed a diet containing required amounts of all known nutrients except the
nutrient under study (or the diet would be low in the nutrient). The control group would
receive a normal (same in all respects but with the nutrient present) diet.
The controls need to be similar to the experimental animals in all respects like
weight, age, genetic strain, etc. In fact, a group of animals need to be randomly divided
into experimental animals and controls. To avoid bias, someone other than the principal
investigator can perform the actual separation.
c) Feeding of controls
Some animals will consume less of an incomplete diet than they will of a nutritionally
complete diet. If the experiment is run as designed above, the investigator may get false
results that show that deficiency of the nutrient influences the variable being measured.
In reality, the variable may have changed because of the low quantity of food consumed
by the experimental animals. To avoid this, it may be best to have a second control
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
group that is “pair-fed” to the experimental group. The amount of food that is consumed
by the experimental group is measured and then that amount of the control diet is fed
to the pair-fed controls. In another approach, the mean intake of food eaten by the
experimental animals is calculated each day and all of the control animals are fed this
amount the following day.
d) Treatment of controls
Do unto your controls as you would do unto your experimental animals. Basically,
try and eliminate other factors which might be different between experimental and
control animals. If some procedure like an injection or a surgery is performed on the
experimental animals, the controls too should receive a sham procedure. Other variables
to consider in animal experiments are: water consumption, non-dietary sources of
nutrients (e.g. zinc from nibbling on cage bars), time of day procedures are done,
amount of space allocated to the animals, amount of exercise, location within the cage,
number of animals per cage, nature of animals in neighboring cages, etc. Also, there
should be concern for diseases that the animals might transmit to each other or to the
investigator and for diseases that the investigator might transmit to the animals.
e) Ethical guidelines
b. HUMAN RESEARCH
In human research, there are a lot of other guidelines and considerations. One can
divide the types of research design into
1. OBSERVATIONAL STUDIES where the investigator does not alter the natural
occurrence of events but records them and formulates hypotheses and/or conclusions
about what he/she observes. Observational studies are of several types including:
Case histories
Descriptive studies
Prospective studies (Cohort studies)
Retrospective studies (Case-control studies)
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
Let us have a closer look at these different kinds of research designs and what
information each can provide us with. This is important for statistical analysis because,
in order to interpret your data, you need to know the usefulness and limitations of each
kind of study and how to classify any particular study. Let’s say you have results of a
Retrospective study and you ask the statistical program to compute Absolute Risk, this
would be meaningless because Retrospective studies can only measure Relative Risk.
a) Case histories
These studies are often referred to as anecdotal evidence. They are widely used as
testimonials in advertising. In science, they may not be of much value as data, but they
do provide an insight into areas of possible further research. But case histories cannot
give definitive evidence that a certain factor is causal for a certain disease or tat a certain
treatment is effective. Many journals separate these articles into a different section of
each issue. These studies serve as a method of rapid communication of clinical findings
and hypotheses to the scientific community and help generate new leads for future
research.
Example:
In a recent report, a physician described a case-history in which a patient with
Common cold, experienced complete remission of symptoms following one week of
supplementation with Vitamin C. Let us examine this closely.
Does this report demonstrate that Common cold is caused by Vitamin
C deficiency? No. This evidence is not sufficient for a conclusion of this
magnitude. Doing that would be equivalent to saying an infection is caused
by an antibiotic deficiency.
Does this report demonstrate that most common cold patients can be treated
successfully with Vitamin C? No. The study has been performed on a single
patient and the results cannot be extrapolated to a population.
Does this report show that this particular patient was cured by Vitamin C?
No/Maybe. The patient may have been cured due to other factors/drugs/
his own immunity/other remedies etc. There was no control for this case.
There is no way of knowing if the patient would have been cured without
intervention.
b) Descriptive studies
These are often large population studies in which data on lots of different variables
is collected. It is somewhat like a census. Statistical analyses on the data collected may
show various relationships that lead to hypotheses for further study. They may also
provide estimates of the magnitude of a particular problem and the frequency of certain
behaviors among the population. Sometimes they may also generate meaningless
correlations (example: most alcoholics in a particular area send their children to
private schools) that need to be neglected. Descriptive studies are also referred to as
epidemiological studies or surveys.
A prospective study consists of two samples, one of which has been exposed to the
suspected risk factor (a + b) and one not exposed (c + d). The two samples are followed
through time to determine which group has the higher incidence (or cause-specific
mortality). In other words, a prospective study compares the absolute risk (of illness or
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
death) of those exposed with the absolute risk of those not exposed. An example of a
table of data from this type of study is shown below.
Exposed a b a+b
A retrospective study consists of two groups, one with the disease (a + c) and the
other without the disease (c + d) under study. The group with the disease consists of
10
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
“cases” and the group without the disease is the group of “controls”. The typical way of
expressing data from such a study would be as below
1. Cases and controls are compared with respect to the proportions that have
been exposed to the risk factor. The proportion of cases exposed (a / a +
c) is compared to the proportion of controls exposed (b / b + d) i.e. rate of
exposure in diseased/rate of exposure in the non-diseased.
2. If, in the population at large, the number of persons who have the disease
is quite small compared to the non-diseased population, Relative Risk may
be estimated by using the “odds ratio” or cross-product ratio” or “relative
odds”
ad
_____
bc
****** Neither absolute risk (incidence) nor attributable risk can be inferred from a
retrospective study without reference to outside information.
Then, you may wonder, why are these tests done at all?
The reasons may be:
1. They consume less time
5. These studies are less unethical because we are not denying/ causing
exposure to any suspected curative/ causative agent.
11
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
Some countries such as Finland have their entire population registered in the national
health program since a very long time. This provides investigators with solid records and
accurate information about any section of the population going back to any period of
time. The investigators can then start with the point at which exposure took place and
then track individuals until the present. This type of study combines the advantages of
both prospective and retrospective studies.
f) Open trials:
This is the simplest kind of interventional study. In this design, the researcher and
the subjects, both are aware of the nature of treatment and the intended/ expected
results.
Example: A group of diabetic women were used to study the effect of a particular
herb extract on their fasting blood sugar levels. The fasting blood sugar levels would
be determined at the beginning of the experiment and again after a 10-week period
of receiving the extract. In this instance, each subject served as her own control.
Alternatively, there could have been two groups, one receiving the extract (experimental
group) and one receiving a placebo (controls). In both the above cases, the herb extract
use, the placebo use and the hypothesis being studied would be known to all parties.
These trials have the benefit of being very easy to conduct and also avoid the
ethical issue of withholding a particular treatment from the control group. The biggest
disadvantage to this method of research design is that knowledge of the treatment
method/ placebo may influence the outcome due to actions and psychology of the
subjects and/or the researchers.
g) Cross-over trials:
In cross-over trials, two groups of subjects are studied. One group receives the
active treatment for an initial period of time while the second receives a placebo. At
the end of the designated period, the first group is switched to placebo and the second
to the active treatment. This design is used to help eliminate effects caused just due
to participation in an experiment and those due to seasonal variations in the variables
being measured.
h) Blind trials:
Here, some of all of the participants and/ or researchers are prevented from knowing
the identity of the group receiving the treatment until the conclusion of the experiment.
In a “single-blind” trial, the subjects are denied knowledge of whether they are receiving
the active treatment or placebo but the researchers are aware of the identities of the
experimental groups and controls. In a “double-blind” trial, neither the subjects nor the
researchers know which individuals receive the active treatment or placebo until the
experiment is over and the data has been collected. The latter experimental design helps
12
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Research Design
to control for the “placebo effect” as well as to control for experimental bias.
You may ask- Why should the investigator be “blinded”? The answer remains the same-
To avoid bias. Let’s say the investigator gets a good result from the diabetes experiment
(the herb reduces fasting blood sugar); he will not repeat the experiment because the
“good result” is in the experimental group, which strengthens his hypothesis. If the
same result is obtained in the control group (the placebo reduces fasting blood sugar),
he will definitely repeat the experiment thinking that it is an error. So the treatment
of experimental groups and controls may not be exactly the same. To avoid this, the
investigator’s unbiased colleague does the labeling, feeding and keeping of records.
Example: Let us say the investigator wants to perform the same experiment- test if
the herb extract influences fasting blood sugar in diabetic women. A group of diabetic
women are randomly divided into two groups of equal size. All relevant characteristics
are similar in both groups (weight, height, age, blood sugar levels, diet etc.) A capsule
is developed for the experiment- one with the extract and one with the placebo. The two
capsules are indistinguishable in appearance. One group receives the extract capsule
for 10 weeks and the other receives the placebo capsule for 10 weeks. The distribution
is done by an individual not directly related to the project. After the final blood samples
have been analyzed and decisions made as to who improved and who did not, the code
is revealed to the investigator as to which group received the extract.
This is a blending of the double-blind and the cross-over design. It is one of the most
respected forms of trial design for human studies.
j) Metabolic studies:
These are usually carried our in a relatively small number of subjects who are placed
in a metabolic ward for intensive study. Individuals generally serve as their own controls.
Mineral balance studies would be an example of this kind of experimental study. Here,
the subjects are fed chemically defined diets containing varying and known amounts of
the mineral being studied. Then the losses from hair, skin, swear, urine, feces etc. are
carefully determined. These studies need a lot of time and effort, and any minute error
while performing the study may result in totally erroneous results.
k) In vitro studies:
In vitro means the study is conducted outside the living body. It may be performed
on cells, tissues, organs etc. in laboratories under specific conditions. This type of
work is very common and generates a lot of data for statistical analysis e.g. cell counts,
isotope counts, optical density, area under the curve, etc. Sometimes the nature of the
laboratory work requires that the data be converted into percent of control for statistical
analysis.
13
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Validity (or accuracy) is the ability of a measuring instrument to give a true measure.
Validity can be evaluated only if there exists an accepted independent method for
confirming the accurate test measurement.
Example: Suppose a new test was developed to determine HIV positivity. We call our
test “Test A”. We run our test on a large group of people and then run the PCR reaction
followed by Western immunoblotting for HIV on the same group of people and record
the true outcome.
True outcome
Test A results
a = true positives Sensitivity = (a / a + c) x 100 = 530/535 x 100 = 99.07 %
b = false positives
c = false negatives
d = true negatives Specificity = ( d / b + d) x 100 = 300/465 x 100 = 64.52 %
14
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Evaluation of Measuring Instruments
Most statistical procedures require that our sample be drawn randomly and that
our experimental units (subjects, animals, etc.) be allocated independently (randomly)
to experimental and control groups. If we fail to do this, the validity of our research in
drawing conclusions about the general population is limited. For example if we were
interested in determining the average expenditure of people living in New York and
drew our sample from a list of people living in Brooklyn, we would get an incorrect
idea of the expenditures. Similarly, if we were trying to solve a public health problem
and only used the group of people listed in the telephone directory, we would still be
making a limited conclusion because everyone need not have private phone numbers.
Thus Sampling techniques become very important. The rule we must meet if we are to
have a “fair” sample is that every individual within the population must have an equal
chance of being selected. There are many sampling designs possible, but the three that
are most commonly used are:
1. Simple Random Sample: This is something like pulling out names from a
hat. It may involve the use of a computer and a random number generator.
A complete randomized list is necessary.
b) Sample Size
The sample size in an experiment is an important feature in its design and the
interpretation of its results. If the sample size if too small, it may be tough or impossible
to find statistically significant results. But that does not automatically imply that the
larger the sample size, the better our experiment. If the sample size is too large, trivial
differences will have very statistically significant values and we will be easily impressed
with the findings. E.g. If we want to determine the differences in mathematical skills in
boys and girls, and we use 100, 000 boys and 100, 000 girls for this study, we might end
up with a statistically significant result even if the actual difference may be unimportant.
Hence, the number of subjects used for a study needs to be chosen very carefully.
There are several methods and formulae for selection of appropriate sample size and
these must be used before we begin an experiment.
15
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Null hypothesis: the hypothesis being tested in statistics (that there is no difference
between the groups under study).
p or p value: level of significance e.g. p< 0.05 means that there is a less than 5 % chance
of having committed a Type I error.
Variance: a measure of the average variability of a data set from the mean.
16
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
a) The t-test
17
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
The hypothesis being tested by a t-test is that two samples are equal
Ho: x1 – x2 = 0
The alternate hypothesis is that the means are not equal.
Different research situations call for slightly different versions of the formula for
calculation of the t-test. If the variance of the two samples is equal, a “pooled-variance”
t-test is conducted. E.g. If we are studying blood sugar of males and females, we expect
the variance to be similar for the two groups.
x1 – x2
t = --------------------------
sp
______________________
(n1 – 1)s12 + (n2 – 1)s22
where sp = -------------------------------------------
n1 + n2 -2
√
the degrees of freedom (d.f.) = n1 + n2 – 2
If the variance of the two samples is not equal, we use the “separate variance” t-test.
This is also called independent t-test. It is calculated with the following formula:
x1 – x2
t= ----------------------------------
_____________
s12 + s22
---- ----
n1 n2
√
[(s12/n1) + (s22/n2)]2
degrees of freedom (d.f.) = --------------------------------------------
[(s12/n1)2/ (n1 + 1)] + [(s22/n2)2/ (n2 + 1)]
After selecting the appropriate formula, we calculate the t-value using the data from
our experiment and then look up the critical of “t” in a table. If our t-value exceeds the
critical value of “t” at our degrees of freedom, then we must reject the null hypothesis
and infer that the alternate hypothesis is true (The means are significantly different).
Example:
Suppose we conducted an experiment to determine the effect of a protein supplement
on the body weight of low birth weight babies. The results of the experiments are as
follows:
Standard deviation 3 3
Sample size 25 25
Our variances are equal (3 squared = 9) therefore we will use the pooled-variance
t-test formula.
100 – 88 12
t = ----------------------- = ----------------- = 14.142
___________ _____
3 √ 1/25 + 1/25 3 √ 0.08
From a table of t-values we find that with 48 degrees of freedom, our t-value exceeds
the critical value of “t” at the 0.001 level. Therefore we report that the protein supplement
had a significant effect on weight gain.
Paired t-test: This is a special t-test to use for research designs in which the data are
from paired samples e.g. if we collect data from the same individual before and after a
particular treatment. Here, everyone is his own control. We can calculate a mean change
or mean difference from our experiment and similarly a variance of the differences. Then
we can use the paired t-test formula:
x d
t= -------------------- [the degrees of freedom is (nd – 1)]
_____
sd √ nd
Note about statistical tables: The tables for looking up p-values are readily available
online and also in online calculators (the simplest method according to us). Just look for
p-value calculators. And one more thing- Once you start using SPSS for your analysis,
SPSS will look up the p-values for you. So do not worry about the tables. This is true
for all the tests that follow including Analysis of variance, Sign test etc. etc.
It would be erroneous to use the t-test when we have more than 2 groups. In this case,
we need to use another test. The most common test for analyzing more than 2 groups
is called “Analysis of variance”. Analysis of variance uses the F-distribution which, like
the t-distribution is a modification of normal distribution. If we are only interested in the
differences between group means, then we would use a one-way analysis of variance.
If we are also interested in testing for differences within groups, we would need to use
a two-way analysis of variance (not very commonly used in biotechnological research).
If we are to calculate a one-way AoV, we need the following information.
GT = the sum of all observations (to get this, just add all data points)
Ti = the sum of the observations in the i-th sample (In a given group, what is the
total sum)
ni = the number of observations in the i-th sample
N = total number of observations
(Ti) 2
∑ ------ = the sum of the square of each sample’s total divided by its sample size
(for
19
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
ni every group)
(∑ (Ti2 / ni ) ) – (GT2 / N)
_______________________
(k – 1)
F = _______________________________________________
(∑i ∑j (x ij )2 ) – ((Ti) 2/ ni )
__________________________
(n – k)
Once we have calculated the F- value, we can compare it to the critical value of ‘F’
in the table. We can then determine whether to accept or reject the null hypothesis that
no difference exists between group means. This will only tell us that at least 2 means
are different- they would be the highest and lowest values. If we want to know which
means are different from each other, we need to perform further tests. Examples include
the Scheffe test (most stringent), the Newman- Keul’s test, Duncan’s multiple range test
and others. Our research situation and our needs will determine which of the above is
appropriate. One interesting thing is that in AoV calculations, if k = 2, we will get the
same results as a t-test. AoV automatically adjusts to ‘t’ which in turn adjusts to a value
of 2.
c) Correlation
The correlation coefficient can be tested for statistical significance using a table of r
values or by using a special t-test. Either way, it is necessary to calculate the d.f. (degrees
of freedom) which for this calculation (correlation coefficient) is equal to n-2. The special
t-test is calculated using the following formula. Here we ignore the sign of r.
______________
t = r √ (n-2) / (1 – r2)
d) Regression
Another related way of looking at the relationship between two quantitative variables
is regression analysis or regression. In regression analysis, one of the variables is logically
dependent on (or influenced by) the other variable. For example, heart rate might be
influenced by age. In the jargon of regression analysis, heart rate would be a dependent
21
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
variable and age would be the independent variable, since it is not logically influenced
by heart rate.
By convention, in regression analysis, the y-axis of a plot is used for the dependent
variable and the x-axis for the independent variable. As in correlation analysis, we can
use a scatter plot, but in addition, regression analysis will provide the best fitting straight
line through our plot. To describe the line, we must have two pieces of information: the
slope of the line, b and the y-intercept of the line, a. The slope measures how much the
y- variable changes for each unit of change in the x-variable (+ means the line rises and
– means the line falls). The y-intercept tells us where the line starts (i.e. the value of y
when x = 0). Once we have this information we can use the formula for a straight line:
y = a + bx
The slope of the line can be calculated by the following formula:
∑xy – (∑x) (∑y) / n
b= ______________________________
∑x2 – (∑x)2 / n
The table with data (that we used for the correlation coefficient) can be used here,
but is not a real example for regression analysis. Using the table gives us:
B = 448.4/59.6 = 7.52 (means that for every unit of x increase y will increase 7.52
units).
The y-intercept can be calculated since logic dictates that the best fitting line must
pass through the pint at the mean of x, mean of y. And since:
y = a + bx then: y = a + b x
Or equivalently
a = y - b x
All that is required is that we calculate x and y to be able to obtain a. Using the
data table, the means of y and x are 137.8 and 65.2 respectively. So:
a = 137.8 – (7.52 x 65.2) = -352.73
This type of calculation can be very useful in the laboratory. For example, if we
know the concentration of a standard protein and we measure absorbance of unknown
samples, using regression, we can calculate the unknown concentrations of the protein
samples. This is a very commonly used calculation.
e) Chi-Square test
For research situations in which frequency and/or categorical data are collected, a
different set of statistical procedures must be used. One of the most common of these
procedures is called the Chi-square test. This test can handle any number of groups
and any number of possible outcomes. For simplicity, we will look at a test with a 2 x
2 situation (two groups and two possible outcomes). The formula for calculating Chi-
square is as follows:
__ __
( O – E) 2
χ2 = ----------------
E
Where:
O = the observed frequency
E = the expected frequency = (Tr x Tc ) / N
Tr = row total
Tc = column total
N = total number of observations
d.f. = (r-1) (c-1)
r = number or rows and c = number of columns
Example :
Suppose we conducted an experiment to determine the possible detrimental effect of
a new drug on birth weight of rats- Pregnant rats were given either the drug or a placebo
and the results were observed in their offspring. Data collected:
Control group Experimental group Total
Calculations:
O E O-E (O-E) 2 (O-E) 2/ E
10 22.73 -12.73 162.0529 7.1295
90 77.27 12.73 162.0529 2.0972
40 27.27 12.73 162.0529 5.9425
80 92.73 -12.73 162.0529 1.7476
________
Chi-Square value 16.9168
We then compare this value (16.2) to the critical value of Chi-square in the Chi-
square table and make our decision about our hypothesis. Here p < 0.005. So the new
drug causes low birth weight in rats compared to the placebo.
One problem with Chi-square test: Here if E < 5.0 then there is distortion in data.
When we do (O-E), the gap between the points decreases as the numbers get smaller.
This can be prevented by using Yates’ correction i.e. (| O – E | - 0.5 ) 2 is used as
numerator in the formula in such cases. (Do not worry about this at all. SPSS does this
automatically. We put in this information just to show off a little bit.)
f) McNemar test
In case of the Chi-square test, one prerequisite is that the groups are independent
and not related, matched or paired. For experiments in which paired samples or “before
and after” experiments, the more appropriate test would be the McNemar test. It is a
modified type of Chi-square test. The data are arranged as follows:
AFTER
- +
+ A B
BEFORE
- C D
23
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
In this test, we are only concerned with the observations that changed during the
experiment i.e. cells A and D of the table. Since A + D represents the total number of
observations that changed ½ (A + D) would be expected to change in one direction
and ½ (A + D) in the other direction if our experiment had no effect on outcome (If null
hypothesis is true, A and D would be the same).
(A – D) 2
χ
2
= ---------
(A + D)
Example: Suppose we want to test whether or not the presence of a particular object
in the room influenced the biting behavior of dogs caged in the room. To conduct our
experiment, we would need a room full of caged dogs, the suspected object and an
artificial hand for the dogs to bite. The hand could be placed in the cage of each dog in
the absence and presence of the suspected object. If the hand is bitten, we would record
a +ve response and if not bitten, a – ve response. Our data can be shown as follows:
AFTER
- +
+ 10 20
BEFORE - 50 120
χ2 = (110) 2 / 130
= 93.08
The interpretation is similar to the Chi-square test. So the null hypothesis can be
rejected.
g) Sign test
h) Mann-Whitney U test
After the ordinal level of measurement has been achieved, Mann-Whitney U test can
be used to test if two independent groups have been drawn from the same population.
This is one of the most powerful of the nonparametric tests. The null hypothesis is that
both groups have the same distribution. The alternate hypothesis is that one group
ranks higher (better) than the other. If the experiment has no effect then we expect the
groups to be equal.
To conduct the test, we must first assign a score to each subject: combine the data
from the two groups; and rank the scores in order of increasing size. We let n1 = the
number of cases in the smaller of the groups and n2 = number of cases in the larger. To
determine U, we focus on the smaller groups (if groups are of equal size, just pick any
one). The value of U is equal to the number of times that a score in the larger group
precedes a score in the smaller group. We then compare our U to the table for Mann-
Whitney U test.
Example:
The effect of zinc deficiency on learning was studied on rats. Ten control rats are fed
a nutritionally complete diet while experimental rats are fed a low zinc diet for 10 weeks.
Initially, all rats had been trained to imitate a leader rat in a T maze. The experimenter
records the number of trials each rat requires to reach a criterion of 10 (in a row) correct
imitations in 10 trials. The more the trials required, the more the memory affected. The
data are presented below:
25
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
Group C C E E E E C C E E C C C C C C E E
Score 45 48 51 53 54 57 62 64 68 70 75 76 77 78 82 90 93 110
h) Statistical Abuses
Examples:
Example 1:
t-tests are designed for no more than 2 samples. If we have an experiment in which
there are five groups of subjects (Groups A-E) we might wish to make the following
comparisons:
A vs B, A vs C, A vs D, A vs E, B vs C, B vs D, B vs E, C vs E and D vs E
In the above graph, A is the mean heart rate of 30 females and B is the mean heart
rate of 30 males. A and B look significantly different from each other, in the graph. This
is because the graph is plotted from 60 to 76. If the graph had been plotted from 0 to
100, the difference between A and B would not seem so high. In reality, the difference
between A and B is not significant. But if we were unethical and wanted to present this
data to an audience to convince them that the heart rate of males was much higher than
females, we could easily represent the data in this manner and achieve our end. This is
extremely misleading and an incorrect way of representing statistical results.
Have a look at the questions/problems below. You will be able to solve them yourself.
Our tutorial has not provided solutions. If you find it impossible to get the solution for
any particular problem, feel free to contact us anytime.
I) Name the type of association between the risk factor and disease in each of the
examples below:
A. It has been observed that people who have low cholesterol are more likely to
be interested in travel than individuals who do not. What is the most likely
type of association to explain this finding?
27
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
II) Give the appropriate statistical test for each of the following research designs
A. Eight groups of mice (n = 40) were fed either a complete normal diet (Group
I or controls) or diets restricted in protein as follows: Group II = 10 % less
protein, Group III = 25 % less protein, Group IV = 20 % less protein, and
Group V = 30 % less protein. Mean weight gains were compared after feeding
these diets for 12 weeks. Investigators compared each mean to the control
group.
B. In the same research project described in “A”, numbers of rats who gained
less than 90 % of the weight gained by the control rats were compared.
E. A group of rats was split into a control group and experimental group. The
experimental group received three weeks of zinc deficient diet while the
control group received an adequate diet. At the end of the experiment, the
rats were scored as to their ability to solve a maze problem. The investigators
wished to determine if the experimental groups have lower ranking scores
than the controls.
What is the absolute risk of having breast cancer among women drinking more than
2 cups of coffee per day?
IV) Your project for your grant proposal will examine the effect of various diets on
the prevention of protein cross linkage in rats treated with the pro-oxidant doxorubicin.
You intend to compare three different antioxidants as dietary supplements. You feed four
groups of rats a semi-purified diet which contains either no antioxidant (control group)
or one of the antioxidants under study. You need to now tell your professor how many
animals to buy. How do you determine the sample size for each group of rats?
A. A national survey indicated that high fiber diets were associated with low
incidence of stroke.
D. The association between high fiber diets and colon cancer was studied in a
group of 5000 vegetarians and a group of 4000 individuals who ate mostly
beef and did not have high fiber diets. The two groups were followed for a
period of 10 years. At the end of the period incidences of colon cancer were
compared.
VI) An investigator developed a new assay for determination of sickle cell anemia.
The table below displays the results of an experiment. (A positive test indicates a
sickle cell patient)
Traditional Methodology
Sickle cell Normal Total
Sickle cell 91 12 103
New test Normal 9 38 47
Total 100 50 150
29
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Types of data and appropriate statistical tests
c. 103/150 = 68.7 %
d. 38/50 = 76 %
e. 47/150 = 31.3 %
As we have said before, if you get stuck on any of the above problems, do ask us
for the solution.
SPSS at last
Now that we have given you a brief (was it?) introduction to the basics of statistics,
we think that you will be able to understand SPSS much better and faster and will not
struggle with every tiny step of the tutorial that SPSS offers with its package. In this
SPSS tutorial, we shall be covering the basics of how to use SPSS. Students usually
use SPSS for their classes and more importantly for their research analysis. Let other
people talk about how tough it is to work on SPSS. We will show you how simple it is.
The versions of SPSS may keep changing. Do not panic and go to the store to buy the
latest version every time it is launched. The basic features have stayed the same since
a very long time just like any other software program (Think about it- Do you see any
change in MS Word in the past five years?)
Now straight to the tutorial. When you open SPSS (obviously by double-clicking on
the icon) you will see this window.
If you want to run the tutorial, you know what to do. You can access the tutorial
anytime via the Help pull down menu on the data editor.
We suggest you take the tutorial at some point of time, especially if you need
information about every teeny-weeny aspect of every icon. As for now, you can take this
tutorial and start actually using SPSS. After all that is what you bought this for, right?
In order to use SPSS for statistical analysis, you must first have a file containing data
to be analyzed.
You can use a spreadsheet software package such as MS Excel. You might
want to do this because let’s say you already have a lot of data on Excel and
want to transfer it to SPSS you would not want to type everything all over
again. You would then need to follow the instructions associated with that
software package. WARNING: This is not a simple Copy and Paste procedure.
Be sure to save your data file as a tab-delimited text file. Otherwise, this
process itself will become your greatest headache. (You can specify your
variable names on the first line of your Excel spreadsheet and load them
directly into SPSS when you Open the file. You can get more instructions
regarding this in the SPSS Help section).
33
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
SPSS at last
You can enter your data into a command file between the “BEGIN DATA”
and “END DATA” commands.
NOTE: This should be done only for very small data sets.
Regardless of how you create your data file, the first step is to determine what the data
are and how you plan to organize the whole thing. It is recommended that you use fixed-
field format for your data until you become an SPSS-pro. You don’t have to worry about
this. SPSS itself uses a fixed-format system for your data by default. Free-field format
may seem tempting, but before you step into that arena, remember that- it is difficult to
edit if your files are large and a lot of steps and additional typing will be required if you
have missing data. (Any real experiment is bound to have some missing data).
Once you have created a data file you can start performing statistical analysis on
your data using SPSS.
35
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Typical SPSS session
If you want to run the tutorial, you know what to do. You can access the tutorial
anytime via the Help pull down menu on the data editor.
We suggest you take the tutorial at some point of time, especially if you need
information about every teeny-weeny aspect of every icon. As for now, you can take this
tutorial and start actually using SPSS. After all that is what you bought this for, right?
In order to use SPSS for statistical analysis, you must first have a file containing data
to be analyzed.
You can use a spreadsheet software package such as MS Excel. You might
want to do this because let’s say you already have a lot of data on Excel and
want to transfer it to SPSS you would not want to type everything all over
again. You would then need to follow the instructions associated with that
software package. WARNING: This is not a simple Copy and Paste procedure.
Be sure to save your data file as a tab-delimited text file. Otherwise, this
process itself will become your greatest headache. (You can specify your
variable names on the first line of your Excel spreadsheet and load them
directly into SPSS when you Open the file. You can get more instructions
regarding this in the SPSS Help section).
You can enter your data into a command file between the “BEGIN DATA”
and “END DATA” commands.
NOTE: This should be done only for very small data sets.
Regardless of how you create your data file, the first step is to determine what the data
are and how you plan to organize the whole thing. It is recommended that you use fixed-
field format for your data until you become an SPSS-pro. You don’t have to worry about
this. SPSS itself uses a fixed-format system for your data by default. Free-field format
may seem tempting, but before you step into that arena, remember that- it is difficult to
edit if your files are large and a lot of steps and additional typing will be required if you
have missing data. (Any real experiment is bound to have some missing data).
Once you have created a data file you can start performing statistical analysis on
your data using SPSS.
Step 1 : Open SPSS. The program will load and the Data entry Window will open.
Step 2: Get your data. How you do this depends on the method used to create your
data file.
Step 3: Generate SPSS commands. Select your commands from the pull down
menus of the toolbar at the top of the screen or load them into SPSS as an
SPSS syntax file.
Getting Started
We suggest that you begin each SPSS session in the following way (especially if you
plan to print out your results for your professor or for whatever reason). This will minimize
the amount of paper output you generate (Not all universities offer free printing. At 10
cents a page, you can get a burger by saving 25 pages. Just don’t blame us when you
get fat). Select Options from the Edit pull down menu on the toolbar at the top of the
screen. From the Options dialog box, select the Viewer tab at the top of the dialog box.
Click on Infinite in the Text Output Page Size section of the dialog box. Also, click
Display commands in the log to cause your commands to appear on your output. Then
click on OK. This will cause SPSS to use the minimum amount of paper possible when
you print your output at the end of your session. SPSS, left by itself, issues a lot of “end
of page” commands that are pretty much gibberish for you and your professor and
consume too many papers while printing.
37
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Let us say you type “Age” under variable name, the other values appear as they are
set by default. You can change all the values as per your requirements.
39
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating a New Data File with the Data Editor
The following have other specific meanings for SPSS and cannot be used
as variable names by themselves- ALL, AND, BY, EQ, GE, GT, LE, LT, NE,
NOT, OR, TO, WITH (Though it is possible to use ALL1/ALL2 and so on)
Our tip : Avoid using symbols in variable names. That way, you won’t need to
remember which ones are okay and which ones are not.
Enter a name for your variable in the 1st box. By default, the variable type is numeric
with a w.d. (width. decimal) format of 8.2. If this is incorrect, click on the … button in
the Type box to specify the correct type in the Variable Type dialog box. If the column
width and number of decimal points are incorrect, fix them in their boxes.
Variable LABELS and VALUE labels can be used to make your output easier to
understand. A variable LABEL is used to descriptively label the variables. Its use makes
the output easier to read and can be very useful if the output is used over a long time
period. Each label cannot exceed 60 characters (most procedures will only print 40 at
a time and some will print even fewer)
A VALUE label is used to descriptively label the values of a variable. Its use makes
the output simpler to read and can be very useful if the output is used very a long time
period. Similar to variable labels, each label must not exceed 60 characters (Most
procedures will only print 20 of them).
Missing Data
The presence of missing data is very common in any kind of research. You will
always come across dead mice, sick children, non-compliant adults, unfilled forms,
lost samples and so on. You can’t really do anything about it, other than planning for it
while creating your data file. You can enter a special code to indicate missing data or
you can leave the item blank. The good thing about SPSS is that any blank or period
(“.”) is considered missing data unlike some other software programs which consider a
blank as zero (can’t even imagine the amount of distortion that would cause).
41
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Fixed Format: Data files are most often fixed format. This is simper to read, edit
and understand. Fixed format means that the data for a given variable occupies the
same line columns and line position for each case (Note: If there is more than one line
of data per case, you must use the RECORDS subcommand to specify the number if
lines per case).
Example:
ID # Columns 1-3
Weight Columns 5-9
Height Columns 11-13
001 065.3 091…….
002 141.3 171…….
003 12.4 154…….
Free-field format: This is another form of data organization. The variables are in the
same order for each case but do not necessarily occupy the same line columns for each
case. The data for each variable must be separated by one or more spaces or a comma
in the data file. According to us, it is better to stick to the fixed format while preparing
data files for SPSS especially since in the free-field format, there will always arise the
problem of missing data (part and parcel of any experiment).
Example:
ID WEIGHT HEIGHT
001 65.3 91
002 141.3 171
003 122.4 154
43
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
The first thing to do when you get data from any research project is to examine
the data in detail. It does not matter whether the procedure used to do this is simple
or complicated. The basic point is- If the data is incorrect, conclusions will be faulty
and the whole experiment will come to naught. To avoid this it is better to eyeball your
data using SPSS first to look for any errors. Errors can enter data at multiple steps.
Measurement can be in error due to poor technique, faulty instruments, or careless
observers. Recording of data into a notebook can be done incorrectly or illegibly.
Transcription to an electronic format can be in error. Data can be corrupted by defective
disks, faulty hardware or software, computer viruses, user errors, etc. Some errors are
relatively easier to spot e.g. an LDL cholesterol of 0.0 or 5000.00 mg/dL. Others may
be difficult, if not impossible e.g. an LDL cholesterol value of 312 mg/dL recorded as
123 mg/dL. Unless you begin your data analysis with a careful check of your collected
data, errors can distort your findings.
Careful editing of data files by comparing them to the original raw data is a good
first step. Careful examination of the data displayed on the screen or a print out can
help with this task too. The command EXPLORE can help us a lot in this process.
EXPLORE can help us look at our data in different ways to determine if the data seem
reasonable. EXPLORE can also help us to decide, in some cases, on the appropriate
statistical tests to use.
This command will allow the examination of summary statistics such as range,
median, mean, mode, measures of variability, measures of skewedness, etc. as well as
displaying the data in a variety of graphic output formats. If you need extra information
about this command, refer to the base manual.
Use the Analyze pull down menu from the toolbar and select Descriptive Statistics
and then Explore. The Explore dialog box will appear.
(To open this box, you need to have some data on your data editor of SPSS. This is
just an example file).
You can then select the variables of interest (one or more “dependent” variables)
and choose one or more grouping variables (factors). By default, you will get box plots,
stem-and-leaf plots and basic descriptive statistics for each dependent variable (either
for the whole group or separated by a grouping variable). You can suppress the display of
plots or descriptive statistics. You can choose additional statistics and plots as described
below.
In the Explore dialog box, you can click on the Statistics button and choose
one or more of the following to be displayed
Descriptives
This is the default SPSS uses. It includes the mean and its confidence intervals,
median, 5 % trimmed mean, standard error, variance, standard deviation, minimum,
maximum, range, interquartile range (IQR), skewedness and its standard error, kurtosis
and its standard error. IQRs are computed by the H AVERAGE method. This is a weighted
average method and is described in detail in the base manual.
By default, 95 % confidence interval is displayed. The dialog box offers the choice
to set this to any value between 1 % and 99.99 %.
M-estimators
This produces M-estimators that are robust maximum-likelihood estimators of
location. This kind of statistical analysis is not used in Biological research. Do refer to
the manual for more information.
n HUBER(c) produces Huber’s M-estimator with a default of c=1.339.
n ANDREW(c) produces Andrew’s wave estimator with a default of c=1.34π.
n TUKEY(c) produces Tukey’s biweight estimator with a default of c+4.685
Outliers
This displays the cases with the five highest and five lowest values for each variable.
It is labeled “Extreme values” on the output sheet.
Percentiles
This command displays the 5th, 10th, 25th, 50th, 75th, 90th and 95th percentiles using
the H AVERAGE or weighted average at X(W+1)p method to calculate the percentiles. It
also displays Tukey’s hinges (25th, 50th and 75th percentiles). Refer to the manual for
more details.
Grouped Frequency tables
This displays tables for the total samples and broken down by any factor variables.
In the Explore dialog box, you can click on the Plots button and choose
one or more of the following to be displayed.
Box plots You can choose one of the following alternatives.
Factor levels together This is the default. It displays side by side box plots for a given
dependent variable for each group defined as a factor variable. If no factors have been
defined, a box plot for the total sample is displayed.
Dependents together This displays side by side box plots for a given group for each
dependent variable.
None This suppresses the display of box plots.
Descriptive You can choose one or both of the following alternatives.
Stem-and-leaf This is the default. A stem-and-leaf plot is produced in which each
observed value is divided into two components-leading digits (stem) and trailing digits
(leaf). See the manual for more details.
Histogram A histogram is printed. The range of observed values for the variable is
45
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
divided into intervals and the number of cases in each interval is displayed.
Spread vs. level with Levene’s Test A spread-versus-level plot is produced with
the slope of the regression line and Levene’s test for homogeneity of variances. If no
factor variable has been defined, this plot is not produced. You can choose one of the
following.
None : No plots or tests are produced
Power estimation : For each group, the natural log of the median is plotted against
the log of the interquartile range. Estimated power is also displayed. Use this
to determine an appropriate transformation of your data.
1/square root: The reciprocal of the square root is calculated for each data
value.
Normality plots with tests : Normal probability and dendrended probability plots
are produced with a number of test statistics.
In the Explore dialog box, you can click on the Options button and choose
one of the following as a method to handle missing values
Exclude cases listwise This is the default. Cases with missing data for any dependent
or factor variable are excluded from all analyses.
Exclude cases pairwise Only cases with no missing values for variables in a cell
are included in the analysis of that cell. A case may have missing data for
variables not used in that cell.
Report values Missing values for factor variables are treated as an additional
category and reported as such in all output.
The EXPLORE command is a very useful and powerful tool for understanding any
data generated by our research. It needs to be explored in much more detail for those
of you who wish to use it more (For the rest of you, on with the tutorial). Do use the
Base manual for this.
This command produces tables of frequency counts and percentages for the values
of individual variables. By default, a table is created that displays counts for each value
of a variable, the counts percentaged over all cases and over all cases with nonmissing
values and the cumulative percentage over all cases with nonmissing values. The values
are ordered from lowest to highest. All variable labels and value labels are printed if
they have been defined. These defaults can be altered with a number of subcommands.
Also, bar charts, histograms and statistics can be chosen.
Select the FREQUENCIES command by clicking on the Analyze pull down menu
on the toolbar and then select Descriptive Statistics and then Frequencies. The
Frequencies dialog box will open and allow you to select variables for generating
output. If all you want is the default, just click the OK button. You can also select optional
output from the dialog box.
Display frequency tables This is the default. To suppress frequency tables, click
on the little box to remove the check mark.
Statistics
This command controls the display of statistics. By default, no statistics are displayed.
One or more of the following choices may be used.
Under the Percentiles Values box, you can select one or more of the following:
n Quartiles: Displays the 25th, 50th and 75th percentiles.
n Cut points for n equal groups: Displays percentile values that divide the
sample into equal-sized groups. 10 is the default. You can enter any positive integer
between 2 and 100. The number of percentiles displayed is one fewer than the number
of groups specified.
n Percentile(s): Displays user-specified percentiles. You can enter any percentile
value between 0 and 100, and then click on Add. You can continue to add additional
percentile values to build a list which will be displayed. You can remove or change your
entered percentiles before execution of the command by highlighting them and clicking
the appropriate button
Under the Dispersion box, you can select one or more of the following:
n Standard deviation
n Variance
n Range
n Minimum
47
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
n Maximum
n S.E mean (Standard error of the mean)
Under the Central Tendency box you can select one or more of the following:
n Mean
n Median
Under the Distribution box, you can select one or more of the following:
n Skewness: This is a measure of how much a distribution is shifted (right
or left) from a normal distribution. Positive values indicate a right shift and
negative values, a left shift.
Charts
This allows selection of bar charts and histograms and some control over how bar
charts are labeled. You can choose only one of the following:
n None: This is the default. No charts are displayed.
n Mode
n Sum
You can also control the printing of large tables and the printing of multiple
variables.
This command generates a listing containing the variable name, variable label,
49
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
mean, standard deviation, minimum and the maximum. Additionally, the standard error
of the mean, variance, kurtosis, skewness, range and sum may be requested under the
Options subcommand. To use the DESCRIPTIVES command, select Analyze from the
toolbar and then Descriptive Statistics and then Descriptives. A dialog box will appear
which will allow you to select variables, select additional descriptive statistics and set the
order that the variables are displayed in. This is a very useful tool for a quick summary
of your data.
Exercise
Using our data file diet.sav and the commands Frequencies and Descriptives, answer
the following:
How many and what percent of individuals fall into the following categories?
# %
Males ___________ __________
Females ___________ __________
Asians ___________ __________
Orientals ___________ __________
For each of the following, give the mean, standard deviation, minimum and maximum
values without using the Frequencies command:
Mean SD Min-Max
Age ________ _______ _______
Kilocalories ________ _______ _______
Fat ________ _______ _______
Protein ________ _______ _______
Carbohydrate ________ _______ _______
Total cholesterol ________ _______ _______
Polyunsaturated fatty acids ________ _______ _______
Saturated fatty acids ________ _______ _______
Calcium ________ _______ _______
These commands are extremely useful when preparing data and creating new
variables from the raw data file.
The COMPUTE command allows us to create a new variable or modify an existing
variable. Choose the command from the toolbar using the Transform and Compute pull
down menus. The Compute Variable dialog box will appear. You will be able to modify
an existing variable or create a new one. Type in the name of the new variable (or an
existing one) in the Target Variable box. Click on the Numeric Expression box and select
variables and operators from the calculator pad or type them in from the keyboard.
51
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
performed first, exponentiation next, then multiplication and division and finally, addition
and subtraction. Expecting this hierarchy, expressions are evaluated left-to-right. The
order of operations can be controlled by using parentheses.
Examples:
X = A + B * 2
X = (A + B) * 2
If A = 4 and B = 5, then the first expression would equal 14 while the second would
equal 18.
Examples:
Example:
IF (x < 12) COMPUTE A = B + 2
IF (SEX = ‘F’) COMPUTE IRONRDA = 18 + Y
IF (AGE < 22) COMPUTE AGEGROUP = 1
This command produces tables of means, standard deviations and group counts for a
dependent variable within groups defined by one or more independent variables. Several
other SPSS procedures are capable of displaying similar output. Use the Analyze pull
down menu and choose Compare Means and then select the Means command.
The Means dialog box will allow you to select those dependent variables for which
you want means calculated and allow you the option of selecting grouping (independent)
variables. You can also “layer” your independent variables to further subdivide your
sample. By default you will get the mean, standard deviation and count.
53
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
You can choose the Options dialog box to alter this list or to add a number of other
descriptive statistics. You can also control the use of variable and value labels and
choose an analysis of variance or/and a test for linearity.
This command is for performing t-tests. To use this command, select the Analyze
pull down menu and choose Compare Means followed by selection of the appropriate
t-test i.e. independent or paired depending on your data.
For non-paired data, select Independent-Samples T test and the Independent
Samples t-test dialog box will be opened. Select the variable(s) for which you want a
t-test performed and identify the grouping variable. The grouping variable must include
a definition of the group codes within the grouping variable. Use the Define Groups
dialog box to do this.
Example:
To conduct a t-test on the variable, KCAL, between two groups coded as 1 and 2 in
a variable called SEX you would select KCAL as a test variable, SEX as the grouping
variable and then define group 1 as 1 and group 2 as 2 in the dialog boxes (meaning
Group Statistics
Std. Error
CHOL SEX
1 N 16 Mean
350.00 Std. Deviation
29.781 Mean
7.445
2 16 225.00 67.382 16.845
Levene’s test is performed to find if we should use unequal variances t value or equal
variances t value. If p> 0.05 we use equal variance t value. Here p for Levene’s test is
0.011, which means we must use the unequal variance t test p value that is 0.000 (<
0.05) which means that our test is significant. There is a significant difference in the
55
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Exercise
A few problems to test your t-test quotient
I) The data below were collected during an animal feeding experiment. One group of
rats was provided a complete diet (controls) and the other group was fed a diet low in
protein (deficient diet). Determine if the deficient diet produced a different weight gain
(in gms) as compared to the control diet.
II) An experiment was conducted to determine the effect of a high salt mean on
the systolic blood pressure of subjects. Blood pressure was determined in 12 subjects
before and after ingestion of a test meal containing 10.0 gms of salt. The data obtained
were:
III) Compare mean hematocrit levels (%) from the two groups below:
Note: hematocrit means % Red blood cells in peripheral blood. Each data point
above represents the arithmetic mean of 3+ determinations. (Hint: Do you know the
normal mouse hematocrit? It is about 39-49 %)
Mean hematocrit for group X mice ____________
Standard deviation ____________
Mean hematocrit for group Y mice ____________
57
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
IV) Compare means for Coenzyme Q levels in whole blood from cardiomyopathy
patients. Group 1 is placebo treated and Group 2 received 100 mg/day of CoQ. The data
are listed below. (A clinical improvement is seen in patients with CoQ concentrations
at or above 2.5 microg/ml)
V) The data below are from a six week animal study in which rats in the experimental
group received 35 % of their energy as ethanol. Control rats received the same diet with
dextrin substituted for the ethanol calories. All animals were fed ad libitum and both
diets were nutritionally complete.
Experimental Control
Initial wt. Final wt. Initial wt. Final wt.
89 283 89 335
93 287 87 342
87 292 87 344
90 285 90 336
91 267 91 321
88 295 88 348
86 280 86 332
95 282 95 331
87 284 93 336
89 296 89 349
Experimental Control
Mean initial weight ___________ __________
Standard Deviation ___________ __________
Statistical test used was? ___________ __________
59
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
ONEWAY
KCAL PRO VITA FE BY RACE
/STATISTICS DESCRIPTIVES
/MISSING ANALYSIS
/POSTHOC = SCHEFFE ALPHA(.05).
Oneway
Descriptives
ANOVA
Sum of
KCAL Between Groups Squares
282491.8 df 2 Mean Square
141245.894 F.941 Sig.
.402
Within Groups 4350866 29 150029.869
Total 4633358 31
PRO Between Groups 83.788 2 41.894 .271 .764
Within Groups 4482.212 29 154.559
Total 4566.000 31
VITA Between Groups 4614641 2 2307320.525 1.128 .338
Within Groups 59337495 29 2046120.515
Total 63952136 31
FE Between Groups 10.838 2 5.419 .320 .729
Within Groups 491.142 29 16.936
Total 501.980 31
Since the p values are not significant, Scheffe’s test has no meaning in this case.
61
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Scheffe
Mean
Difference 95% Confidence Interval
Dependent
KCAL Variable (I) RACE
Asian (J) RACE
African American (I-J)
-153.803 Std. Error
161.684 Sig.
.640 Lower-570.91
Bound Upper 263.31
Bound
Oriental 70.364 174.095 .922 -378.76 519.49
African American Asian 153.803 161.684 .640 -263.31 570.91
Oriental 224.167 170.800 .433 -216.46 664.79
Oriental Asian -70.364 174.095 .922 -519.49 378.76
African American -224.167 170.800 .433 -664.79 216.46
PRO Asian African American -3.197 5.189 .828 -16.58 10.19
Oriental .303 5.588 .999 -14.11 14.72
African American Asian 3.197 5.189 .828 -10.19 16.58
Oriental 3.500 5.482 .817 -10.64 17.64
Oriental Asian -.303 5.588 .999 -14.72 14.11
African American -3.500 5.482 .817 -17.64 10.64
VITA Asian African American -244.545 597.094 .920 -1784.92 1295.83
Oriental 685.010 642.929 .573 -973.61 2343.63
African American Asian 244.545 597.094 .920 -1295.83 1784.92
Oriental 929.556 630.759 .351 -697.67 2556.78
Oriental Asian -685.010 642.929 .573 -2343.63 973.61
African American -929.556 630.759 .351 -2556.78 697.67
FE Asian African American -.6803 1.7178 .925 -5.112 3.751
Oriental .7697 1.8497 .917 -4.002 5.542
African American Asian .6803 1.7178 .925 -3.751 5.112
Oriental 1.4500 1.8147 .729 -3.232 6.132
Oriental Asian -.7697 1.8497 .917 -5.542 4.002
African American -1.4500 1.8147 .729 -6.132 3.232
Homogeneous Subsets
KCAL
a,b
Scheffe
Subset
for alpha
= .05
RACE
Oriental N 9 1
2641.00
Asian 11 2711.36
African American 12 2865.17
Sig. .425
Means
a. for groups in homogeneous subsets are displayed.
b. Uses Harmonic Mean Sample Size = 10.513.
The group sizes are unequal. The harmonic mean
of the group sizes is used. Type I error levels are
not guaranteed.
PRO
a,b
Scheffe
Subset
for alpha
= .05
RACE
Oriental N 9 1
96.33
Asian 11 96.64
African American 12 99.83
Sig. .813
Means
a. for groups in homogeneous subsets are displayed.
b. Uses Harmonic Mean Sample Size = 10.513.
The group sizes are unequal. The harmonic mean
of the group sizes is used. Type I error levels are
not guaranteed.
VITA
a,b
Scheffe
Subset
for alpha
= .05
RACE
Oriental N 9 1
4298.44
Asian 11 4983.45
African American 12 5228.00
Sig. .343
Means
a. for groups in homogeneous subsets are displayed.
b. Uses Harmonic Mean Sample Size = 10.513.
The group sizes are unequal. The harmonic mean
of the group sizes is used. Type I error levels are
not guaranteed.
FE
a,b
Scheffe
Subset
for alpha
= .05
RACE
Oriental N 9 1
9.567
Asian 11 10.336
African American 12 11.017
Sig. .724
Means
a. for groups in homogeneous subsets are displayed.
b. Uses Harmonic Mean Sample Size = 10.513.
The group sizes are unequal. The harmonic mean
of the group sizes is used. Type I error levels are
not guaranteed.
63
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
The subset for alpha = 0.05 box is not divided for any variable analyzed. If the
variables had been different, this box would have been divided into 1, 2 and so on. The
groups that are in separate boxes are different from each other.
Exercise
I) The data below were collected from an animal feeding experiment. Analyze the
data using SPSS and answer our questions.
Group Rat number Initial wt. Final wt. Brain wt.
A 1 80 335 6.7
A 2 79 342 6.6
A 3 89 353 7.1
A 4 85 337 6.5
A 5 83 334 6.8
B 1 82 335 4.3
B 2 85 345 4.7
B 3 87 357 4.3
B 4 82 335 4.5
B 5 83 343 4.6
C 1 80 398 8.1
C 2 86 405 8.2
C 3 87 398 7.3
C 4 84 398 7.6
C 5 86 395 8.2
II) An experiment was conducted to determine the effect of various diets containing
different levels of protein on weight gain in rats. The data are presented below:
III) Use SPSS to test for polynomial trends in the following data:
65
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
curve for lab assays. This is actually a number of different but related procedures that
can be found under the Analyze pull down menu with the selection of Regression
followed by the selection of the desired procedure. We will only try a few of them.
A scattergram can be a simple way to view your data. It is an excellent way to detect
outliers (that even may be errors). To get a quick scattergram, select the Graphs pull
down menu and choose Scatter. The Scattergram dialog box will appear. You would
normally choose Simple Scattergram and click the Define button to choose the
variables to be used in your graph.
You can then identify the Y-axis variable and the X-axis variable and control labeling
of the graph.
This is an example of a simple scatterplot generated with SPSS.
3250
3000
2750
KCAL
2500
2250
2000
You can also use SPSS to generate the information needed to define a standard curve
and calculate unknowns from laboratory work. Open the absorbance.sav data file. Use
the Analyze pull down menu, select Regression and then Curve Estimation. The
following dialog box will open:
Select the dependent (Y-axis) variable and the independent (X-axis) variable. You will
use the default (linear) model. You can also control labeling. SPSS will display a plot of
the data. This is not the important output. Close the Chart Carousel window and look
at the results in the output window.
EXAMPLE:
Suppose a set of standards were measured spectroscopically to determine the
absorbances associated with the concentration of Vitamin X listed below.
Vitamin X Absorbance
10.6 0.110
15.4 0.165
20.2 0.220
25.5 0.271
30.2 0.318
35.8 0.370
The Output window has a chart and the data we need to plot a straight line.
Y = intercept + slope * (X)
Or
Y = B0 + B1 * (X)
Curve Fit
MODEL: MOD _ 1.
_
67
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Independent: Absorbance
VitaminX
40.00 Observed
Linear
35.00
30.00
25.00
20.00
15.00
10.00
We could now use this information to create a Compute command to convert a set of
absorbances into concentrations of Vitamin X and use List Cases to print them out.
Exercise
I) Use SPSS to create a scatterplot of Kcal and Total cholesterol from the diet.
sav data file. Is there any pattern or is it just random?
II) Use SPSS to determine a standard curve for an assay called Bradford assay to
measure protein concentrations. In this, we first determine the absorbances of some
known concentration protein samples, that we call standards. Then we plot a curve and
determine our correlation coefficient, Y intercept and slope. With that information we
can calculate protein concentrations of unknown samples if we get their absorbance
values. Draw the curve on a sheet of graph paper and compare it to the curve drawn by
the computer. Use SPSS’ formula function for a straight line (Y = A + BX) to determine
protein concentrations in the unknowns (Note: Let X = absorbance and Y = protein
concentration). Plot absorbance on the X axis and protein concentrations on the Y
axis.
50 0.296
60 0.352
70 0.357
80 0.390
90 0.451
100 0.500
s) Multiple Regression
69
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Select your variable of interest and place it in the dependent variable box. Then
select each of the predictors that you want used in your equation and place them in the
independent(s) box. Select the appropriate method. Stepwise is the suggested method.
This will identify the best predictor and generate output, then the best predictor which
goes with the first and so on.
Regression
Descriptive Statistics
KCAL Mean
2749.25 Std. Deviation
386.605 N 32
CHO 334.75 51.285 32
FAT 113.25 23.267 32
PRO 97.75 12.136 32
FIB 11.75 1.951 32
CA 818.50 173.161 32
CHOL 287.50 81.599 32
a
Variables Entered/Removed
Variables Variables
Model
1 Entered Removed Method
Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
CA . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
2 Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
FAT . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
3 Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
CHO . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
4 Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
PRO . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
5 Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
FIB . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
6 Stepwise
(Criteria:
Probabilit
y-of-
F-to-enter
CHOL . <= .050,
Probabilit
y-of-
F-to-remo
ve >= .
100).
a.
Dependent Variable: KCAL
71
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Model Summary
For instance, in the Model Summary table, a value of 0.795 for calcium means that
53 percent of change in Kcal can be predicted if we have the Calcium intake. Then
a value of 0.964 below that means that if we have both Calcium and Fat intake, we
can predict 96 percent of the change in Kcal and so on.
Coefficientsa
Unstandardized Standardized
Coefficients Coefficients
Model
1 (Constant) B
1113.479 Std. Error
151.926 Beta t
7.329 Sig.
.000
CA 1.998 .182 .895 10.998 .000
2 (Constant) 683.316 73.224 9.332 .000
CA 1.412 .091 .632 15.563 .000
FAT 8.038 .675 .484 11.905 .000
3 (Constant) 218.675 34.632 6.314 .000
CA .334 .068 .150 4.916 .000
FAT 9.189 .212 .553 43.352 .000
CHO 3.634 .210 .482 17.278 .000
4 (Constant) .000 .000 . .
CA .000 .000 .000 . .
FAT 9.000 .000 .542 . .
CHO 4.000 .000 .531 . .
PRO 4.000 .000 .126 . .
5 (Constant) .000 .000 . .
CA .000 .000 .000 . .
FAT 9.000 .000 .542 . .
CHO 4.000 .000 .531 . .
PRO 4.000 .000 .126 . .
FIB .000 .000 .000 . .
6 (Constant) .000 .000 . .
CA .000 .000 .000 . .
FAT 9.000 .000 .542 . .
CHO 4.000 .000 .531 . .
PRO 4.000 .000 .126 . .
FIB .000 .000 .000 . .
CHOL .000 .000 .000 . .
a.
Dependent Variable: KCAL
73
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Excluded Variablesf
Collinearity
Partial Statistics
Model
1 CHO Beta.102
In a t .474 Sig.
.639 Correlation
.088 Tolerance.147
FAT .484a 11.905 .000 .911 .705
PRO .220a 1.280 .211 .231 .219
FIB -.146a -1.214 .235 -.220 .450
CHOL .013a .104 .918 .019 .423
2 CHO .482b 17.278 .000 .956 .133
PRO -.009b -.111 .913 -.021 .204
FIB -.124b -2.697 .012 -.454 .450
CHOL .143b 3.028 .005 .497 .406
3 PRO .126c . . 1.000 .184
FIB -.063c -5.991 .000 -.755 .422
CHOL .021c 1.205 .239 .226 .321
4 FIB .000d . . . .181
CHOL .000d . . . .305
5 CHOL .000e . . . .223
a.
b. Predictors in the Model: (Constant), CA
c. Predictors in the Model: (Constant), CA, FAT
d. Predictors in the Model: (Constant), CA, FAT, CHO
e. Predictors in the Model: (Constant), CA, FAT, CHO, PRO
f. Predictors in the Model: (Constant), CA, FAT, CHO, PRO, FIB
Dependent Variable: KCAL
Additional subcommands exist if the input is a matrix or if the user wishes to write
the matrix to an external file; if the user wishes to examine residuals; or if plots of
various types are desired. These can be used under the “syntax window system” of
creating commands. The Regression procedure can be very complex. The order of
subcommands is very important in determining the output. It is therefore imperative
that the manual be studied carefully when using this procedure.
When discrete data have been collected, it is often desirable to use the Chi-square
test. One way to have SPSS calculate the Chi-square for us is the use the Crosstabs
procedure. The Crosstabs command has a variety of parts, many of which are optional.
The discussion below is intended to clarify some of the information provided in the
manual.
Use the Analyze pull down menu and select Descriptive Statistics and then
Crosstabs. The following dialog box will appear:
Select your row and column variables. Select the Statistics button and choose
Chi-square.
You can also control what is printed into the cells of the table by selecting the Cells
option.
Crosstabs
Cases
Valid Missing Total
RACE * SEX N 32 Percent
100.0% N 0 Percent
.0% N 32 Percent
100.0%
75
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Count
SEX
RACE 1 1 5 2 6 Total11
2 7 5 12
3 4 5 9
Total 16 16 32
Chi-Square Tests
Asymp. Sig.
Pearson Chi-Square Value
.535a df 2 (2-sided)
.765
Likelihood Ratio .537 2 .764
Linear-by-Linear
.000 1 1.000
Association
N of Valid Cases 32
a.
2 cells (33.3%) have expected count less than 5. The
minimum expected count is 4.50.
Looking at the p values, we can infer that there is no significant difference in the
distribution.
Exercise
I) The following data were collected from an experiment to determine the outcome of
a zinc supplement program on the performance of children on a standardized intelligent
test. Determine statistical significance by Chi-square.
II) The following data were collected from an experiment on the effects of a daily 30
minute jogging schedule on weight loss. The control group spent 30 minutes watching
a TV commercial of a tooth whitening product.
Group Initial wt. Final wt. Group Initial wt. Final wt.
251 252 244 236
229 226 231 208
240 241 241 241
229 225 257 258
243 245 253 234
308 309 299 302
196 202 196 184
222 221 232 225
207 200 243 196
274 268 264 268
Control 239 220 Experimental 220 225
251 251 221 211
209 196 209 197
220 217 229 216
294 300 298 285
A successful weight loss is defined by the experimenters as being at least five pounds.
Determine if the percentages of successful weight loss were different in the two groups.
(Hint: In your calculations, divide the groups into successful weight loss and no successful
weight loss, controls and experimentals)
Controls Experimentals
Percentage of successful wt.loss _______ _______
Chi-square value _______
p < _______
III) We wish to evaluate the presence of breast cancer as a risk factor for subsequent
cancer in the other breast. From a group of 55-65 yr old women, you select a group of
breast cancer cases and a group of controls (not currently suffering from breast cancer).
You use a questionnaire and a thorough search of cancer registry records to determine
past histories of breast cancer. Your data are presented below.
Cancer No Cancer
Total
(cases) (controls)
Previous cancer 12 6 18
No previous cancer 38 44 82
Total 50 50 100
As you can see, this is a retrospective study, which means you can calculate relative
risk.
Relative risk (cross product ratio) = ______________
That means that a person with cancer in one breast is _________ times more likely
to have breast cancer in the other breast than a person who does not suffer from breast
77
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
cancer at all.
Do you think this value is significant biologically?
Many a time, you might like to run a statistical test on selected subsets of your data.
For example you may have a huge data file and decide that you want to look only at
the males in your data. SPSS allows you to create a permanent data file to analyze only
males or do so temporarily. Use the Data pull down menu and select Select cases.
The following dialog box will appear.
Click the If condition is satisfied button and click on If. The following box will
then appear:
Set your conditions for case selection and your data file will now look like this:
You can now choose whatever statistical procedure(s) you want to perform on this
subset of cases.
NOTE: The Filtered button (the default) allows you to use Select cases again
to undo or alter your selection. The Deleted button makes this a permanent case
selection. You can then save the new data as another file and work on it.
SPSS allows the user to perform a number of nonparametric statistical tests. The
tests available can be grouped into broad categories depending on the type of the
experimental data you have e.g. one-sample tests, related-sample tests and independent-
samples tests. These tests are found in the Analyze pull down menu on selecting
Nonparametric Tests and then choosing the appropriate category. You may make
one of the following choices:
79
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Wald-Wolfowitz runs.
For each of these, you have choices as to which statistics are displayed an how labels
and missing data are handled. We will examine two of these as examples.
w) Mann-Whitney U test
Since Mann-Whitney U test is the default, we will select our variables to test and our
grouping variable. We must of course define our groups similar to previous tests. The
output looks similar to the following:
NPar Tests
Mann-Whitney Test
Ranks
AGE SEX
1 N 16 Mean 17.34
Rank Sum of 277.50
Ranks
2 16 15.66 250.50
Total 32
Test Statisticsb
Mann-Whitney U AGE
114.500
Wilcoxon W 250.500
Z -.510
Asymp. Sig. (2-tailed) .610
Exact Sig. [2*(1-tailed a
.616
Sig.)]
a.
b. Not corrected for ties.
Grouping Variable: SEX
Here a 0.616 significance means there is no significant difference between ages of
males and females in the data. (Since we do not have ranking data here, we used ages.
But ideally this test would be used to compare ranks).
Median test
A Median test can be obtained by selecting K Independent Samples under the
Nonparametric Tests menu. The following dialog box will appear:
NPar Tests
Median Test
Frequencies
SEX
AGE > Median 1 8 2 8
<= Median 8 8
81
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
In this data, we have equal distribution; therefore our significance level is 1.0 which
means that there is no significant difference in the medians of ages in males and
females.
x) Bivariate Correlations
There are multiple ways to use SPSS to get correlation coefficients. W can select
Correlate from the Analyze pull down menu and then select Bivariate. The following
dialog box will appear.
Correlations
We do not get r2 by using this procedure. If we want the r2 value, we can calculate it
with a calculator or choose Regression and then Linear under the Analyze pull down
menu. Here we would choose Enter under the Method box. This would give us the r
and r2.
Model Summary
The r2 value means that 34 percent of the fat intake can be predicted by
protein intake. (Since this is not the kind of data you would use for regression
analysis, do not try to make sense out of this statement.)
y) Survival
The SURVIVAL command produces life tables, plots and related statistics for
examining the length of time between two events (let’s say exposure and development
of disease). Cases can be classified into groups, and separate analyses and comparisons
obtained for the groups. The time interval between two dates can be calculated with the
SPSS date and time conversion functions (e.g. YRMODA).
Example:
If the data file contains dates of important events such as diagnosis or outcome, you
can use the Compute command and the YRMODA function to calculate elapsed time.
83
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
Use the survival.sav data file provided to you to work on this function. The outcomes
are either 1 (died) or 2 (survived). The treatments are either 1 (Vitamin A), 2 (Beta
Blocker), 3 (ACE inhibitor) or 4 (Aspirin).
Use the Compute command to calculate a variable xyz (time elapsed between
exposure and the event i.e. death)
xyz will now be created as a new variable on your data file and will provide you
the number of years elapsed between the two dates. You can then use the survival
analysis command to compute median “survival time” for various groups within your
experiment.
The Survival command can be found under the Analyze pull down menu. Then
select Life Tables. The following dialog box will appear:
Place your variable defining the time elapsed in the Time box. The Display Time
Intervals boxes are for defining the number of time units that will be displayed on your
output. The Status box is for defining your outcome and the Factor box is for defining
your grouping variable. Look at the examples below.
You can also select the Options button to generate statistical testing your groups
and to control the Output.
Life Table
Survival Variable xyz survival
for treatmen
= 1 Vitamin A
85
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
SE of SE of
Intrvl Cumul Proba- SE of
Start Sur- bility Hazard
Time viving Densty Rate
------- ------ ------ ------
.0 .0000 .0000 .0000
1.0 .0000 .0000 .0000
2.0 .0000 .0000 .0000
3.0 .0000 .0000 .0000
4.0 .0000 .0000 .0000
5.0 .0000 .0000 .0000
6.0 .0000 .0000 .0000
7.0 .0000 .0000 .0000
8.0 .0000 .0000 .0000
9.0 .0000 .0000 .0000
10.0+ .0781 ** **
Life Table
Survival Variable xyz survival
for treatmen
= 2 Beta Blocker
SE of SE of
Intrvl Cumul Proba- SE of
Start Sur- bility Hazard
Time viving Densty Rate
------- ------ ------ ------
.0 .0000 .0000 .0000
1.0 .0000 .0000 .0000
2.0 .0000 .0000 .0000
3.0 .0000 .0000 .0000
4.0 .0000 .0000 .0000
5.0 .0000 .0000 .0000
6.0 .0000 .0000 .0000
7.0 .0000 .0000 .0000
8.0 .0000 .0000 .0000
9.0 .0000 .0000 .0000
10.0+ .0000 ** **
Life Table
Survival Variable xyz survival
for treatmen
= 3 ACE inhibitor
SE of SE of
Intrvl Cumul Proba- SE of
Start Sur- bility Hazard
Time viving Densty Rate
------- ------ ------ ------
.0 .0000 .0000 .0000
1.0 .0000 .0000 .0000
2.0 .0000 .0000 .0000
3.0 .0000 .0000 .0000
4.0 .0000 .0000 .0000
5.0 .0000 .0000 .0000
6.0 .0000 .0000 .0000
7.0 .0000 .0000 .0000
8.0 .0000 .0000 .0000
9.0 .0000 .0000 .0000
10.0+ .1899 ** **
Life Table
Survival Variable xyz survival
for treatmen
= 4 Aspirin
87
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
Creating and Executing SPSS Commands
SE of SE of
Intrvl Cumul Proba- SE of
Start Sur- bility Hazard
Time viving Densty Rate
------- ------ ------ ------
.0 .0000 .0000 .0000
1.0 .0000 .0000 .0000
2.0 .0000 .0000 .0000
3.0 .0000 .0000 .0000
4.0 .0000 .0000 .0000
5.0 .0000 .0000 .0000
6.0 .0000 .0000 .0000
7.0 .0000 .0000 .0000
8.0 .0000 .0000 .0000
9.0 .0000 .0000 .0000
10.0+ .1870 ** **
Abbreviated Extended
Name Name
treatment treatment
The main values to look for are the median survival times and finally the overall
comparison table for the probability value. Here the probability value is 0.01 which
means that there is no significant difference in the survival of the differently treated
groups.
89
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
SPSS syntax windows
Example:
Suppose we had a large data file named EXPERIMENT.DAT and wished to construct
a new data file named FEEDING.DAT containing mean Kilocalorie consumption for each
day rather than individual data for each mouse. We can use Aggregate to do this.
Our command might look something like this:
AGGREGATE OUTFILE = ‘FEEDING.DAT’
/BREAK = FEEDING
/AVGKCAL = MEAN (KCAL).
Example:
COUNT X = Y,Z,W (2)
A new variable X is created for each case. It will contain a count of the number of
times a value of 2 was found across the variables Y, Z and W. Therefore the value of X
will be 0, 1, 2 or 3.
91
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
SPSS syntax windows
Example:
Missing Value list of variables (n).
Where “n” is the value to be used to identify missing data.
Example:
N of Cases n.
Example:
RECODE INCOME (LO THRU 500 = 1) (501 THRU 1000 = 2) (1001 THRU HI =
3)/RACE (2 THRU HI = 2).
Examples:
Sample .25.
This would build a random sample of approximately 25 % of cases from the active
file.
Sample 50 From 2600
This would build a random sample of 50 cases from the first 2600 cases in the active
file. If there are fewer than 2600 cases in the active file, a sample of 50/2600 % will be
built.
The cases are sorted for each variable listed. The default is ascending order (A). To
sort in descending order specify (D). After the initial sort with the first variable, additional
variables cause successive sorts to be performed within categories as determined by the
preceding sort(s). Up to 10 variables may be used as sort keys. This command uses a
large amount of disk space for scratch files.
These commands are used when we do not wish to use a separate data file. Normally
this is used only when we have a small amount of data. This allows us to include our
data in our command file. This used to be useful when punch cards were used to feed
commands.
Example:
BEGIN DATA.
1 3.4 158
2 2.9 166
3 3.0 178
END DATA
93
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com
SPSS Tutorial for Beginners
SPSS syntax windows
been provided for each case. This is usually used in research designs having complex
sampling plans or in situations when one or more groups have been over- or under-
sampled.
95
CHILLIBREEZE PUBLICATIONS | http://www.chillibreeze.com