1 @alias prompt = sansserif
8 @pspp{} is a tool for the statistical analysis of sampled data.
9 You can use it to discover patterns in the data,
10 to explain differences in one subset of data in terms of another subset
12 whether certain beliefs about the data are justified.
13 This chapter does not attempt to introduce the theory behind the
15 but it shows how such analysis can be performed using @pspp{}.
17 For the purposes of this tutorial, it is assumed that you are using @pspp{} in its
18 interactive mode from the command line.
19 However, the example commands can also be typed into a file and executed in
20 a post-hoc mode by typing @samp{pspp @var{filename}} at a shell prompt,
21 where @var{filename} is the name of the file containing the commands.
22 Alternatively, from the graphical interface, you can select
23 @clicksequence{File @click{} New @click{} Syntax} to open a new syntax window
24 and use the @clicksequence{Run} menu when a syntax fragment is ready to be
26 Whichever method you choose, the syntax is identical.
28 When using the interactive method, @pspp{} tells you that it's waiting for your
29 data with a string like @prompt{PSPP>} or @prompt{data>}.
30 In the examples of this chapter, whenever you see text like this, it
31 indicates the prompt displayed by @pspp{}, @emph{not} something that you
34 Throughout this chapter reference is made to a number of sample data files.
35 So that you can try the examples for yourself,
36 you should have received these files along with your copy of @pspp{}.@c
37 @footnote{These files contain purely fictitious data. They should not be used
38 for research purposes.}
39 @note{Normally these files are installed in the directory
40 @file{@value{example-dir}}.
41 If however your system administrator or operating system vendor has
42 chosen to install them in a different location, you will have to adjust
43 the examples accordingly.}
47 * Preparation of Data Files::
48 * Data Screening and Transformation::
49 * Hypothesis Testing::
52 @node Preparation of Data Files
53 @section Preparation of Data Files
56 Before analysis can commence, the data must be loaded into @pspp{} and
57 arranged such that both @pspp{} and humans can understand what
59 There are two aspects of data:
62 @item The variables --- these are the parameters of a quantity
63 which has been measured or estimated in some way.
64 For example height, weight and geographic location are all variables.
65 @item The observations (also called `cases') of the variables ---
66 each observation represents an instance when the variables were measured
71 For example, a data set which has the variables @var{height}, @var{weight}, and
72 @var{name}, might have the observations:
79 The following sections explain how to define a dataset.
82 * Defining Variables::
84 * Reading data from a text file::
85 * Reading data from a pre-prepared PSPP file::
86 * Saving data to a PSPP file.::
87 * Reading data from other sources::
91 @node Defining Variables
92 @subsection Defining Variables
95 Variables come in two basic types, @i{viz}: @dfn{numeric} and @dfn{string}.
96 Variables such as age, height and satisfaction are numeric,
97 whereas name is a string variable.
98 String variables are best reserved for commentary data to assist the
100 However they can also be used for nominal or categorical data.
103 @ref{data-list} defines two variables @var{forename} and @var{height},
104 and reads data into them by manual input.
106 @float Example, data-list
109 @prompt{PSPP>} data list list /forename (A12) height.
110 @prompt{PSPP>} begin data.
111 @prompt{data>} Ahmed 188
112 @prompt{data>} Bertram 167
113 @prompt{data>} Catherine 134.231
114 @prompt{data>} David 109.1
115 @prompt{data>} end data
119 @caption{Manual entry of data using the @cmd{DATA LIST} command.
121 @var{forename} and @var{height} are defined and subsequently filled
122 with manually entered data.}
125 There are several things to note about this example.
129 The words @samp{data list list} are an example of the @cmd{DATA LIST}
130 command. @xref{DATA LIST}.
131 It tells @pspp{} to prepare for reading data.
132 The word @samp{list} intentionally appears twice.
133 The first occurrence is part of the @cmd{DATA LIST} call,
135 tells @pspp{} that the data is to be read as free format data with
139 The @samp{/} character is important. It marks the start of the list of
140 variables which you wish to define.
143 The text @samp{forename} is the name of the first variable,
144 and @samp{(A12)} says that the variable @var{forename} is a string
145 variable and that its maximum length is 12 bytes.
146 The second variable's name is specified by the text @samp{height}.
147 Since no format is given, this variable has the default format.
148 Normally the default format expects numeric data, which should be
149 entered in the locale of the operating system.
150 Thus, the example is correct for English locales and other
151 locales which use a period (@samp{.}) as the decimal separator.
152 However if you are using a system with a locale which uses the comma (@samp{,})
153 as the decimal separator, then you should in the subsequent lines substitute
154 @samp{.} with @samp{,}.
155 Alternatively, you could explicitly tell @pspp{} that the @var{height}
156 variable is to be read using a period as its decimal separator by appending the
157 text @samp{DOT8.3} after the word @samp{height}.
158 For more information on data formats, @pxref{Input and Output Formats}.
162 Normally, @pspp{} displays the prompt @prompt{PSPP>} whenever it's
164 However, when it's expecting data, the prompt changes to @prompt{data>}
165 so that you know to enter data and not a command.
168 At the end of every command there is a terminating @samp{.} which tells
169 @pspp{} that the end of a command has been encountered.
170 You should not enter @samp{.} when data is expected (@i{ie.} when
171 the @prompt{data>} prompt is current) since it is appropriate only for
172 terminating commands.
175 @node Listing the data
176 @subsection Listing the data
179 Once the data has been entered,
182 @prompt{PSPP>} list /format=numbered.
186 The optional text @samp{/format=numbered} requests the case numbers to be
187 shown along with the data.
188 It should show the following output:
191 Case# forename height
192 ----- ------------ --------
200 Note that the numeric variable @var{height} is displayed to 2 decimal
201 places, because the format for that variable is @samp{F8.2}.
202 For a complete description of the @cmd{LIST} command, @pxref{LIST}.
204 @node Reading data from a text file
205 @subsection Reading data from a text file
208 The previous example showed how to define a set of variables and to
209 manually enter the data for those variables.
210 Manual entering of data is tedious work, and often
211 a file containing the data will be have been previously
213 Let us assume that you have a file called @file{mydata.dat} containing the
226 You can can tell the @cmd{DATA LIST} command to read the data directly from
227 this file instead of by manual entry, with a command like:
229 @prompt{PSPP>} data list file='mydata.dat' list /forename (A12) height.
232 Notice however, that it is still necessary to specify the names of the
233 variables and their formats, since this information is not contained
235 It is also possible to specify the file's character encoding and other
237 For full details refer to @pxref{DATA LIST}.
239 @node Reading data from a pre-prepared PSPP file
240 @subsection Reading data from a pre-prepared @pspp{} file
244 When working with other @pspp{} users, or users of other software which
245 uses the @pspp{} data format, you may be given the data in
246 a pre-prepared @pspp{} file.
247 Such files contain not only the data, but the variable definitions,
248 along with their formats, labels and other meta-data.
249 Conventionally, these files (sometimes called ``system'' files)
250 have the suffix @file{.sav}, but that is
252 The following syntax loads a file called @file{my-file.sav}.
254 @prompt{PSPP>} get file='my-file.sav'.
257 You will encounter several instances of this in future examples.
260 @node Saving data to a PSPP file.
261 @subsection Saving data to a @pspp{} file.
265 If you want to save your data, along with the variable definitions so
266 that you or other @pspp{} users can use it later, you can do this with
267 the @cmd{SAVE} command.
269 The following syntax will save the existing data and variables to a
270 file called @file{my-new-file.sav}.
272 @prompt{PSPP>} save outfile='my-new-file.sav'.
275 If @file{my-new-file.sav} already exists, then it will be overwritten.
276 Otherwise it will be created.
279 @node Reading data from other sources
280 @subsection Reading data from other sources
281 @cindex comma separated values
285 Sometimes it's useful to be able to read data from comma
286 separated text, from spreadsheets, databases or other sources.
287 In these instances you should
288 use the @cmd{GET DATA} command (@pxref{GET DATA}).
291 @subsection Exiting PSPP
293 Use the @cmd{FINISH} command to exit PSPP:
295 @prompt{PSPP>} finish.
298 @node Data Screening and Transformation
299 @section Data Screening and Transformation
302 @cindex transformation
304 Once data has been entered, it is often desirable, or even necessary,
305 to transform it in some way before performing analysis upon it.
306 At the very least, it's good practice to check for errors.
309 * Identifying incorrect data::
310 * Dealing with suspicious data::
311 * Inverting negatively coded variables::
312 * Testing data consistency::
313 * Testing for normality ::
316 @node Identifying incorrect data
317 @subsection Identifying incorrect data
318 @cindex erroneous data
319 @cindex errors, in data
321 Data from real sources is rarely error free.
322 @pspp{} has a number of procedures which can be used to help
323 identify data which might be incorrect.
325 The @cmd{DESCRIPTIVES} command (@pxref{DESCRIPTIVES}) is used to generate
326 simple linear statistics for a dataset. It is also useful for
327 identifying potential problems in the data.
328 The example file @file{physiology.sav} contains a number of physiological
329 measurements of a sample of healthy adults selected at random.
330 However, the data entry clerk made a number of mistakes when entering
332 @ref{descriptives} illustrates the use of @cmd{DESCRIPTIVES} to screen this
333 data and identify the erroneous values.
335 @float Example, descriptives
338 @prompt{PSPP>} get file='@value{example-dir}/physiology.sav'.
339 @prompt{PSPP>} descriptives sex, weight, height.
344 DESCRIPTIVES. Valid cases = 40; cases with missing value(s) = 0.
345 +--------#--+-------+-------+-------+-------+
346 |Variable# N| Mean |Std Dev|Minimum|Maximum|
347 #========#==#=======#=======#=======#=======#
348 |sex #40| .45| .50| .00| 1.00|
349 |height #40|1677.12| 262.87| 179.00|1903.00|
350 |weight #40| 72.12| 26.70| -55.60| 92.07|
351 +--------#--+-------+-------+-------+-------+
354 @caption{Using the @cmd{DESCRIPTIVES} command to display simple
355 summary information about the data.
356 In this case, the results show unexpectedly low values in the Minimum
357 column, suggesting incorrect data entry.}
360 In the output of @ref{descriptives},
361 the most interesting column is the minimum value.
362 The @var{weight} variable has a minimum value of less than zero,
363 which is clearly erroneous.
364 Similarly, the @var{height} variable's minimum value seems to be very low.
365 In fact, it is more than 5 standard deviations from the mean, and is a
366 seemingly bizarre height for an adult person.
367 We can examine the data in more detail with the @cmd{EXAMINE}
368 command (@pxref{EXAMINE}):
370 In @ref{examine} you can see that the lowest value of @var{height} is
371 179 (which we suspect to be erroneous), but the second lowest is 1598
373 we know from the @cmd{DESCRIPTIVES} command
374 is within 1 standard deviation from the mean.
375 Similarly the @var{weight} variable has a lowest value which is
376 negative but a plausible value for the second lowest value.
377 This suggests that the two extreme values are outliers and probably
378 represent data entry errors.
380 @float Example, examine
382 [@dots{} continue from @ref{descriptives}]
384 @prompt{PSPP>} examine height, weight /statistics=extreme(3).
389 #===============================#===========#=======#
390 # #Case Number| Value #
391 #===============================#===========#=======#
392 #Height in millimetres Highest 1# 14|1903.00#
395 # ----------#-----------+-------#
396 # Lowest 1# 30| 179.00#
399 # ----------#-----------+-------#
400 #Weight in kilograms Highest 1# 13| 92.07#
403 # ----------#-----------+-------#
404 # Lowest 1# 38| -55.60#
407 #===============================#===========#=======#
410 @caption{Using the @cmd{EXAMINE} command to see the extremities of the data
411 for different variables. Cases 30 and 38 seem to contain values
412 very much lower than the rest of the data.
413 They are possibly erroneous.}
416 @node Dealing with suspicious data
417 @subsection Dealing with suspicious data
420 @cindex recoding data
421 If possible, suspect data should be checked and re-measured.
422 However, this may not always be feasible, in which case the researcher may
423 decide to disregard these values.
424 @pspp{} has a feature whereby data can assume the special value `SYSMIS', and
425 will be disregarded in future analysis. @xref{Missing Observations}.
426 You can set the two suspect values to the `SYSMIS' value using the @cmd{RECODE}
429 @pspp{}> recode height (179 = SYSMIS).
430 @pspp{}> recode weight (LOWEST THRU 0 = SYSMIS).
433 The first command says that for any observation which has a
434 @var{height} value of 179, that value should be changed to the SYSMIS
436 The second command says that any @var{weight} values of zero or less
437 should be changed to SYSMIS.
438 From now on, they will be ignored in analysis.
439 For detailed information about the @cmd{RECODE} command @pxref{RECODE}.
441 If you now re-run the @cmd{DESCRIPTIVES} or @cmd{EXAMINE} commands in
442 @ref{descriptives} and @ref{examine} you
443 will see a data summary with more plausible parameters.
444 You will also notice that the data summaries indicate the two missing values.
446 @node Inverting negatively coded variables
447 @subsection Inverting negatively coded variables
450 @cindex Inverting data
451 Data entry errors are not the only reason for wanting to recode data.
452 The sample file @file{hotel.sav} comprises data gathered from a
453 customer satisfaction survey of clients at a particular hotel.
454 In @ref{reliability}, this file is loaded for analysis.
455 The line @code{display dictionary.} tells @pspp{} to display the
456 variables and associated data.
457 The output from this command has been omitted from the example for the sake of clarity, but
458 you will notice that each of the variables
459 @var{v1}, @var{v2} @dots{} @var{v5} are measured on a 5 point Likert scale,
460 with 1 meaning ``Strongly disagree'' and 5 meaning ``Strongly agree''.
461 Whilst variables @var{v1}, @var{v2} and @var{v4} record responses
462 to a positively posed question, variables @var{v3} and @var{v5} are
463 responses to negatively worded questions.
464 In order to perform meaningful analysis, we need to recode the variables so
465 that they all measure in the same direction.
466 We could use the @cmd{RECODE} command, with syntax such as:
468 recode v3 (1 = 5) (2 = 4) (4 = 2) (5 = 1).
471 However an easier and more elegant way uses the @cmd{COMPUTE}
472 command (@pxref{COMPUTE}).
473 Since the variables are Likert variables in the range (1 @dots{} 5),
474 subtracting their value from 6 has the effect of inverting them:
476 compute @var{var} = 6 - @var{var}.
479 @ref{reliability} uses this technique to recode the variables
480 @var{v3} and @var{v5}.
481 After applying @cmd{COMPUTE} for both variables,
482 all subsequent commands will use the inverted values.
485 @node Testing data consistency
486 @subsection Testing data consistency
491 A sensible check to perform on survey data is the calculation of
493 This gives the statistician some confidence that the questionnaires have been
494 completed thoughtfully.
495 If you examine the labels of variables @var{v1}, @var{v3} and @var{v4},
496 you will notice that they ask very similar questions.
497 One would therefore expect the values of these variables (after recoding)
498 to closely follow one another, and we can test that with the @cmd{RELIABILITY}
499 command (@pxref{RELIABILITY}).
500 @ref{reliability} shows a @pspp{} session where the user (after recoding
501 negatively scaled variables) requests reliability statistics for
502 @var{v1}, @var{v3} and @var{v4}.
504 @float Example, reliability
507 @prompt{PSPP>} get file='@value{example-dir}/hotel.sav'.
508 @prompt{PSPP>} display dictionary.
509 @prompt{PSPP>} * recode negatively worded questions.
510 @prompt{PSPP>} compute v3 = 6 - v3.
511 @prompt{PSPP>} compute v5 = 6 - v5.
512 @prompt{PSPP>} reliability v1, v3, v4.
515 Output (dictionary information omitted for clarity):
517 1.1 RELIABILITY. Case Processing Summary
518 #==============#==#======#
520 #==============#==#======#
521 #Cases Valid #17|100.00#
524 #==============#==#======#
526 1.2 RELIABILITY. Reliability Statistics
527 #================#==========#
528 #Cronbach's Alpha#N of Items#
529 #================#==========#
531 #================#==========#
534 @caption{Recoding negatively scaled variables, and testing for
535 reliability with the @cmd{RELIABILITY} command. The Cronbach Alpha
536 coefficient suggests a high degree of reliability among variables
537 @var{v1}, @var{v3} and @var{v4}.}
540 As a rule of thumb, many statisticians consider a value of Cronbach's Alpha of
541 0.7 or higher to indicate reliable data.
542 Here, the value is 0.81 so the data and the recoding that we performed
546 @node Testing for normality
547 @subsection Testing for normality
548 @cindex normality, testing
550 Many statistical tests rely upon certain properties of the data.
551 One common property, upon which many linear tests depend, is that of
552 normality --- the data must have been drawn from a normal distribution.
553 It is necessary then to ensure normality before deciding upon the
554 test procedure to use. One way to do this uses the @cmd{EXAMINE} command.
556 In @ref{normality}, a researcher was examining the failure rates
557 of equipment produced by an engineering company.
558 The file @file{repairs.sav} contains the mean time between
559 failures (@var{mtbf}) of some items of equipment subject to the study.
560 Before performing linear analysis on the data,
561 the researcher wanted to ascertain that the data is normally distributed.
563 A normal distribution has a skewness and kurtosis of zero.
564 Looking at the skewness of @var{mtbf} in @ref{normality} it is clear
565 that the mtbf figures have a lot of positive skew and are therefore
566 not drawn from a normally distributed variable.
567 Positive skew can often be compensated for by applying a logarithmic
569 This is done with the @cmd{COMPUTE} command in the line
571 compute mtbf_ln = ln (mtbf).
574 Rather than redefining the existing variable, this use of @cmd{COMPUTE}
575 defines a new variable @var{mtbf_ln} which is
576 the natural logarithm of @var{mtbf}.
577 The final command in this example calls @cmd{EXAMINE} on this new variable,
578 and it can be seen from the results that both the skewness and
579 kurtosis for @var{mtbf_ln} are very close to zero.
580 This provides some confidence that the @var{mtbf_ln} variable is
581 normally distributed and thus safe for linear analysis.
582 In the event that no suitable transformation can be found,
583 then it would be worth considering
584 an appropriate non-parametric test instead of a linear one.
585 @xref{NPAR TESTS}, for information about non-parametric tests.
587 @float Example, normality
590 @prompt{PSPP>} get file='@value{example-dir}/repairs.sav'.
591 @prompt{PSPP>} examine mtbf
592 /statistics=descriptives.
593 @prompt{PSPP>} compute mtbf_ln = ln (mtbf).
594 @prompt{PSPP>} examine mtbf_ln
595 /statistics=descriptives.
600 1.2 EXAMINE. Descriptives
601 #====================================================#=========#==========#
602 # #Statistic|Std. Error#
603 #====================================================#=========#==========#
604 #mtbf Mean # 8.32 | 1.62 #
605 # 95% Confidence Interval for Mean Lower Bound# 4.85 | #
606 # Upper Bound# 11.79 | #
607 # 5% Trimmed Mean # 7.69 | #
609 # Variance # 39.21 | #
610 # Std. Deviation # 6.26 | #
612 # Maximum # 26.47 | #
614 # Interquartile Range # 5.83 | #
615 # Skewness # 1.85 | .58 #
616 # Kurtosis # 4.49 | 1.12 #
617 #====================================================#=========#==========#
619 2.2 EXAMINE. Descriptives
620 #====================================================#=========#==========#
621 # #Statistic|Std. Error#
622 #====================================================#=========#==========#
623 #mtbf_ln Mean # 1.88 | .19 #
624 # 95% Confidence Interval for Mean Lower Bound# 1.47 | #
625 # Upper Bound# 2.29 | #
626 # 5% Trimmed Mean # 1.88 | #
629 # Std. Deviation # .74 | #
633 # Interquartile Range # .92 | #
634 # Skewness # -.16 | .58 #
635 # Kurtosis # -.09 | 1.12 #
636 #====================================================#=========#==========#
639 @caption{Testing for normality using the @cmd{EXAMINE} command and applying
640 a logarithmic transformation.
641 The @var{mtbf} variable has a large positive skew and is therefore
642 unsuitable for linear statistical analysis.
643 However the transformed variable (@var{mtbf_ln}) is close to normal and
644 would appear to be more suitable.}
648 @node Hypothesis Testing
649 @section Hypothesis Testing
651 @cindex Hypothesis testing
653 @cindex null hypothesis
655 One of the most fundamental purposes of statistical analysis
656 is hypothesis testing.
657 Researchers commonly need to test hypotheses about a set of data.
658 For example, she might want to test whether one set of data comes from
659 the same distribution as another,
661 whether the mean of a dataset significantly differs from a particular
663 This section presents just some of the possible tests that @pspp{} offers.
665 The researcher starts by making a @dfn{null hypothesis}.
666 Often this is a hypothesis which he suspects to be false.
667 For example, if he suspects that @var{A} is greater than @var{B} he will
668 state the null hypothesis as @math{ @var{A} = @var{B}}.@c
669 @footnote{This example assumes that it is already proven that @var{B} is
670 not greater than @var{A}.}
672 The @dfn{p-value} is a recurring concept in hypothesis testing.
673 It is the highest acceptable probability that the evidence implying a
674 null hypothesis is false, could have been obtained when the null
675 hypothesis is in fact true.
676 Note that this is not the same as ``the probability of making an
677 error'' nor is it the same as ``the probability of rejecting a
678 hypothesis when it is true''.
683 * Testing for differences of means::
684 * Linear Regression::
687 @node Testing for differences of means
688 @subsection Testing for differences of means
693 A common statistical test involves hypotheses about means.
694 The @cmd{T-TEST} command is used to find out whether or not two separate
695 subsets have the same mean.
697 @ref{t-test} uses the file @file{physiology.sav} previously
699 A researcher suspected that the heights and core body
700 temperature of persons might be different depending upon their sex.
701 To investigate this, he posed two null hypotheses:
703 @item The mean heights of males and females in the population are equal.
704 @item The mean body temperature of males and
705 females in the population are equal.
708 For the purposes of the investigation the researcher
709 decided to use a p-value of 0.05.
711 In addition to the T-test, the @cmd{T-TEST} command also performs the
712 Levene test for equal variances.
713 If the variances are equal, then a more powerful form of the T-test can be used.
714 However if it is unsafe to assume equal variances,
715 then an alternative calculation is necessary.
716 @pspp{} performs both calculations.
718 For the @var{height} variable, the output shows the significance of the
719 Levene test to be 0.33 which means there is a
720 33% probability that the
721 Levene test produces this outcome when the variances are equal.
722 Had the significance been less than 0.05, then it would have been unsafe to assume that
723 the variances were equal.
724 However, because the value is higher than 0.05 the homogeneity of variances assumption
725 is safe and the ``Equal Variances'' row (the more powerful test) can be used.
726 Examining this row, the two tailed significance for the @var{height} t-test
727 is less than 0.05, so it is safe to reject the null hypothesis and conclude
728 that the mean heights of males and females are unequal.
730 For the @var{temperature} variable, the significance of the Levene test
731 is 0.58 so again, it is safe to use the row for equal variances.
732 The equal variances row indicates that the two tailed significance for
733 @var{temperature} is 0.20. Since this is greater than 0.05 we must reject
734 the null hypothesis and conclude that there is insufficient evidence to
735 suggest that the body temperature of male and female persons are different.
737 @float Example, t-test
740 @prompt{PSPP>} get file='@value{example-dir}/physiology.sav'.
741 @prompt{PSPP>} recode height (179 = SYSMIS).
742 @prompt{PSPP>} t-test group=sex(0,1) /variables = height temperature.
746 1.1 T-TEST. Group Statistics
747 #==================#==#=======#==============#========#
748 # sex | N| Mean |Std. Deviation|SE. Mean#
749 #==================#==#=======#==============#========#
750 #height Male |22|1796.49| 49.71| 10.60#
751 # Female|17|1610.77| 25.43| 6.17#
752 #temperature Male |22| 36.68| 1.95| .42#
753 # Female|18| 37.43| 1.61| .38#
754 #==================#==#=======#==============#========#
755 1.2 T-TEST. Independent Samples Test
756 #===========================#=========#=============================== =#
757 # # Levene's| t-test for Equality of Means #
758 # #----+----+------+-----+------+---------+- -#
760 # # | | | |Sig. 2| | #
761 # # F |Sig.| t | df |tailed|Mean Diff| #
762 #===========================#====#====#======#=====#======#=========#= =#
763 #height Equal variances# .97| .33| 14.02|37.00| .00| 185.72| ... #
764 # Unequal variances# | | 15.15|32.71| .00| 185.72| ... #
765 #temperature Equal variances# .31| .58| -1.31|38.00| .20| -.75| ... #
766 # Unequal variances# | | -1.33|37.99| .19| -.75| ... #
767 #===========================#====#====#======#=====#======#=========#= =#
770 @caption{The @cmd{T-TEST} command tests for differences of means.
771 Here, the @var{height} variable's two tailed significance is less than
772 0.05, so the null hypothesis can be rejected.
773 Thus, the evidence suggests there is a difference between the heights of
774 male and female persons.
775 However the significance of the test for the @var{temperature}
776 variable is greater than 0.05 so the null hypothesis cannot be
777 rejected, and there is insufficient evidence to suggest a difference
778 in body temperature.}
781 @node Linear Regression
782 @subsection Linear Regression
783 @cindex linear regression
786 Linear regression is a technique used to investigate if and how a variable
787 is linearly related to others.
788 If a variable is found to be linearly related, then this can be used to
789 predict future values of that variable.
791 In example @ref{regression}, the service department of the company wanted to
792 be able to predict the time to repair equipment, in order to improve
793 the accuracy of their quotations.
794 It was suggested that the time to repair might be related to the time
795 between failures and the duty cycle of the equipment.
796 The p-value of 0.1 was chosen for this investigation.
797 In order to investigate this hypothesis, the @cmd{REGRESSION} command
799 This command not only tests if the variables are related, but also
800 identifies the potential linear relationship. @xref{REGRESSION}.
803 @float Example, regression
806 @prompt{PSPP>} get file='@value{example-dir}/repairs.sav'.
807 @prompt{PSPP>} regression /variables = mtbf duty_cycle /dependent = mttr.
808 @prompt{PSPP>} regression /variables = mtbf /dependent = mttr.
812 1.3(1) REGRESSION. Coefficients
813 #=============================================#====#==========#====#=====#
814 # # B |Std. Error|Beta| t #
815 #========#====================================#====#==========#====#=====#
816 # |(Constant) #9.81| 1.50| .00| 6.54#
817 # |Mean time between failures (months) #3.10| .10| .99|32.43#
818 # |Ratio of working to non-working time#1.09| 1.78| .02| .61#
820 #========#====================================#====#==========#====#=====#
822 1.3(2) REGRESSION. Coefficients
823 #=============================================#============#
825 #========#====================================#============#
827 # |Mean time between failures (months) # .00#
828 # |Ratio of working to non-working time# .55#
830 #========#====================================#============#
831 2.3(1) REGRESSION. Coefficients
832 #============================================#=====#==========#====#=====#
833 # # B |Std. Error|Beta| t #
834 #========#===================================#=====#==========#====#=====#
835 # |(Constant) #10.50| .96| .00|10.96#
836 # |Mean time between failures (months)# 3.11| .09| .99|33.39#
838 #========#===================================#=====#==========#====#=====#
840 2.3(2) REGRESSION. Coefficients
841 #============================================#============#
843 #========#===================================#============#
845 # |Mean time between failures (months)# .00#
847 #========#===================================#============#
850 @caption{Linear regression analysis to find a predictor for
852 The first attempt, including @var{duty_cycle}, produces some
853 unacceptable high significance values.
854 However the second attempt, which excludes @var{duty_cycle}, produces
855 significance values no higher than 0.06.
856 This suggests that @var{mtbf} alone may be a suitable predictor
860 The coefficients in the first table suggest that the formula
861 @math{@var{mttr} = 9.81 + 3.1 \times @var{mtbf} + 1.09 \times @var{duty_cycle}}
862 can be used to predict the time to repair.
863 However, the significance value for the @var{duty_cycle} coefficient
864 is very high, which would make this an unsafe predictor.
865 For this reason, the test was repeated, but omitting the
866 @var{duty_cycle} variable.
867 This time, the significance of all coefficients no higher than 0.06,
868 suggesting that at the 0.06 level, the formula
869 @math{@var{mttr} = 10.5 + 3.11 \times @var{mtbf}} is a reliable
870 predictor of the time to repair.
873 @c LocalWords: PSPP dir itemize noindent var cindex dfn cartouche samp xref
874 @c LocalWords: pxref ie sav Std Dev kilograms SYSMIS sansserif pre pspp emph
875 @c LocalWords: Likert Cronbach's Cronbach mtbf npplot ln myfile cmd NPAR Sig
876 @c LocalWords: vindex Levene Levene's df Diff clicksequence mydata dat ascii
877 @c LocalWords: mttr outfile