| WINKS Manual Index | Help | Home | Tutorials |

WINKS Online Manual


Chapter 4 Part 3

t-Tests and ANOVA

Independent Group t-test Example

Independent group analysis is appropriate when observations are taken from groups in which subjects in one group do not appear in another group. That is, the observations within as well as between groups are independent of one another. A t-test is performed when there are two groups, and  an ANOVA is performed when there are three or more  groups being compared. When performing a t-test or ANOVA on two or more independent groups, you are testing the hypotheses:

Ho:  The difference in the means of the groups is zero.
Ha:  The difference in the means of the groups is not zero.

For a two-sample t-test, two t-statistics are calculated, one for the case in which the variances of the two samples are equal and the other for use in the case of unequal variances. WINKS performs a test of the hypothesis that the variances are equal, that is, a test to determine if the variances are equal, and reports a p-value. If this p-value is small (e.g., less than 0.05), the hypothesis of equal variances is rejected and you use the t-statistic for unequal variances. If the p-value is large, use the t-statistic for equal variances.

Since the observations are all independent of one another, each observation is entered as an individual record in the database. The number of data records must be the same as the total number of observations. Each record includes the response value of one observation and a number or character to indicate to which treatment group it belongs. That is, there will be two fields (variables), one in which to record the response and one in which to indicate the group.

Independent Group t-test Example
The data used here are heights of 13 plants grown using two different fertilizers.  Suppose you want to know if there is a difference in the average heights of plants in the two treatment groups.

Data for independent group t-test (fertilizer study)

Present Fertilizer     Newer Fertilizer
46.2 cm                        51.3 cm
55.6                             52.4
53.3                             54.6
44.8                             52.2
55.4                             64.3
56.0                             55.0
48.9                      

In order to enter this data into a database, you must assign group numbers (or letters) such as Present = 1 and Newer = 2, or you could use P and N (if the variable is of the character type). Follow these steps to perform this analysis:

Step 1: Since the observations are independent, the database will include thirteen records (one for each plant) and two fields (one for the response and one for the group indicator. Create a database (File/New Database) using the pre-defined structure named "For Independent Group t-test or ANOVA." This will create a database with the fields GROUP and OBS. Or, use the database on disk named FERTILIZ.DBF and disk to step 3.

Step 2: Enter the data will be in two columns, like this:

Rec.
No.   GROUP    OBS (HEIGHT)
1          1              46.2
2          1              55.6
3          1              53.3
4                       44.8
5          1              55.4
6          1              56.0
7          1              48.9
8          2              51.3
9          2              52.4
10        2              54.6
11        2              52.2
12        2              64.3
13        2              55.0
 

Step 3:
  Choose the t-tests and ANOVA option from the Analyze menu, then choose the  "Independent group (t-test/ ANOVA)" option.

Step 4: Select GROUP as the Group variable and OBS  (Height) as the data (response) variable and click Ok. The results appear in the viewer. The means for each group (1=Present, 2=Newer) are displayed. A test for equality of variance (F=1.02)  is also performed to see if the variances of the two  groups can be considered equal. This is necessary for deciding which t-statistic and p-value to use for the test on means. A p-value for the equal variances test is displayed. A large p-value (e.g., greater than 0.05) indicates that you can consider the variances to be equal. In this case, p=0.4807, large enough to consider the variances to be equal. If the variances are equal, according to this test, you use the "Equal variances" t-statistic. Otherwise, use the "Unequal variances" result. In this case, the two t-statistics are identical at -1.32.  The t-test is performed with 11 degrees of freedom, and the p-value associated with the test is 0.213. A large p-value (greater than the significance level, e.g., 0.05) is usually interpreted to mean that there is no significant difference in the means --  the null hypothesis of equal means is not rejected.  That is, there is not enough evidence to conclude that the average height of plants grown with the newer fertilizer is significantly different from the average height of plants grown with the present fertilizer.

Step 5: Click the Graph button to display a graphical comparison. This plot shows a box plot comparison. This is essentially the same as a by-group plot.

One-Way ANOVA Example

When more than two independent groups are compared with respect to one variable, one-way or single factor analysis of variance techniques are appropriate. When performing an ANOVA on two or more independent groups, you are testing the hypotheses:

Ho:  The difference in the means of the groups is zero.
Ha:  The difference in the means of the groups is not zero.

This example uses data for hogs which have been randomly assigned to four groups, with each group being given a different feed. The response is weight gain.

Data for Independent Group ANOVA

Gp 1                Gp 2                Gp 3               Gp 4
60.8                 78.7                 92.6                 86.9
67.0                 77.7                 84.1                 82.2
54.6                 76.3                 90.5                 83.7
61.7                 79.8                                         90.3

The database to analyze this data is similar to the one used for the t-test example, differing only with respect to the number of groups. In fact, this one-way ANOVA is an extension of the t-test when there are three or more groups. To perform this analysis, use these steps:

Step 1: Create a database (File/New Database) using the pre-defined structure named "For Independent Group t-test or ANOVA." This will create a database with the fields GROUP and OBS. Or, use the database on disk named HOGDATA.DBF and disk to step 3.

The groups will be numbered 1,2,3,4 according to the type of feed used. The response field will be OBS.

Step 2: Enter the data. The data, as entered into the database will look like this:

NO  GROUP    OBS (WEIGHT)
1          1                      60.8
2          1                      67.0
3          1                      54.6
4          1                      61.7
5          2                      78.7
6          2                      77.7
etc...
14        4                      83.7
15        4                      90.3

Step 3:  Choose the t-tests and ANOVA option from the Analyze menu, then choose the  "Independent group (t-test/ ANOVA)" option.

Step 4: Select GROUP as the Group field and OBS (Weight) as the data field and click Ok. The results appear in the viewer:

---------------------------------------------------------------------------
Independent Group Analysis C:\WINKS\HOGDATA.DBF
---------------------------------------------------------------------------
Grouping variable is GROUP
Analysis variable is OBS

Group Means and Standard Deviations

1: mean = 61.025 s.d. = 5.0822 n = 4 
2: mean = 78.125 s.d. = 1.4886 n = 4 
3: mean = 89.0667 s.d. = 4.4276 n = 3 
4: mean = 85.775 s.d. = 3.5976 n = 4 

Analysis of Variance Table

Source 		S.S. 	   DF 	MS 	F 	Appx P
---------------------------------------------------------------------------
Total 		1923.41    14
Treatment 	1761.24     3 	587.08 	39.82 	<.001
Error 		162.17 	   11 	14.74

Error term used for comparisons = 14.74 with 11 d.f.

								Critical q
Newman-Keuls Multiple Comp. 	Difference 	P 	Q 	(.05)
------------------------------------------------------------------------
Mean(3)-Mean(1) = 		28.0417 	4 	13.523 	4.256 *
Mean(3)-Mean(2) = 		10.9417 	3 	5.277 	3.82 *
Mean(3)-Mean(4) = 		3.2917 		2 	1.587 	3.113
Mean(4)-Mean(1) = 		24.75 		3 	12.892 	3.82 *
Mean(4)-Mean(2) = 		7.65 		2 	3.985 	3.113 *
Mean(2)-Mean(1) = 		17.1 		2 	8.907 	3.113 *

Homogeneous Populations, groups ranked 

Gp Gp Gp Gp
1   2  4  3
      ------
--- 
   --- 

This is a graphical representation of the Newman-Keuls multiple comparisons
test. At the 0.05 significance level, the means of any two groups
underscored by the same line are not significantly different.


Step 5: The results of this test are summarized in the p-value. In this case, the small p-value (p<0.001) means that there is a significant difference between groups. This is taken as evidence of a difference between feeds, a difference not due to chance. The ANOVA tells you only that there is a difference among the feeds. In order to find out which groups are significantly different from which others, examine the multiple comparison results. The Newman-Keuls multiple comparison test (or whichever you specified at setup) will describe which of the means are significantly different from which others (at the 0.05 significance level).

In the multiple comparison table, comparisons marked with an asterisk “*” are significantly different at the 0.05 significance level (alpha-level). The group numbers are given in increasing order of the value of their group means. That is, Group 1 has the smallest mean, Group 3 the largest. At the 0.05 significance level, the means of any two groups underscored by the same line are not significantly different.

1) The mean for group 1 (feed 1) is statistically significantly less than the means for all other groups.

2) The mean for group 2 (feed 2) is significantly greater than the mean for group 1, and significantly less than the means of groups 4 and 3.

3) The means for groups 4 and 3 are not significantly different from each  other, but they are both significantly greater than the means of groups 1 and  2.

You can conclude that feeds 3 and 4 are better than feeds 1 and 2, but there is not enough evidence to say that either feed 3 or 4 is the best overall.

Step 6 Click on the Graph button to view the graphical comparison: This is the same graph as described in the section "By Group Plots."  Using the Option button, you  can use this graph to show comparison in terms of error bars, box plots, etc.

Independent group test from summary data

Consider the fertilizer comparison problem described in the previous independent group t-test example. Suppose you don't have all the data. That is,  you aren't given the response of each plant, but you are given the means, standard deviations and sizes of the two groups. You can still perform an analysis.

Summary data for fertilizer study

Group         Mean         St. Dev.   Sample Size
1                   51.457          4.748     7
2                   54.967          4.794     6
 

Since you are not given individual data values, you don't have to create a database. Follow these steps to perform an analysis.

Step 1 From the  Analyze menu  select t-tests and ANOVA. Then select "Ind. Group  from summary data."

Step 2 You will be asked for the number of groups. Enter 2. Then you will be asked to enter the mean, standard deviation and sample size for each of the groups. In this case, for group 1 enter 51.457,4.748,7 and press Enter. For group 2 enter 54.967,4.794,6.

Note: Press Tab to move from field to field. Press Enter when you have entered all the data.

Step 3 The interpretation of the results is the same as in the independent group t-test example using this same data.

Note: You can also perform an Independent group one-way ANOVA using summary data. For example, perform an ANOVA using the summary data from the  "HOGDATA" example.


Paired t-test (Repeated Measures)

Repeated measures are observations taken on the same or related subjects over time or in differing circumstances. Examples would be weight loss, or reaction to a drug across time. Repeated measures may also be matched subjects. As in the independent groups module, a t-test is performed when there are two groups (two repeated measures), and an analysis of variance is performed by WINKS if there are more than two groups. The ANOVA determines if there is a difference in the means across groups or repeated measures. A multiple comparison procedure further identifies where the differences lie.

In a database for paired or repeated measures data, each record represents one subject (e.g., person, animal). There must be one field for each repeated measure (each treatment group). For paired data, there are two groups, hence two fields. Thus, in each record, there is a field in which to enter data from each observation (treatment) on that subject. This repeated measures (paired) analysis requires that all values be available for each subject and any subject with missing values is eliminated from the analysis. That is, a data record must have a value for each field, or it will be eliminated. The hypotheses being tested with a paired t-test or a repeated measures ANOVA is:

Ho: There is no difference among means of the groups (repeated measures).
Ha: There is a difference among means of the groups.

For comparing matched or paired data (not independent) from two groups, a paired t-test is used. For this test both groups must have the same number of data values, i.e., the two samples must be the same size. A paired t-test is actually a single sample t-test on the mean of the differences between the two data values in each pair.

For example, in a before/after study, the difference "after minus before" (or "before minus after") is taken for each pair and the average of these differences calculated. If this average of differences is found by a single sample t-test  to be significantly different from zero, the conclusion is that there is a change.

The data in this example are before and after weights for eight persons on a diet. Notice that in this case, both data values are taken from the SAME entity (person). Follow these steps to perform this analysis:

Step 1: Create a database with two fields (BEFORE and AFTER) and eight records, one for each person. Since the observations are paired, not independent, the database reflects this by having each record contain a pair of observations.  Use the pre-defined database structure named "Paired t-test or McNemar’s Test." This will create a database with the fields REP1 and REP2. The REP1 will be used for Before and REP2 will be used for After. Of course, you can choose to create a custom database and enter a structure containing the fields named BEFORE and AFTER. (Or, open the database named DIET, and skip to step 3.) The data for the paired t-test is:

Person Before          After
1          162                168
2          170                136
3          184                147
4          164                159
5          172                143
6          176                161
7          159                143
8          170                145

Step 2: Enter the data for the eight records. The database should look similar to the listing of the data above.

Step 3: Choose the t-tests and ANOVA option from the Analyze menu. Then choose the "Paired/Rep. Measure (t-test/ANOVA) option.

Step 4: Select REP1 (BEFORE) as the first field and REP2 as the second field and click Ok.

Step 5: The results are shown in the viewer. A portion of the output is shown below:

Means and standard deviations for 2 repeated measures:

1)REP1: mean = 169.625 s.d. = 8.07001
2)REP2: mean = 150.25 s.d. = 11.04213

Mean Difference = 19.375 s.d.(difference) = 14.78356

95% C.I. about Mean Difference is (7.01367, 31.73633)

Paired t-test
--------------
Hypotheses:

Ho: The mean difference between pairs is 0.
Ha: The mean difference between pairs is not 0.

Calculated t = 3.70687 with 7 D.F. p = 0.0076 (two-sided)

Since p <= 0.05, at the 0.05 significance level you have evidence
to reject the null hypothesis and conclude that the mean difference
between pairs is not 0.

For a one-sided test, you must adjust the p-value according to
the direction of your alternative hypothesis.

The means and standard deviations for each group are reported, but more importantly, the mean difference between BEFORE and AFTER measurements is given. The statistical procedures are performed on this average difference. A 95% confidence interval for the mean difference is given, as well as a  calculated t-statistic and a p-value. These results are interpreted like those of a single sample t-test with null hypothesis: mean=0, and alternative hypothesis: mean <> 0. The calculated t-statistic is 3.70687. The test is performed with 7 degrees of freedom, and the p-value associated with the test is 0.0076. A small p-value such as this is usually interpreted to indicate rejection of the null hypothesis and leads to the conclusion that the average difference in BEFORE and AFTER weights is not zero, i.e., there is evidence of a significant (at the 0.05 level) change of weight in these eight subjects on average.

Step 6: Click Graph to display a graphical comparison of the results.

 

One-way repeated measures ANOVA

For more than a pair of repeated measures on the same subject, a one-way repeated measures analysis of variance is appropriate. The data in this example are repeated measures of reaction times of five persons after being treated with four drugs in randomized order.

One-way repeated measures ANOVA data

          Drug1          Drug2         Drug 3         Drug 4
           31                 29                 17                 35
           15                 17                 11                 23
           25                 21                 19                 31
           35                 35                 21                 45
           27                 27                 15                 31

To perform this analysis, follow these steps:

Step 1: Create a database with four fields (DRUG1, DRUG2, DRUG3 and DRUG4) Use the pre-defined database structure named "Paired t-test or McNemar’s Test." Or, open the database named DRUG.DBF and disk to step 3.

Step 2: For the first record, enter the data for the first person 31,29,17,35. The second record will contain 15,17,11,23 and so forth. After you finish entering your data, the database should look similar to the data listing above.

Step 3: Choose the t-tests and ANOVA option from the Analyze menu. Then choose the "Paired/Rep. Measure (t-test/ANOVA) option.

Step 4 Select  DRUG1, DRUG2, DRUG3 and DRUG4 as the fields to use and click Ok.

Step 5 The results are displayed in the viewer: Partial output is shown below:

---------------------------------------------------------------------------
Repeated Measures Analysis Summary C:\WINKS\DRUG.DBF
---------------------------------------------------------------------------
Number of repeated measures is 4 
Number of subjects read in 5 

Means and standard deviations for 4 repeated measures:

1)DRUG1: mean = 26.6 s.d. = 7.53658
2)DRUG2: mean = 25.8 s.d. = 7.01427
3)DRUG3: mean = 16.6 s.d. = 3.84708
4)DRUG4: mean = 33.0 s.d. = 8.0

Repeated Measures Analysis of Variance

Source 			-----S.S.----- --DF-- 	MS 	F	Appx p
---------------------------------------------------------------------------
	Between Subject 	648.00 	  4
	Within Subject 		775.00 	 15
	   Rep. Factor 	683.80    	  3    227.93  29.99 	<.001
	   Error 	 91.2 		 12      7.60
---------------------------------------------------------------------------
Total  			       1423.00   19

Error term used for comparisons = 7.6 with 12 d.f.

								Critical q
Newman-Keuls Multiple Comp. 	Difference 	P 	Q 	(.05)
------------------------------------------------------------------------
Mean( 4)-Mean( 3) = 		16.4 		4 	13.302 	4.199 *
Mean( 4)-Mean( 2) = 		7.2 		3 	5.84 	3.773 *
Mean( 4)-Mean( 1) = 		6.4 		2 	5.191 	3.082 *
Mean( 1)-Mean( 3) = 		10.0 		3 	8.111 	3.773 *
Mean( 1)-Mean( 2) = 		0.8 		2 	 .649 	3.082
Mean( 2)-Mean( 3) = 		9.2 		2 	7.462 	3.082 *

Homogeneous Populations, repeated measures ranked 

Gp 1 refers to DRUG1
Gp 2 refers to DRUG2
Gp 3 refers to DRUG3
Gp 4 refers to DRUG4

The results of this ANOVA are summarized in the p-value. In this case, the small p-value (The p<0.001 on the “Repeated Factor" line in the ANOVA table.) means that there is a statistically significant difference in the mean response times for the four drugs.

In the multiple comparison table, comparisons marked with an asterisk “*” are significantly different at the 0.05 significance level (alpha-level). A graphical description of the multiple comparisons is given by:

     Gp    Gp     Gp     Gp
      3     2      1      4
           ----------
     -----
                        -----

This tells you that groups 2 and 1 (DRUGS 2 and 1) are not significantly different at the 0.05 significance level. The Group 3 (DRUG 3) mean is significantly smaller than all other groups' and the Group 4 (DRUG 4) mean is significantly larger than all others.

Step 6 : Click on the Graph button to view a comparison graph.


Single Sample t-test Analysis

The single sample analysis allows you to choose a single variable, and test a hypothesis that the mean differs from an hypothesized mean. You must enter the hypothesized population mean. The hypotheses you are testing in this case are:

Ho: The mean equals the hypothesized value.
Ha: The mean does not equal the hypothesized value.

Follow these steps to perform the analysis:

Step 1: Choose the Open Database option from the FILE pull-down menu, then choose the EXAMPLE database from the displayed list. Or, create a database with at least one numeric field.

Step 2 From Analyze, choose the t-test and ANOVA option. Then, choose the “Single sample t-test” option.

Step 3: Choose the field you wish to use. In this case, choose the field TIME1.

Step 4: WINKS will display the mean, standard deviation and sample size of the field TIME1, and will ask you for the hypothesized mean. In this case, you want to know if the mean is 20. Enter 20 as the hypothesized mean. Choose Calculate and End.

Step 5: The results of the analysis will be displayed. 

---------------------------------------------------------------------------
Single Sample t-test C:\WINKS\EXAMPLE.DBF
---------------------------------------------------------------------------

Variable Name is TIME1

N = 50 Missing or Deleted = 0
Mean = 21.268 St. Dev (n-1) = 1.71695

Null Hypothesis: mean(POPULATION) = 20 

Calculated t = 5.22 with 49 D.F. p = < 0.001 (2 - sided test)

95% C.I. about Mean is (20.77995, 21.75605)

A small p-value, such as the one in this case p<0.001, supports rejection of the null hypothesis. That is, you can conclude that the mean of TIME1 in the population is statistically significantly different from 20 based on this test procedure.

Note: Even if you don't have all the data values, you can test whether the mean of a population is equal to some hypothesized value if you know the mean, standard deviation and sample size of the data values in a sample. In this case, choose the Single sample t-test - from summary data option.


Dunnett's Test

Dunnett's test is a multiple comparison procedure following a one-way ANOVA either from database data or from summary data that compares a control mean with the other means in the analysis. Data entry is the same as for a One-Way Independent Group ANOVA. You will be asked to specify which field in represents the control group, and multiple comparisons will be performed accordingly.

 

Continue to Chapter 4. Part 4. (Non-Parametric Procedures.)  

     


| Previous Section | Next Section | WINKS Manual Index | Help | Homepage |