Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nemours Biomedical Research Statistics March 26, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility.

Similar presentations


Presentation on theme: "Nemours Biomedical Research Statistics March 26, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility."— Presentation transcript:

1 Nemours Biomedical Research Statistics March 26, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility

2 Nemours Biomedical Research Hypothesis Testing (Quantitative variable)

3 Nemours Biomedical Research One vs two sided tests One-sided –One direction of effect (e.g. mean efficacy of treatment group is greater than the mean efficacy of placebo group) –Greater power to detect difference in expected direction Two-sided –Effect could be in either direction (e.g. mean efficacy of treatment group is not equal to the mean efficacy of placebo group) –More conservative

4 Nemours Biomedical Research One vs two sided tests One groupTwo groups One sided A single mean differs from a known value in a specific direction. e.g. mean > 0 or median > 0 Two means differ from one another in a specific direction. e.g., mean 2 < mean 1 median 2 < median 1 Two sided A single mean differs from a known value in either direction. e.g., mean ≠ 0 median ≠ 0 Two means are not equal. E.g., mean 1 ≠ mean 2 median 1 ≠ median 2

5 Nemours Biomedical Research Single group sample - one sample t- test Test for value of a single mean E.g., to see if mean SBP of all AIDHC employees is 120 mm Hg Assumptions –Parent population is normal –Sample observations (subjects) are independent

6 Nemours Biomedical Research Single group sample-one sample t- test Formula Consider a sample of size n from a normal population with mean µ and variance σ 2, then the following statistic is distributed as Student’s t with (n-1) degrees of freedom.  x is the sample mean and s is the sample standard deviation

7 Nemours Biomedical Research One group sample - Sign Test (Nonparametric) Use: (1) Compares the median of a single group with a specified value (instead of single sample t-test). Hypothesis: H 0 :Median = c H a :Median  c Test Statistic: We take the difference of observations from median (x i - c). The number of positive difference follows a Binomial distribution. For large sample size, this distribution follows normal distribution. (Rcmdr does not have a default sign test)

8 Nemours Biomedical Research One group sample: Rcmdr demonstration Load data default to Rcmdr and then select- Statistics->Means->single sample t-test. From this window, select variable (e.g.hgt), alternative hypothesis, value for null hypothesis (e.g. 50). data: data$hgt t = -2.6925, df = 59, p-value = 0.009217 alternative hypothesis: true mean is not equal to 50 95 percent confidence interval: 46.50166 49.48460 sample estimates: mean of x 47.99313

9 Nemours Biomedical Research Two-group (independent) samples - two-sample t-statistic Use –Test for equality of two means Assumptions –Parent population is normal –Sample observations (subjects) are independent.

10 Nemours Biomedical Research Two-group (independent) samples - two-sample t-statistic Formula (two groups) –Case 1: Equal Population Standard Deviations: The following statistic is distributed as t distribution with (n1+n2 -2) d.f. The pooled standard deviation, n1 and n2 are the sample sizes and S 1 and S 2 are the sample standard deviations of two groups.

11 Nemours Biomedical Research Two-group (independent) samples - two-sample t-statistic Formula (two groups) –Case 2: Unequal population standard deviations The following statistic follows t distribution. The d.f. of this statistic is,

12 Nemours Biomedical Research Two-sample (independent) t-statistic Statistics->Means-> Independent sample t test From the small window, select response variable (e.g. PLUC.pre), select group variable (e.g. sex) and select alternative hypothesis type (e.g. two sided), confidence level (e.g..95), and Assume equal variance (e.g yes) Two Sample t-test data: PLUC.pre by sex t = -0.4866, df = 58, p-value = 0.6284 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -1.4004136 0.8527181 sample estimates: mean in group f mean in group m 9.606148 9.879995

13 Nemours Biomedical Research Two-group (independent) samples- Wilcoxon Rank-Sum Test (Nonparametric) Use: Compares medians of two independent groups. Corresponds to t-test for 2 Independent sample means Test Statistic: Consider two samples of sizes m and n. Suppose N=m+n. Compute the rank of all N observations. Then, the statistic, W m = Sum of the ranks of all observations of the first variable (size m).

14 Nemours Biomedical Research Two-group (independent) samples- Wilcoxon Rank-Sum Test (Nonparametric) Statistics-> Nonparametric tests->Two sample Wilcoxon test -> select response variable (e.g. PLUC.pre), group variable (e.g. sex), Alternative hypothesis (e.g. two sided), Type of Test (e.g. exact). Wilcoxon rank sum test data: PLUC.pre by sex W = 439, p-value = 0.8776 alternative hypothesis: true location shift is not equal to 0

15 Nemours Biomedical Research Two-group (matched) samples - paired t-statistic Use: Compares equality of means of two matched or paired samples (e.g. pretest versus posttest) Assumptions: –Parent population is normal –Sample observations (subjects) are independent

16 Nemours Biomedical Research Two-group (matched) samples - paired t-statistic Formula –The following statistic follows t distribution with n-1 d.f. Where, d is the difference of two matched samples and S d is the standard deviation of the variable d.

17 Nemours Biomedical Research Paired t-test:Rcmdr demo Statistics -> Means->paired t-test-> pick First variable (e.g. PLUC.pre), pick second variable (e.g. PLUC.post), Alternative Hypothesis (e.g. Two sided), Confidence level (e.g. 0.95). data: data$PLUC.pre and data$PLUC.post t = -5.4953, df = 59, p-value = 8.739e-07 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.275342 -1.526769 sample estimates: mean of the differences -2.401056

18 Nemours Biomedical Research Two-group (matched) samples Wilcoxon Signed-Rank Test (Nonparametric) USE: –Compares medians of two paired samples. Test Statistic –Obtain Differences of two variables, D i = X 1i - X 2i –Take Absolute Value of Differences, D i –Assign Ranks to absolute values (lower to higher), R i –Sum up ranks for positive differences (T + ) and negative differences (T - ) Test Statistic is smaller of T - or T + (2-tailed)

19 Nemours Biomedical Research Two-group (matched) samples Wilcoxon Signed-Rank Test (Nonparametric) Statistics -> Nonparametric tests ->Paired sample Wilcoxon test -> select first variable (e.g. PLUC. Pre) and second variable (e.g. PLUC.post), Alternative hypothesis (e.g.two sided), type of test (e.g. normal approximation) median(data$PLUC.pre - data$PLUC.post, na.rm=TRUE) # median difference [1] -2.283691 > wilcox.test(data$PLUC.pre, data$PLUC.post, alternative='two.sided', + paired=TRUE)

20 Nemours Biomedical Research Comparing more than two independent samples: F statistic (Parametric) Use: –Compare means of more than two groups –Test the equality of variances.

21 Nemours Biomedical Research Comparing > 2 independent samples: F statistic (Parametric) Let X and Y be two independent Chi-square variables with n 1 and n 2 d.f. respectively, then the following statistic follows a F distribution with n 1 and n 2 d.f. Let, X and Y are two independent normal variables with sample sizes n 1 and n 2. Then the following statistic follows a F distribution with n 1 and n 2 d.f. Where, s x 2 and s y 2 are sample variances of X and Y.

22 Nemours Biomedical Research Comparing > 2 independent samples: F statistic (Parametric) Hypotheses: H 0 : µ 1 = µ 2 =…. =µ n H a : µ 1 ≠ µ 2 ≠ …. ≠µ n  Comparison will be done using analysis of variance (ANOVA) technique.  ANOVA uses F statistic for this comparison.  The ANOVA technique will be covered in another class session.

23 Nemours Biomedical Research More than two independent samples: One-way analysis of variance (ANOVA) Create a new variable: PLUC.chng=PLUC.post – PLUC.pre (Data-> Manage variable in active dataset-> Compute new variable -> New variable name (on the left): PLUC.chng = PLUC.post – PLUC.pre (on the right). For ANOVA: Statistics -> means -> One-way ANOVA -> Select model, response variable (e.g. PLUC.chng), group variable (e.g. grp), pairwise comparison of means.

24 Nemours Biomedical Research AnovaModel.5 <- aov(PLUC.chng ~ grp, data=data) Df Sum Sq Mean Sq F value Pr(>F) > summary(AnovaModel.5) grp 2 93.64 46.82 4.5839 0.01426 * Residuals 57 582.17 10.21 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > numSummary(data$PLUC.chng, groups=data$grp, statistics=c("mean", "sd")) mean sd n 1 1.023051 3.686748 20 2 2.132612 2.509201 20 3 4.047504 3.279040 20 More than two independent samples: One-way analysis of variance (ANOVA) Contd.

25 Nemours Biomedical Research threegrp <- aov(PLUC.chng ~ grp, data=data) > summary(threegrp) Df Sum Sq Mean Sq F value Pr(>F) grp 2 93.64 46.82 4.5839 0.01426 * Residuals 57 582.17 10.21 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > numSummary(data$PLUC.chng, groups=data$grp, statistics=c("mean", "sd")) mean sd n 1 1.023051 3.686748 20 2 2.132612 2.509201 20 3 4.047504 3.279040 20 More than two independent samples: One-way analysis of variance (ANOVA) Contd.

26 Nemours Biomedical Research More than two independent samples: One-way analysis of variance (ANOVA)

27 Nemours Biomedical Research More than two groups: Nonparametric Kruskal-Wallis Test Compares median of three or more groups or (means of ranks of three or more groups) Rcmdr Demo: Statistics -> Nonparametric tests ->Kruskal-Wallis test and then select response and group variables etc. > kruskal.test(PLUC.chng ~ grp, data=data) Kruskal-Wallis rank sum test data: PLUC.chng by grp Kruskal-Wallis chi-squared = 6.5452, df = 2, p-value = 0.03791

28 Nemours Biomedical Research Proportion Tests Use –Test for equality of two Proportions E.g. proportions of subjects in two treatment groups who benefited from treatment. –Test for the value of a single proportion E.g., to test if the proportion of smokers in a population is some specified value (less than 1)

29 Nemours Biomedical Research Proportion Tests Formula –One Group: –Two Groups:

30 Nemours Biomedical Research Proportion Test Statistics-> proportions -> single sample (e.g.sex) or two sample-> Select, variable, Alternative hypothesis, null hypothesis, Confidence Level, Type of test. >.Table sex f m 30 > binom.test(rbind(.Table), alternative='two.sided', p=.5, conf.level=.95) Exact binomial test data: rbind(.Table) number of successes = 30, number of trials = 60, p-value = 1 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.368062 0.631938 sample estimates: probability of success 0.5

31 Nemours Biomedical Research Chi-square statistic USE –Testing the population variance σ 2 = σ 0 2. –Testing the goodness of fit. –Testing the independence/ association of attributes Assumptions –Sample observations should be independent. –Cell frequencies should be >= 5. –Total observed and expected frequencies are equal

32 Nemours Biomedical Research Chi-square statistic Formula: If x i (i=1,2,…n) are independent and normally distributed with mean µ and standard deviation σ, then, If we don’t know µ, then we estimate it using a sample mean and then,

33 Nemours Biomedical Research Chi-square statistic For a contingency table, we use the following chi- square test statistic,

34 Nemours Biomedical Research Chi-square statistic Male O(E) Female O(E) Total Group 19 (10)11 (10)20 Group 28 (10)12 (10)20 Group 311 (10)9(10)20 30 60

35 Nemours Biomedical Research Chi-square statistic – calculation of expected frequency To obtain the expected frequency for any cell, use: Corresponding (row total X column total) / grand total E.g: cell for group 1 and female, substituting: (30 X 20 / 60) = 10

36 Nemours Biomedical Research Chi-square statistic:Rcmdr demonstration Statistics->Contingency tables -> Two way table -> Pick row and column variable, select type of cell percentage you want (e.g. row), hypothesis tests (e.g. chi-square) > rowPercents(.Table) # Row Percentages grp sex 1 2 3 Total Count f 30.0 40.0 30.0 100.0 30 m 36.7 26.7 36.7 100.1 30 >.Test <- chisq.test(.Table, correct=FALSE) >.Test Pearson's Chi-squared test data:.Table X-squared = 1.2, df = 2, p-value = 0.5488

37 Nemours Biomedical Research Thank you


Download ppt "Nemours Biomedical Research Statistics March 26, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility."

Similar presentations


Ads by Google