Content
Parametric Methods
Parametric methods
Paired t test
Single sample t test
Unpaired (two sample) t test
Summary t tests
F (variance ratio) test
z (normal distribution) tests
Reference range
Poisson confidence interval
Shapiro-Wilk W test
Parametricmethods.. 1
Paired t test.. 2
Single sample t test.. 4
Unpaired (two sample) t test.. 6
Summary data t test.. 10
F (variance ratio) test.. 10
z (normal distribution) tests.. 11
Reference range. 13
Poisson confidence interval.. 15
Shapiro-Wilk W test.. 17
·Pairedt test (compare a pair of samples)
·Singlesample t test (compare the mean of a sample witha specified mean)
·Unpaired(two sample) t test (compare two independentsamples)
·z (Normal distribution) tests(single sample and unpaired tests analogous to t tests)
·Referencerange (reference range/interval from a sample)
·F(variance ratio) test (compare the variances oftwo samples)
·Poissonconfidence interval (e.g. CIsfor means of counts of events in time)
·Shapiro-WilkW test (examine a sample for evidence ofnon-normality)
Menulocation: Analysis_Parametric.
This sectionprovides various hypothesis tests and descriptive functions that assume yourdata are from a normal distribution.
The Shapiro-Wilk W test is, strictly speaking, a (semi/non)parametric analysis of variance type method; it isincluded in this section because it enables you to test for"non-normality".
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menu location:Analysis_Parametric_Paired t.
This functiongives a paired Student t test, confidence intervals for the difference between apair of means and, optionally, limits of agreement for a pair of samples (Armitage and Berry,1994; Altman, 1991).
The paired ttest provides an hypothesis test of the differencebetween population means for a pair of random samples whose differences areapproximately normally distributed. Please note that a pair of samples, each ofwhich are not from normal a distribution, often yields differences that arenormally distributed.
The teststatistic is calculated as:
- where d bar is the mean difference, s² is the samplevariance, n is the sample size and t is a Student t quantilewith n-1 degrees of freedom.
Power iscalculated as the power achieved with the given sample size and variance fordetecting the observed mean difference with a two-sided type Ierror probability of (100-CI%)%(Dupont,1990).
Limits ofagreement
If the mainpurpose in studying a pair of samples is to see how closely the samples agree,rather than looking for evidence of difference, then limits of agreement areuseful (Bland and Altman1986, 1996a, 1996b). StatsDirectdisplays these limits with an agreement plot if you check the agreement boxbefore a paired t test runs. For more detailed analysis of this type, see agreementanalysis.
Agreementplot
When twomethods of measurement are compared it is almost always wrong to present ascatter plot with correlation as a measure of agreement between the paireddata. Highly correlated results often agree poorly, indeed large shiftsin measurement scales may leave the correlation coefficient unaltered. It istherefore necessary to provide a measure of agreement. StatsDirectprovides a plot of the difference against the mean for each pair ofmeasurements. This plot also displays the overall mean difference bounded bythe limits of agreement. A good review of this subject has been provided byBland and Altman (Bland and Altman,1986; Altman, 1991).
Example
Test workbook(Parametric worksheet: PEFR Before, PEFR After).
Comparison of peak expiratory flow rate (PEFR) before andafter a walk on a cold winter's day for a random sample of 9 asthmatics. Enter two columns in the workbook, one of PEFR's before the walk and the other of PEFR'safter the walk. In this example each row must represent the same subject:
Subject | before | after |
1 | 312 | 300 |
2 | 242 | 201 |
3 | 340 | 232 |
4 | 388 | 312 |
5 | 296 | 220 |
6 | 254 | 256 |
7 | 391 | 328 |
8 | 402 | 330 |
9 | 290 | 231 |
If you wereto plot these pairs using a ladder plot you would see that all but one pair decreases. Youmight also wish to test the assumption that the differences are from a normaldistribution, this can be done with the Shapiro-Wilktest.
To run thisexample, open the test workbook using the open file function of the file menuthen choose paired t test from the parametric methods section of the analysismenu. Select the columns marked "before" and"after" when prompted.
For thisexample:
Paired ttest
Fordifferences between PEFR Before and PEFR After:
Mean ofdifferences = 56.111111 (n = 9)
Standarddeviation = 34.173983
Standarderror = 11.391328
95% CI =29.842662 to 82.37956
df = 8
t = 4.925774
One sided P =.0006
Two sided P =.0012
Power (for 5%significance) = 98.47%
A nullhypothesis of no difference between the means is clearly rejected; theconfidence interval is a long way from including zero.
P values
confidenceintervals
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_Single Samplet.
This functiongives a single sample Student t test with a confidence interval for the mean difference.
The singlesample t method tests a null hypothesis that the population mean is equal to aspecified value. If this value is zero (or not entered) then the confidenceinterval for the sample mean is given (Altman, 1991;Armitage and Berry, 1994).
The teststatistic is calculated as:
- where x baris the sample mean, s² is the sample variance, n is the sample size, µ is thespecified population mean and t is a Student t quantilewith n-1 degrees of freedom.
Power iscalculated as the power achieved with the given sample size and variance fordetecting the observed mean difference with a two-sided type Ierror probability of (100-CI%)%(Dupont,1990).
Example
Test workbook(Parametric worksheet: Systolic BP).
Consider 20first year resident female doctors drawn at random from one area, restingsystolic blood pressures measured using an electronic sphygmomanometer were:
128 | 127 |
118 | 115 |
144 | 142 |
133 | 140 |
132 | 131 |
111 | 132 |
149 | 122 |
139 | 119 |
136 | 129 |
126 | 128 |
From previouslarge studies of women drawn at random from the healthy general public, aresting systolic blood pressure of 120 mmHg was predicted as the population mean for the relevant age group. To analyse these data in StatsDirectfirst prepare a workbook column containing the 20 data above or open the testworkbook and select the single sample t test from the parametric methodssection of the analysis menu. Select the column marked "Systolic BP" when promptedand enter the population mean as 120.
For thisexample:
Singlesample t test
Sample name:Systolic BP
Sample mean =130.05
Populationmean = 120
Sample size n= 20
Sample sd = 9.960316
95%confidence interval for mean difference = 5.388429 to 14.711571
df = 19
t = 4.512404
One sided P =.0001
Two sided P =.0002
Power (for 5%significance) = 98.71%
A nullhypothesis of no difference between sample and population means has clearlybeen rejected. Using the 95% CI we expect the mean systolic BP for thispopulation of doctors to be at least 5 mmHg greater than the age and sex matched general public, lying somewhere between125 and 135 mm Hg.
P values
confidenceintervals
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_Unpaired t.
This functiongives an unpaired two sample Student t test with a confidence interval for the difference betweenthe means.
The unpairedt method tests the null hypothesis that the population means related to twoindependent, random samples from an approximately normal distribution are equal(Altman, 1991;Armitage and Berry, 1994).
Assumingequal variances, the test statistic is calculated as:
- where x bar1 and x bar 2 are the sample means, s² is the pooled sample variance, n1 and n2are the sample sizes and t is a Student t quantilewith n1 + n2 - 2 degrees of freedom.
Power iscalculated as the power achieved with the given sample sizes and variances fordetecting the observed difference between means with a two-sided type Ierror probability of (100-CI%)%(Dupont,1990).
The unpairedt test should not be used if there is a significant difference between thevariances of the two samples; StatsDirect tests forthis and gives appropriate warnings. For the situation of unequal variances, StatsDirect calculates Satterthwaite'sapproximate t test; a method in the Behrens-Welch family (Armitageand Berry, 1994).
Assumingunequal variances, the test statistic is calculated as:
- where x bar1 and x bar 2 are the sample means, s² is the sample variance, n1 and n2 arethe sample sizes, d is the Behrens-Welch test statistic evaluated as a Studentt quantile with df freedomusing Satterthwaite's approximation.
Note that isoften more robust to use the non-parametric Mann-Whitney test as an alternative method in the presence of unequalvariances.
Example
From Armitageand Berry (1994, p. 111).
Test workbook(Parametric worksheet: Low Protein, Heigh Protein).
Consider thegain in weight of 19 female rats between 28 and 84 days after birth. 12 werefed on a high protein diet and 7 on a low protein diet.
High protein | Low protein |
134 | 70 |
146 | 118 |
104 | 101 |
119 | 85 |
124 | 107 |
161 | 132 |
107 | 94 |
83 | |
113 | |
129 | |
97 | |
123 |
To analyse these data in StatsDirectfirst prepare them in two workbook columns and label these columnsappropriately. Alternatively, open the test workbook using the file openfunction of the file menu. Then select the unpaired t test from the parametricmethods section of the analysis menu. Select the columns marked "High protein" and "Lowprotein" when prompted for data.
For thisexample:
Unpaired ttest
Mean of HighProtein = 120 (n = 12)
Mean of LowProtein = 101 (n = 7)
Assumingequal variances
Combinedstandard error = 10.045276
df = 17
t = 1.891436
One sided P =0.0379
Two sided P =0.0757
95%confidence interval for difference between means = -2.193679 to 40.193679
Power (for 5%significance) = 82.25%
Assumingunequal variances
Combinedstandard error = 9.943999
df = 13.081702
t(d) =1.9107
One sided P =0.0391
Two sided P =0.0782
95%confidence interval for difference between means = -1.980004 to 39.980004
Power (for 5%significance) = 40.39%
Comparisonof variances
Two sided Ftest is not significant
No need toassume unequal variances
Thus we havea difference that is not quite significant at the 5% level. The most importantinformation is, however, conveyed by the confidence interval. The 95% CIincludes zero therefore we can not be confident (at the 95% level) that thesedata show any difference in weight gain. As most of the interval is towardweight gain and as the test result is in the grey "suggestive" 5%-10%zone we have good evidence for repeating this experiment with larger numbers.Bigger samples will probably shrink the range of uncertainty so that theconfidence interval contracts to a narrower band that excludes zero.
N.B. Wedid not consider a one sided P value here because we could not be absolutelycertain that the rats would all benefit from a high protein diet in comparisonwith those on a low protein diet.
P values
confidenceintervals
Menulocation: Analysis_Parametric_Summary Datat.
StatsDirect enables you to calculate t tests from summary data. These data areentered as means and standard deviations on screen instead of being calculatedfrom selected workbook columns.
Single samplet test
Unpaired (twosample) t test
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_F (VarianceRatio).
This functiontests the equalityof the variances of two random samples from anormal distribution.
F is theratio of variances (largest as numerator) from samples of size n1 and n2.Degrees of freedom are n1-1 and n2-1 corresponding to the numerator anddenominator sample variances.
Only theupper tail probability need be considered because the larger variance is alwaysused as the numerator in the variance ratio F (Altman, 1991;Armitage and Berry, 1994). In most situationsthis probability should be doubled to give a two sided test. Analysis ofvariance can utilise a one sided probability becausethe numerator and denominator of the variance ratio are predetermined.
P values
confidenceintervals
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menu locations: Analysis_Parametric_SingleSample z
Analysis_Parametric_Unpairedz
For large (50or more observations) normally distributed samples, normaldistribution tests are equivalent to Student ttests.
Normaldata
You mayeither compare the means of two independent random samples or compare the meanof one sample with a known population mean. Note that for large degrees offreedom, Student's t distribution is approximately normal (Altman, 1991;Armitage and Berry, 1994).
See theexamples for t tests and consider these in the context of larger samples.
You will gaina little more sensitivity by using a normal distribution test instead of itsequivalent Student t test but you must have good reason to believe that yourdata have been drawn from a normal distribution. Student t tests are lesssensitive than normal distribution tests to small deviations from normality;use t tests if you have any doubt. If your data are clearly non-normal then youshould consider using a non-parametric alternative such as the Wilcoxonsigned ranks test or the Mann-Whitney U test.
The singlesample test statistic is calculated as:
- where x baris the sample mean, s² is the sample variance, n is the sample size, µ is thespecified population mean and z is a quantile fromthe standard normal distribution.
The unpairedtest statistic is calculated as:
- where x bar1 and x bar 2 are the sample means, s1² and s2² are the sample variances, n1and n2 are the sample sizes and z is a quantile fromthe standard normal distribution.
Log-normaldata
For samplesfrom a log-normal distribution (logs from a normal distribution) you may wishto construct an interval analogous to the confidence interval for the mean of asample from a normal distribution. StatsDirect givesyou the geometric mean (arithmetic mean of logs) and a reference range as:
- where e is exponent, g is geometric mean, ln is natural logarithm, n is sample size and z is a quantile from the standard normal distribution (alpha/2 quantile for a 100*(1-alpha)% confidence interval).
P values
confidenceintervals
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_ReferenceRange.
This functionenables you to construct confidence intervals for a reference range (also knownas reference interval or normal range) from a sample of observations drawn atrandom from a normal distribution. The non-parametric alternative (quantile reference range) is also given.
The referencerange and confidence interval for data from a normal distribution is calculatedas:
- where x baris the sample mean, s is the sample standard deviation, n is the sample size, rr is the reference range, se is the standard error of thereference range limits, ci is the confidence intervalfor the reference range limits, z is a quantile fromthe standard normal distribution and c is % range coverage/100 (e.g. 0.95 for a95% reference range).
For sampleswith no negative values, the above calculations are repeated on log-transformeddata and the results are presented in the original measurement scale.
The referencerange and confidence interval for data that are not from a normal distributionshould be calculated by the percentile method. For a c*100% reference range,the percentile method examines the 1-(c/2) and 1-(1-(c/2)) samplequantiles and their confidence intervals.
Example
From Altman(1991, p. 421).
Test workbook(Parametric worksheet: IgM).
Consider theserum IgM concentrations measured from blood samplesfrom 298 healthy children aged six months to six years.
To analyse these data in StatsDirectopen the test workbook using the file open function of the file menu. Thenselect the reference range from the parametric methods section of the analysismenu. Select the column marked "IgM"when prompted for data.
For thisexample:
Referencerange/interval
Sample name: IgM
Sample mean =0.80302
Sample size n= 298
Sample sd = 0.469498
For normaldata
95% referenceinterval = -0.117179 to 1.72322
95% confidenceinterval for lower range limit = -0.20828 to -0.026079
95%confidence interval for upper range limit = 1.632119 to 1.81432
Forlog-normal data
95% referenceinterval = 0.238102 to 2.031412
95%confidence interval for lower range limit = 0.214129 to 0.264758
95%confidence interval for upper range limit = 1.826887 to 2.258836
For any data
Quantile0.025 = 0.2
Approximate95% confidence interval (non-conservative) = 0.1 to 0.3
Exactconfidence level = 95.659155%
Quantile0.975 = 2
Approximate95% confidence interval (non-conservative) = 1.7 to 2.5
Exactconfidence level = 96.091704%
These dataare not from a normal distribution but are from an approximately log-normaldistribution. This explains why the results for log-normal data are closer tothe 2.5% and 97.5% percentiles.
Copyright © 1990-2006 StatsDirectLimited, all rights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_PoissonConfidence Interval.
This functionenables you to construct a confidence interval from a sample of observationsdrawn at random from a Poisson distribution.
Note that theAnalysis_Distributions_Poisson menu item alsoprovides Poisson confidence intervals for single counts. The function describedin this section provides Poisson confidence intervals for series of counts.
The Poissonmean is estimated here as the arithmetic mean of thesample and the confidence interval is estimated using the relationship betweenthe chi-square and Poisson distributions (Stuart and Ord,1994; Johnson and Kotz, 1969):
- where c²a,n is the chi-square deviate with lower tail area a on n degrees of freedom,n is the sample size and the sample mean is the point estimate of the Poissonparameter around which LL and UL are the lower and upper confidence limitsrespectively.
Example
Test workbook(Parametric worksheet: Reception).
Consider thefollowing numbers from a hypothetical time and motion study in a hospitaloutpatients department. The numbers represent the number of patients arrivingat the reception desk at five minute intervals during the mid-afternoon:
2
1
1
0
2
1
0
2
3
1
0
1
2
2
1
0
0
1
1
2
2
1
1
In order to analyse these data in StatsDirectyou should enter them into a workbook and then select Poisson ConfidenceInterval from the Parametric section of the Analysismenu. You have the opportunity to specify a one or two sided interval.
For thisexample:
PoissonEstimates
Poissonanalysis for Reception:
n = 23, mean= 1.173913
Approximatetwo sided 95% CI = 0.773616 to 1.707982
confidenceintervals
Copyright © 1990-2006 StatsDirectLimited, all r医学全.在线ights reserved
Download a free 10 day StatsDirect trial
Menulocation: Analysis_Parametric_Shapiro Wilk.
This functionis a (semi/non)parametric analysis of variance thatdetects a broad range of different types of departure from normality in asample of data.
StatsDirect requires a random sample of between 3 and 5000 data for its Shapiro-Wilk test.
The nullhypothesis of the test is that the sample is taken from a normal distribution,thus P < 0.05 for W rejects this supposition of normality. You should notuse any of the parametric methods with samples for which W is significant.
Most authorsagree that this is the most reliable test for non-normality for small to mediumsized samples (Conover, 1999;Shapiro and Wilk, 1965; Royston, 1982a, 1982b, 1995). Please do notassume that the result of this test is clear evidence of normality ornon-normality, it is just one piece of evidence that can be helpful. Otherinformation, such as the type of distribution found from larger samples of thistype, might also be important.
StatsDirect adjusts the Shapiro-Wilk test for censoreddata. You should use this adjustment when any of your data are censored (i.e.for some observations you only know that the value of X is >Y1 or <Y0 forsome "censoring point" Y). You must know how many observations arecensored, if not then you are dealing with a truncated distribution whichrequires different techniques (Verrill and Johnson,1988). Note that you need enter only the totalnumber of censored data and not censoring information for each data point,the actual data points that you enter should all be uncensored (Royston, 1995).
Example
Test workbook(Parametric worksheet: Penicillin).
Consider thefollowing 30 penicillin yields.
penicillin
0.0987 | 0.0000 |
0.0533 | -0.0026 |
0.0293 | -0.0036 |
0.0246 | -0.0042 |
0.0200 | -0.0114 |
0.0194 | -0.0139 |
0.0191 | -0.0222 |
0.0180 | -0.0333 |
0.0172 | -0.0348 |
0.0132 | -0.0363 |
0.0102 | -0.0363 |
0.0084 | -0.0402 |
0.0077 | -0.0583 |
0.0058 | -0.1184 |
0.0016 | -0.1420 |
To test thesedata for non-normality using StatsDirect you mustfirst prepare them in a workbook column. Alternatively, open the test workbookusing the file open function of the file menu. Then select the Shapiro-Wilk test from the parametric methods section of theanalysis menu. Select the column marked "Penicillin"when prompted for data and enter 0 as the number of censored data.
For thisexample:
Shapiro-Wilk W test for non-normality
Sample name:Penicillin
Uncensoreddata = 30
Censored data= 0
Mean =-0.007033
Standarddeviation = 0.0454
Squares aboutmean = 0.059774
W = 0.892184
P = 0.0054
Sampleunlikely to be from a normal distribution
Here the teststatistic was clearly significant at P = 0.05 which rejects the null hypothesisthat these data are from a normal distribution. In fact, these data were from a2 by 5 factor grouping experiment.
N.B. DoNOT use this test to say that your data are "normally distributed",this assertion is quite wrong. The Shapiro-Wilk testprovides evidence for certain types of "non-normality" it does NOTguarantee "normality".
P values