" Exercise 2.3
Statistical Methods in Biology: Design and Analysis of Experiments and Regression
by S.J. Welham, S.A. Gezan, S.J. Clark & A. Mead (2014)
Chapman & Hall/CRC Press, Boca Raton, Florida. ISBN: 978-1-4398-0878-8
Version 1, 16/09/2014 "
" Set working directory - change to location of your data file "
\SET [WORKINGDIRECTORY='d:/stats4biol/data/']
" Read data from working directory "
FILEREAD [NAME='PROTEIN.DAT'; IMETHOD=read] FGROUPS=no
" Calculate change in amount of protein "
CALCULATE Change=After-Before
" Perform test directly "
TTEST Y1=Change
" Rest of file verifies t-test calculations "
" Calculate mean and variance of change "
CALCULATE mean=MEAN(Change)
CALCULATE var=VARIANCE(Change)
PRINT mean,var; dec=3,4
" Verify calculations "
CALCULATE N = NOBSERVATIONS(Change)
" Verify mean "
PRINT SUM(Change)/N; DECIMALS=3
" Verify variance "
CALCULATE Deviation = Change-mean
PRINT SUM(Deviation**2)/(N-1); DEC=4
" Calculate t-statistic"
CALCULATE t = mean/sqrt(var/N)
PRINT t; DEC=3
" Get 5% critical value for two-sided test
= 97.5th quantile of t distribution with 11 df "
CALCULATE critical = EDT(0.975;N-1)
PRINT critical; DEC=3
" Get observed significance level for test
= proportion of t distribution with 11 df > abs(t) or < -abs(t) "
CALCULATE P = 2*CUT(ABS(t);N-1)
PRINT P; DEC=3
" End of File "