# 11/30/04Excel Function ReviewSlide 1 of 20 Review of Excel Functions PubH5414 Biostatistical Method I Section 4 By SoonYoung Jang.

## Presentation on theme: "11/30/04Excel Function ReviewSlide 1 of 20 Review of Excel Functions PubH5414 Biostatistical Method I Section 4 By SoonYoung Jang."— Presentation transcript:

11/30/04Excel Function ReviewSlide 1 of 20 Review of Excel Functions PubH5414 Biostatistical Method I Section 4 By SoonYoung Jang

11/30/04Excel Function ReviewSlide 2 of 20 Measure of Location Mean(unit) = average(data range) Median(unit) = median(data range) or = quartile(data range, 0.5) Mode(unit) = mode(data range) To get Geometric Mean 1. lnx = ln(x) /* transform */ 2. geoMean(unit) = exp(average(data range of lnx))

11/30/04Excel Function ReviewSlide 3 of 20 Measure of Spread Variance (unit 2) = var(data range) Std.Dev. (unit) = stdev(data range) or = sqrt(variance) range = max(data range) – min(data range) n = count(data range) Coefficient of Variation (CV %) = stdev(data range) / average(data range) * 100

11/30/04Excel Function ReviewSlide 4 of 20 Confidence Interval of Mean known σ Assume  =0.05, xbar = average(data) Std.Err(se) = σ / sqrt(n) critical value/coefficient at lower/upper cL = normsinv(α / 2) = - cU cU = norminv(1- α / 2) (1-  )% confidence interval: xbar ± cU*se

11/30/04Excel Function ReviewSlide 5 of 20 Another way to construct CI for normal distribution Lower(unit) = norminv(0.025, xbar, se) Upper(unit)= norminv(0.975, xbar, se)

11/30/04Excel Function ReviewSlide 6 of 20 Confidence Interval of Mean unknown σ, large sample Assume =0.05, xbar = average(x) seHat = stdev(data) / sqrt(count(data)) critical valus (coefficients) cL = normsinv(/2, xbar, seHat) = - cU cU = normsinv(1- /2, xbar, seHat) (1- )% confidence interval: xbar ± cU*seHat

11/30/04Excel Function ReviewSlide 7 of 20 Assume =0.05, xbar=average(x) seHat = stdev(data) / sqrt(count(data)) df = n – 1 critical value (coefficient) c = tinv(,df) (1- )% confidence interval: xbar ± c*seHat Confidence Interval of Mean unknown σ, small sample

11/30/04Excel Function ReviewSlide 8 of 20 Confidence Interval of Geometric Mean Assume =0.05 Transform : lnx = ln(x), unknown σ xbar = average(data of lnx) seHat = stdev(data of lnx) / sqrt(n) Same as before, get critical values of cL, cU (1- )% confidence interval: 1.exp(xbar ± cU*seHat) 2.exp(xbar) * exp(± cU*seHat)

11/30/04Excel Function ReviewSlide 9 of 20 Test of Mean unknown σ, large sample Assume =0.05 Specify H0 and H1 e.g.) H0: mu = 30 1.Two-Sided (≠) 2.One-Sided Test( ) se = stdev(data) / sqrt(n) Test Statistics z = (xbar – 30) / se

11/30/04Excel Function ReviewSlide 10 of 20 Test of Mean with known σ or large sample Pvalue 1.Method 1  2 * (1 – normsdist(abs(z))) if two-sided  1 – normsdist(z) if H1: mu > 30  normsdist(z) if H1: mu < 30 2.Method 2  2 * (1 – normdist(abs(xbar), 30, se, TRUE))) if two-sided  1 – normdist(xbar, 30, se, TRUE) if H1: mu > 30  normdist(xbar, 30, se, TRUE) if H1: mu < 30

11/30/04Excel Function ReviewSlide 11 of 20 Test of Mean Conclusion Reject the null hypothesis 1.Using critical values –xbar < norminv(1-α/2, 30, se) if two-sided test –xbar 30 –xbar < norminv(α, 30, se) if H1: μ < 30 2.Using pvalues pvalue < α for all types of alternative hypotheses

11/30/04Excel Function ReviewSlide 12 of 20 Test of Mean unknown σ, small sample Assume =0.05 Specify H0 and H1 (e.g.)H0: mu = 30 se = stdev(data) / sqrt(n) Test Statistics: t = (xbar – 30) / se with df = n-1 Pvalue = tdist(abs(t), df, 2) if two-sided Pvalue = tdist(abs(t), df, 1) if one-sided Conclusion: Reject H0 if t < tinv(α /2, df) when two-sided if t < tinv(α,df) when one-sided OR pvalue < α

11/30/04Excel Function ReviewSlide 13 of 20 Two Sample Comparison Pair-Mathed Data Assume =0.05 Specify H0 and H1 (e.g) H0: μDiff = 0 Transform diff = x1 – x2 xbar = average(data range of diff); se = stdev(data range of diff) / sqrt(n) Test Statistics: t = (xbar – 30) / se with df = n-1 Pvalue = tdist(abs(t), df, 2) if two-sided Pvalue = tdist(abs(t), df, 1) if one-sided  If large sample, use z statistics

11/30/04Excel Function ReviewSlide 14 of 20 Two Sample Comparison Independent Data Assume =0.05, Equal Variance (σ 2 1 = σ 2 2 ) Specify H0 and H1 (e.g.) H0: mu1 = mu2 Two-Sided or One-Sided Test( ) Unknown σ, small sample pooled_var = ((n 1 -1)*var(x 1 ’s) + (n 2 -1)*var(x 2 ’s))/(n 1 + n 2 -2) se = sqrt(pooled_var*(1/n 1 + 1/n 2 )) Test Statistics t = (xbar 1 – xbar 2 ) / se with df = n 1 + n 2 - 2 Pvalue = tdist(abs(t), df, 2) if two-sided Pvalue = tdist(abs(t), df, 1) if one-sided  If large sample, use z statistics

11/30/04Excel Function ReviewSlide 15 of 20 Confidence Interval of Proportion Assume =0.05 = x / n se = sqrt( * (1 - ) / n) Critical value at lower/upper cL = normsinv(α/2,, se) = - cU cU = normsinv(1- α/2,, se) (1- )% confidence interval: [ + cL*se, + cU*se]

11/30/04Excel Function ReviewSlide 16 of 20 Test of Proportion Assume =0.05 Specify Hypotheses H0: π = p 0 (p 0 is some constant for example, 0.5) two-sided or one-sided ( ) = x / n, se = sqrt(p 0 *(1-p 0 )/n) Test Statistics z = ( – p 0 ) / se Get Pvalue for two-sided test pvalue = 2*(1-normsdist(abs(z))) or pvalue = 2*(1-normsdist(, p 0, se,TRUE))  for one-sided test, refer test of mean

11/30/04Excel Function ReviewSlide 17 of 20 Proportion Comparison with pair-matched data Assume =0.05 Specify Hypotheses : H 0 and H a H0: X and Y are not associated (independent) H1: X and Y are associated. Given 2*2 table YESNOtotal YESabr1 NOcdr2 totalc1c2n

11/30/04Excel Function ReviewSlide 18 of 20 Test Statistics z = (b-c) / sqrt(b+c) or χ 2 = z^2 Pvalue = 2 * (1 - normsdist(abs(z))) Pvalue = chidist(x 2, 1) Conclusion : as before  Final conclusion must be written in the given scientific context Proportion Comparison with pair-matched data

11/30/04Excel Function ReviewSlide 19 of 20 Proportion Comparison with two Independent samples Assume =0.05 Specify H 0 and H 1 (e.g) H 0 : π 1 = π 2 Two-Sided or One-Sided Test( ) p 1 = x 1 / n 1 p 2 = x 2 / n 2 Pooled Proportion under H 0 p = (x 1 +x 2 ) / (n 1 +n 2 ) se = sqrt(p*(1-p)*(1/n 1 +1/n 2 )) Test Statistics 1. z = (p 1 – p 2 ) / se 2. χ 2 = n*(bc-ad)^2 / (r 1 *r 2 *c 1 *c 2 ) if two-sided with given 2*2 table Compute Pvalue using the function normsdist(z) or normsdist(p 1 - p 2, 0, se, TRUE) chidist(x 2, 1)

11/30/04Excel Function ReviewSlide 20 of 20 Linear Relationship between two variables Correlation coefficient r = correl(xrange, yrange) Coefficient of determination R 2 = r^2 Test of linear relationship H 0 : ρ = 0 vs. H 1 : ρ ≠ 0 se = sqrt((1 – R 2 ) / (n – 2)) Test Statistics t = r / se with df = n-2 Pvalue = tdist(t, df, 2)  Micellaneous b 0 = intercept(yrange, xrange) b 1 = slope(yrange, xrange) predicted value = b 0 + b 1 * x

Download ppt "11/30/04Excel Function ReviewSlide 1 of 20 Review of Excel Functions PubH5414 Biostatistical Method I Section 4 By SoonYoung Jang."

Similar presentations