Sta$s$cs & Experimental Design with R Barbara - - PowerPoint PPT Presentation

sta s cs experimental design with r
SMART_READER_LITE
LIVE PREVIEW

Sta$s$cs & Experimental Design with R Barbara - - PowerPoint PPT Presentation

Sta$s$cs & Experimental Design with R Barbara Kitchenham Keele University 1 Quasi-Experiments 2 Quasi-Experiments Experiments where it is


slide-1
SLIDE 1

Sta$s$cs ¡& ¡Experimental ¡Design ¡ with ¡R ¡

Barbara ¡Kitchenham ¡ Keele ¡University ¡

1 ¡

slide-2
SLIDE 2

Quasi-­‑Experiments ¡

2 ¡

slide-3
SLIDE 3

Quasi-­‑Experiments ¡

  • Experiments ¡where ¡it ¡is ¡impossible ¡or ¡unethical ¡to ¡apply ¡

randomiza$on ¡

– When ¡factor ¡of ¡interest ¡cannot ¡be ¡changed ¡

  • E.g. ¡gender ¡
  • University ¡educa$on ¡
  • Within-­‑subject ¡experiments ¡in ¡SE ¡

– Difficult ¡to ¡find ¡large ¡number ¡of ¡qualified ¡par$cipants ¡ – So ¡use ¡individuals ¡as ¡their ¡own ¡control ¡

  • Importance ¡

– Are ¡used ¡to ¡assess ¡impact ¡of ¡program ¡change ¡

  • I.e. ¡major ¡business/social ¡changes ¡ ¡

– In ¡context ¡of ¡SE ¡

  • Adop$on ¡of ¡CMM ¡
  • Change ¡from ¡3GL ¡to ¡OO ¡programming ¡

¡

3 ¡

slide-4
SLIDE 4

Causal ¡Inferences ¡

  • Quasi-­‑experiments ¡must ¡show ¡

– Cause ¡Precedes ¡Effect ¡

  • Quasi-­‑experiments ¡manipulate ¡the ¡treatment ¡to ¡

ensure ¡that ¡it ¡occurs ¡before ¡the ¡effect ¡

  • Same ¡for ¡randomised ¡experiments ¡

– Cause ¡co-­‑varies ¡with ¡Effect ¡

  • Covaria$on ¡is ¡usually ¡established ¡sta$s$cally ¡
  • Same ¡for ¡randomised ¡experiments ¡

– Alterna$ve ¡explana$ons ¡for ¡the ¡effect ¡are ¡ implausible ¡

  • Basic ¡problem ¡for ¡quasi-­‑experiments ¡ ¡
  • Cannot ¡argue ¡based ¡on ¡randomisa$on ¡

4 ¡

slide-5
SLIDE 5

Basic ¡Principles ¡for ¡QE ¡Design ¡

  • Iden$fica$on ¡and ¡study ¡of ¡plausible ¡threats ¡

to ¡internal ¡validity ¡

– What ¡threats ¡could ¡plausibly ¡have ¡caused ¡the ¡

  • bserved ¡rela$onship ¡treatment-­‑outcome ¡ ¡
  • Primacy ¡of ¡control ¡by ¡design ¡

– Adding ¡design ¡elements ¡aims ¡to ¡prevent ¡threats ¡

  • r ¡provide ¡evidence ¡about ¡them ¡
  • Coherent ¡paXern ¡matching ¡

– A ¡complex ¡predic$on ¡made ¡about ¡the ¡outcomes ¡ that ¡few ¡alterna$ve ¡explana$ons ¡can ¡match ¡

5 ¡

slide-6
SLIDE 6

Basic ¡Forms ¡of ¡Quasi-­‑Experiment ¡

  • Type ¡1: ¡Experiment-­‑like ¡studies ¡

– Subjects ¡use ¡different ¡methods ¡under ¡ controlled ¡condi$ons ¡

  • Type ¡2: ¡Large ¡scale ¡surveys ¡of ¡trends ¡

– Interrupted ¡$me ¡series ¡ – Regression ¡Discon$nuity ¡ – Differences ¡in ¡Differences ¡

6 ¡

slide-7
SLIDE 7

Design ¡elements ¡

  • Time ¡

– Most ¡quasi-­‑experiments ¡take ¡place ¡over ¡a ¡$me ¡period ¡

  • Treatment ¡

– A ¡policy ¡or ¡method ¡intended ¡to ¡cause ¡some ¡measurable ¡affect ¡ to ¡change ¡

  • Controls ¡

– Units ¡not ¡receiving ¡the ¡treatment ¡that ¡are ¡matched ¡in ¡some ¡way ¡ to ¡the ¡units ¡receiving ¡treatment ¡

  • Pre-­‑test ¡

– Measurements ¡taken ¡before ¡the ¡treatment ¡condi$on ¡is ¡applied ¡

  • Post-­‑test ¡

– Measurements ¡taken ¡before ¡the ¡treatment ¡condi$on ¡is ¡applied ¡

7 ¡

slide-8
SLIDE 8

Design ¡Variants ¡

  • Post-­‑Test ¡only ¡

– Introduce ¡change ¡then ¡take ¡one ¡ measurement ¡ – Weakest ¡possible ¡design ¡

  • No ¡way ¡of ¡knowing ¡whether ¡anything ¡changed ¡
  • No ¡way ¡of ¡knowing ¡what ¡would ¡have ¡happened ¡

without ¡the ¡treatment ¡

  • All ¡other ¡designs ¡add ¡elements ¡to ¡address ¡

these ¡weaknesses ¡

8 ¡

slide-9
SLIDE 9

Adding ¡Pre-­‑Test ¡Observa$ons ¡

  • Pre-­‑Test-­‑Post-­‑Test ¡

– Ini$al ¡observa$ons ¡as ¡a ¡“control” ¡ – With ¡only ¡one ¡before ¡and ¡aeer ¡measurement ¡the ¡ design ¡is ¡s$ll ¡fairly ¡weak ¡

  • Effect ¡could ¡be ¡associated ¡with ¡some ¡other ¡event ¡
  • SE ¡Quasi-­‑Experiment ¡

– Par$cipants ¡ ¡

  • Volunteers ¡from ¡set ¡of ¡available ¡people ¡

– Read ¡a ¡program ¡and ¡iden$fy ¡defects ¡ – Receive ¡training ¡in ¡defect ¡detec$ng ¡method ¡ – Read ¡another ¡program ¡and ¡iden$fy ¡defects ¡

9 ¡

slide-10
SLIDE 10

Pre-­‑test ¡& ¡Post-­‑test ¡PaXerns ¡

  • Adding ¡more ¡observa$ons ¡and ¡treatment ¡changes ¡

strengthens ¡design ¡

– Pretest-­‑PosXest ¡removing ¡treatment ¡ – Pretest-­‑Post-­‑test ¡Repeated ¡treatment ¡

  • If ¡the ¡observa$ons ¡follow ¡paXern ¡of ¡

interven$ons ¡

– Difficult ¡to ¡argue ¡that ¡they ¡are ¡not ¡related ¡ – But ¡may ¡be ¡vulnerable ¡to ¡a ¡single ¡chance ¡event ¡

10 ¡

slide-11
SLIDE 11
  • Post-­‑test ¡designs ¡with ¡control ¡group ¡but ¡no ¡pre-­‑

test ¡

– Weak ¡because ¡the ¡groups ¡may ¡differ ¡on ¡more ¡than ¡just ¡ treatment ¡

  • SE ¡Experiment ¡Example ¡

– Students ¡volunteer ¡for ¡extra ¡courses ¡on ¡Formal ¡ methods ¡ – Volunteers ¡and ¡non-­‑volunteers ¡compared ¡on ¡ examina$on ¡results ¡ – Results ¡aXributed ¡benefits ¡of ¡Formal ¡methods ¡

  • Adding ¡more ¡pre-­‑ ¡and ¡post-­‑test ¡measures ¡again ¡

strengthens ¡the ¡design ¡

Independent ¡Control ¡Groups ¡

X ¡ O1 ¡ O1 ¡

11 ¡

slide-12
SLIDE 12

Difference ¡in ¡Differences ¡Designs ¡

  • Pre-­‑ ¡and ¡Post-­‑tests ¡with ¡controls ¡
  • Matched ¡groups ¡with ¡

– One ¡group ¡receives ¡interven$on ¡(T) ¡ – Other ¡group ¡doesn’t ¡(C) ¡ – Two ¡$me ¡periods ¡

  • Before ¡Treatment ¡Time ¡0 ¡
  • Aeer ¡treatment ¡Time ¡1 ¡
  • Not ¡a ¡simple ¡two-­‑way ¡analysis ¡

– Treatment ¡effect ¡based ¡on ¡four ¡group ¡means ¡

  • Effect ¡= ¡T1-­‑C1+ ¡(T0-­‑C0) ¡
  • Period ¡2 ¡difference ¡adjusted ¡for ¡Period ¡1 ¡difference ¡

12 ¡

O1 ¡ ¡ ¡ ¡ ¡ ¡ ¡X ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡O2 ¡ O1 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡O2 ¡

slide-13
SLIDE 13

Example ¡

13 ¡

0.50 0.55 0.60

DinD plot

time

mean of abscore 1 ist 1

slide-14
SLIDE 14

Analysing ¡D-­‑in-­‑D ¡designs ¡

  • Can ¡be ¡analysed ¡as ¡a ¡linear ¡combina$on ¡of ¡mean ¡

values ¡

  • Effect ¡= ¡T1-­‑C1+ ¡(T0-­‑C0) ¡ ¡

– Assumes ¡common ¡within-­‑group ¡variance ¡(s2) ¡

  • For ¡independent ¡groups ¡
  • Alterna$vely ¡use ¡regression ¡and ¡dummy ¡variables ¡

– Time ¡(T) ¡is ¡1 ¡if ¡$me ¡period=1 ¡else ¡0 ¡ – Treatment ¡(Tr) ¡is ¡1 ¡for ¡treatment ¡group, ¡0 ¡for ¡control ¡ – Treated ¡group ¡(TG) ¡is ¡1 ¡for ¡treatment ¡group ¡in ¡Time ¡ Period ¡1 ¡else ¡0 ¡

¡

14 ¡

slide-15
SLIDE 15

Cross-­‑Over ¡Designs ¡ ¡

  • When ¡comparing ¡two ¡treatments ¡
  • Each ¡par$cipant ¡exposed ¡to ¡both ¡treatments ¡

– Assignment ¡to ¡order ¡randomized ¡ – Proper ¡analysis ¡removes ¡period ¡effect ¡

  • E.g. ¡general ¡task ¡performance ¡improvement ¡that ¡is ¡

independent ¡of ¡treatment ¡

– S$ll ¡vulnerable ¡to ¡period×treatment ¡interac$on ¡ – Can ¡be ¡improved ¡by ¡addi$onal ¡pre-­‑ ¡and ¡post-­‑ ¡ tests ¡

  • Design ¡is ¡very ¡popular ¡in ¡SE ¡experiments ¡

¡

15 ¡

X1 ¡ O1 ¡ X2 ¡ O2 ¡ X2 ¡ O1 ¡ X1 ¡ O2 ¡

slide-16
SLIDE 16

Cross-­‑Over ¡Model ¡

  • Model ¡based ¡on ¡
  • π ¡the ¡period ¡effect ¡due ¡to ¡general ¡difference ¡between ¡period ¡1 ¡and ¡

2 ¡

  • τ ¡the ¡treatment ¡effect ¡i.e. ¡difference ¡between ¡TA ¡and ¡TB ¡
  • λA ¡and ¡λB ¡the ¡interac$on ¡due ¡to ¡doing ¡A ¡before ¡B ¡and ¡vice-­‑versa ¡– ¡

for ¡analysis, ¡assumed ¡approximately ¡0 ¡

  • μj ¡ ¡the ¡“effect” ¡due ¡to ¡par$cipant ¡j ¡

16 ¡

Par$cipant ¡ Expected ¡Response ¡ Cross-­‑Over ¡ Difference ¡ Period ¡ Difference ¡ Period ¡1 ¡ Period ¡2 ¡ TA-­‑TB ¡ P2-­‑P1 ¡ j ¡ ¡ (Treatment ¡A) ¡ ¡ (Treatment ¡B) ¡ k ¡ ¡ (Treatment ¡B) ¡ ¡ (Treatment ¡A) ¡ Sum ¡ ¡ ¡

slide-17
SLIDE 17

SE ¡Cross-­‑Over ¡Example ¡

¡

17 ¡

Histogram of OOmFP - FPA

OOmFP - FPA Density

  • 10

10 20 30 40 50 60 0.000 0.005 0.010 0.015 0.020 0.025 0.030 10 20 30 40 50

Box plot of Treatment effect of OOmFP

OOmFP-FPA

slide-18
SLIDE 18

Analysis ¡

  • Comparing ¡two ¡FPA ¡versions ¡
  • 20 ¡par$cipants ¡count ¡same ¡document ¡

– 10 ¡used ¡FPA ¡first ¡ – 10 ¡used ¡OOmFPA ¡first ¡

  • Period ¡effect= ¡-­‑0.45 ¡
  • Treatment ¡effect ¡=27.25 ¡

– Use ¡standard ¡“t” ¡test ¡on ¡Cross-­‑over ¡values ¡(i.e. ¡differences) ¡

  • Variance ¡of ¡Cross-­‑over ¡values=259.04 ¡
  • SE ¡treatment ¡effect= ¡3.6 ¡
  • T=7.57 ¡with ¡19 ¡d.f. ¡ ¡Cri$cal ¡Value=2.093 ¡(two-­‑sided, ¡p=0.05) ¡

– Alterna$vely ¡use ¡trimmed ¡mean ¡

  • If ¡concerned ¡about ¡non-­‑normal ¡distribu$on ¡ ¡
  • Not ¡so ¡simple ¡if ¡groups ¡not ¡same ¡size ¡and ¡period ¡effects ¡

significant ¡

18 ¡

slide-19
SLIDE 19

Cross-­‑Over ¡Example ¡

19 ¡

FPA OOmFP 120 130 140 150 160 170

FPA counts for subjects in Cross-Over

Label indicates which treatment was first FPA OOmFP 150 155 160 165 170

OOmFPA counts for subjects in Cross-Over

Label indicates which treatment was first

slide-20
SLIDE 20

Large ¡Scale ¡Interven$ons ¡

  • Interrupted ¡Time-­‑Series ¡

– Based ¡on ¡taking ¡observa$ons ¡at ¡many ¡points ¡before ¡and ¡ aeer ¡interven$on ¡ – Es$mate ¡Regression ¡lines ¡before ¡and ¡aeer ¡interven$on ¡ – Look ¡for ¡difference ¡in ¡slope ¡or ¡intercept ¡

  • S$ll ¡may ¡be ¡a ¡confounding ¡effects ¡

– Need ¡to ¡be ¡listed ¡and ¡accounted ¡for ¡ – Changes ¡in ¡measurement ¡process ¡could ¡affect ¡results ¡

  • As ¡always ¡adding ¡extra ¡elements ¡to ¡design ¡can ¡help ¡

– E.g ¡ploung ¡another ¡variable ¡that ¡the ¡treatment ¡should ¡ NOT ¡effect ¡

20 ¡

slide-21
SLIDE 21

SE ¡Example ¡CMM ¡Introduc$on ¡

21 ¡

1984 1986 1988 1990 1992 1994 1996 1998 1.0 1.5 2.0 2.5 3.0 3.5

Productivity per year (Effort per unit size)

Year Productivity

slide-22
SLIDE 22

Interrupted ¡Time ¡Series ¡Model ¡

  • Analyses ¡is ¡based ¡on ¡a ¡specific ¡model ¡

– Groupj ¡is ¡dummy ¡variable ¡iden$fying ¡observa$ons ¡ record ¡before ¡(Group1=0) ¡or ¡aeer ¡(Group2=1) ¡the ¡ interven$on ¡

  • β1 ¡>0 ¡implies ¡a ¡change ¡in ¡intercept ¡

– Yeari ¡(or ¡any ¡appropriate ¡$me ¡period) ¡iden$fies ¡ when ¡the ¡observa$ons ¡were ¡recorded ¡

  • β2 ¡>0 ¡implies ¡a ¡common ¡regression ¡line ¡in ¡the ¡two ¡$me ¡

periods ¡

– TP2Yeari ¡refers ¡to ¡each ¡year ¡in ¡the ¡second ¡$me ¡ period ¡(i.e. ¡when ¡the ¡dummy ¡variable ¡Group=1) ¡

  • Β3>0 ¡implies ¡the ¡slope ¡of ¡the ¡regression ¡line ¡is ¡different ¡for ¡

the ¡second ¡$me ¡period ¡

22 ¡

slide-23
SLIDE 23

Common ¡Problems ¡with ¡ Interrupted ¡Time ¡series ¡

  • Gradual ¡rather ¡than ¡abrupt ¡changes ¡

– So ¡change ¡is ¡not ¡clear ¡cut ¡

  • Delayed ¡effects ¡

– Effects ¡take ¡place ¡some ¡$me ¡aeer ¡change ¡ introduced ¡

  • Short ¡$me ¡series ¡
  • Insufficient ¡data ¡points ¡for ¡sta$s$cal ¡

analysis ¡

23 ¡

slide-24
SLIDE 24

SE ¡Example ¡

  • Assessing ¡the ¡quality ¡of ¡SE ¡experiments ¡and ¡quasi-­‑

experiments ¡

  • Inves$gated ¡whether ¡there ¡was ¡an ¡improvement ¡

– Due ¡to ¡text ¡book ¡& ¡ar$cles ¡in ¡early ¡2000’s ¡

  • Used ¡two ¡measures ¡

– Subjec$ve ¡assessment ¡ – Quality ¡scale ¡based ¡on ¡9 ¡ques$ons ¡

  • Evaluated ¡ar$cles ¡from ¡TSE,IST,JSS ¡and ¡ESJ ¡

– 70 ¡ar$cles ¡in ¡all, ¡ – Assessed ¡separately ¡by ¡three ¡different ¡people ¡

  • Selected ¡papers ¡from ¡years ¡1993 ¡– ¡2010 ¡

– OmiXed ¡years ¡2003-­‑2005 ¡ ¡ – Because ¡those ¡would ¡be ¡a ¡period ¡of ¡transi$on ¡

24 ¡

slide-25
SLIDE 25

Outcome ¡of ¡Experiment ¡

  • Analysis ¡based ¡on ¡average ¡score ¡for ¡each ¡paper ¡
  • Only ¡b1significantly ¡different ¡from ¡0 ¡
  • So ¡common ¡trend ¡before ¡and ¡aeer ¡2004 ¡

25 ¡

5 10 15 20 25 30 1992 1996 2000 2004 2008 2012 Year Total ¡Score

slide-26
SLIDE 26

Regression ¡Discon$nuity ¡

  • Experimenter ¡assigns ¡par$cipants ¡to ¡two ¡
  • r ¡more ¡treatment ¡condi$ons ¡with ¡a ¡post-­‑

test ¡

– The ¡assignment ¡procedure ¡is ¡based ¡on ¡some ¡ measurement ¡taken ¡prior ¡to ¡treatment ¡

  • Control ¡and ¡Treatment ¡group ¡outcomes ¡

ploXed ¡against ¡post-­‑test ¡measure ¡

26 ¡

OA ¡ C ¡ X ¡ O2 ¡ OA ¡ C ¡ O2 ¡

slide-27
SLIDE 27

Regression ¡Discon$nuity ¡

27 ¡ 4.5 5.0 5.5 6.0 6.5 7.0 7 8 9 10 Assignment Variable Score Post test score) 4.5 5.0 5.5 6.0 6.5 7.0 7 8 9 10 Assignment Variable Score Post test score)

Before ¡ Aeer ¡

slide-28
SLIDE 28

Summary ¡

  • Quasi-­‑experiments ¡

– Not ¡second ¡class ¡ci$zens ¡ – Oeen ¡impossible ¡to ¡do ¡randomized ¡experiments ¡

  • Par$cularly ¡in ¡field ¡
  • With ¡appropriate ¡designs ¡

– Quasi-­‑experiments ¡can ¡be ¡extremely ¡reliable ¡

  • Oeen ¡need ¡specialised ¡analysis ¡to ¡match ¡the ¡

specialised ¡design ¡

  • Also ¡need ¡to ¡consider ¡how ¡to ¡argue ¡that ¡

results ¡can ¡be ¡generalised. ¡

28 ¡