350 likes | 560 Views
Design of Statistical Investigations. 6. Orthogonal Designs Randomised Blocks II. Stephen Senn. Exp_5 Alternative Analyses. We will now show three alternative analyses of example Exp_5 First two of these are equivalent to the analysis already done
E N D
Design of Statistical Investigations 6. Orthogonal Designs Randomised Blocks II Stephen Senn SJS SDI_6
Exp_5Alternative Analyses • We will now show three alternative analyses of example Exp_5 • First two of these are equivalent to the analysis already done • First is only equivalent because there are only two treatments • Not equivalent for three or more treatments SJS SDI_6
Matched Pairs t-test • Reduce data to a single difference d • per patient • between treatments • Analyse these differences using a t-test for a single sample SJS SDI_6
Matched Pairs t-test (cont) • Under H0, the population mean difference md is zero • Hence a significance test may be based on the statistic SJS SDI_6
Exp_5Matched Pairs t-test SJS SDI_6
Exp_5Calculations SJS SDI_6
Exp_5Matched Pairs Using S-Plus #First split data into two columns #Matched by patient i<-sort.list(patient) data2<-cbind(patient=patient[i],pef=pef[i],treat=treat[i]) pefTREAT<-split(data2[,2],data2[,3]) #Perform matched pairs t-test t.test(pefTREAT$”2", pefTREAT$”1", alternative="two.sided", mu=0, paired=T, conf.level=.95) SJS SDI_6
Exp_5S-Plus Output Paired t-Test data: pefTREAT$"2" and pefTREAT$"1" t = 4.0312, df = 12, p-value = 0.0017 alternative hypothesis: true mean of differences is not equal to 0 95 percent confidence interval: 20.85477 69.91446 sample estimates: mean of x - y 45.38462 SJS SDI_6
Exp_5 using aLinear Model Approach • > fit3 <- lm(pef ~ patient + treat) • > summary(fit3, corr = F) • Call: lm(formula = pef ~ patient + treat) • Residuals: • Min 1Q Median 3Q Max • -42.31 -11.15 1.554e-015 11.15 42.31 • Coefficients: • Value Std. Error t value Pr(>|t|) • (Intercept) 207.3077 21.0624 9.8425 0.0000 • patient1 60.0000 28.7033 2.0904 0.0585 • patient11 135.0000 28.7033 4.7033 0.0005 • etc. • treat 45.3846 11.2584 4.0312 0.0017 SJS SDI_6
Exp_5A Non-Parametric Approach • Wilcoxon signed ranks test • Calculate difference • Ignore sign • Rank • Re-assign sign • Calculate sum of negative (or positive) ranks SJS SDI_6
Exp_5Signed Rank Calculations * = tie arbitrarily broken SJS SDI_6
Exp_5Hypothesis Test • Suppose H0 true • P = 1/2 any difference is positive or negative • 213 = 8192 different possible patterns of - and + • How many produce sum of negative ranks as low as that seen? SJS SDI_6
Possible Assignments of Negative RanksWith Equal or Lower Score • No negative ranks: 1 case • 1,2,3,4,5,6 only: 6 cases • 1+(2,3,4,5): 4 cases • 2+(3,4): 2 cases • 1+2+3: 1 case • Total = 1+6 + 4 +2 +1 = 14 cases • 14/213=0.00171 • Two sided P-value = 2 x 0.00171 =0.0034 SJS SDI_6
Exp_5SPlus Output > wilcox.test(pefTREAT$"1", pefTREAT$"2", alternative = "two.sided", mu = 0, paired = T, exact = T, correct = T ) Wilcoxon signed-rank test cannot compute exact p-value with ties in: wil.sign.rank(dff, alternative, exact, correct) data: pefTREAT$"1" and pefTREAT$"2" signed-rank normal statistic with correction Z = -2.7297, p-value = 0.0063 alternative hypothesis: true mu is not equal to 0 SJS SDI_6
Why the Discrepancy? • P = 0.0034 by hand, 0.0063 SPlus • SPlus is using asymptotic approximation • StatXact gives an accurate calculation StatXact output Exact Inference: One-sided p-value: Pr { Test Statistic .GE. Observed } = 0.0017 Pr { Test Statistic .EQ. Observed } = 0.0005 Two-sided p-value: Pr { | Test Statistic - Mean | .GE. | Observed - Mean | = 0.0034 Two-sided p-value: 2*One-Sided = 0.0034 SJS SDI_6
Orthogonal(See Marriott ADictionary of Statistical Terms) • Mathematical meaning is perpendicular • as in co-ordinate axes • Statistical variates are orthogonal if independent • Experimental design is orthogonal if certain variates or linear combinations are independent • rectangular arrays are orthogonal SJS SDI_6
Randomised Blocks and Orthogonality • Randomised blocks are examples of orthogonal designs • Rectangular arrays • Balanced • Consequences • Treatment sum of squares does not change as blocks are fitted • Design is efficient SJS SDI_6
Orthogonality and Regression SJS SDI_6
Orthogonality and Regression2 SJS SDI_6
Orthogonality and Regression 3 Here we have SJS SDI_6
Orthogonality • Addition of patients has not increased variance multiplier for treatments • Variance is as it would be had patients not been included • “patient” and “treat” are orthogonal • The factors are balanced SJS SDI_6
Exp_6 Another Example of a Two-Way Layout • Classic attempt (Cushny & Peebles, 1905) to investigate optical isomers • Subjects: eleven patients insane asylum Kalamazoo • Outcome: hours of sleep gained • Data subsequently analysed by Student (1908) in famous t-test paper. SJS SDI_6
The Cushny and Peebles Data B=L-Hyosciamine HBr C=L-Hyoscine HBr D=R-Hyoscine HBr SJS SDI_6
Features • Treatments provide one dimension • Patients provide the others • Patients are the “blocks” • Control is no treatment • Main interest is difference between optical isomers • Other treatment is positive control SJS SDI_6
Cushny and Peebles Data SJS SDI_6
Plotting Points • Important to show three dimensions of data • Outcome • Treatment • Block (patients) • This has been done here by using • Patient as a “pseudo-dimension” X • Outcome as the Y dimension • Treatment by colour and symbols SJS SDI_6
Points • Clear difference between treatments and control • Some suggestion of difference to active control • Little suggestion of difference between isomers SJS SDI_6
Exp_6 SPlus Analysis #Analysis of first 10 patients #Cushny and peebles data patient<-factor(rep(c("1","2","3","4","5","6", "7","8","9","10"),4)) treat<-factor(c(rep("A",10),rep("B",10),rep("C",10), rep("D",10))) sleep<-c(0.6,3.0,4.7,5.5,6.2,3.2,2.5,2.8,1.1,2.9, 1.3,1.4,4.5,4.3,6.1,6.6,6.2,3.6,1.1,4.9, 2.5,3.8,5.8,5.6,6.1,7.6,8.0,4.4,5.7,6.3, 2.1,4.4,4.7,4.8,6.7,8.3,8.2,4.3,5.8,6.4) fit1<-aov(sleep~patient+treat) summary(fit1) SJS SDI_6
Exp_6 SPlus Output summary(fit1) Df Sum of Sq Mean Sq F Value Pr(F) patient 9 89.500 9.94444 7.38815 0.0000231769 treat 3 40.838 13.61267 10.11342 0.0001225074 Residuals 27 36.342 1.34600 SJS SDI_6
Calculation of Standard Errors Note that this applies as a consequence of orthogonality The multiplier 2/r is the same whether or not we fit patient in addition to treat Here we have SJS SDI_6
> multicomp(fit1, focus = "treat", error.type = "cwe", method = "lsd") 95 % non-simultaneous confidence intervals for specified linear combinations, by the Fisher LSD method critical point: 2.0518 response variable: sleep intervals excluding 0 are flagged by '****' Estimate Std.Error Lower Bound Upper Bound A-B -0.75 0.519 -1.81 0.315 A-C -2.33 0.519 -3.39 -1.270 **** A-D -2.32 0.519 -3.38 -1.260 **** B-C -1.58 0.519 -2.64 -0.515 **** B-D -1.57 0.519 -2.63 -0.505 **** C-D 0.01 0.519 -1.05 1.070 SJS SDI_6
Questions • Perform a matched pairs analysis comparing B and C and ignoring data from A and D. • Compare it to the pair-wise contrast for B & C obtained above? • Why are the results not the same? • What are the advantages and disadvantages of these approaches? SJS SDI_6