24 BMEN E4110 Lecture8

Download as pdf or txt
Download as pdf or txt
You are on page 1of 60

BMEN E4110

Biostatistics for Engineers


Lecture 8 | 2 October 2024
Overview

• Hypothesis testing for proportions


• Z-test and Chi-squared test
• Risks & odds
Overview

• Hypothesis testing for proportions


• Z-test and Chi-squared test
• Risks & odds
Loading…
Analysis of proportions: Summary statistics for population data

Claire’s sample data Xn = 0

Xn = 1 Proportion of ‘left-handed’ = Sum of 1’s


Total number of datapoints

Left-handed Right-handed
two subclasses
Population data Xn = 0

Xn = 1
• N = total datapoints in the population
• M = number of in population 1
• N-M = number in population 2
Left-handed Right-handed
Analysis of proportions: Summary statistics for population data

Population data
Xn = 0

Xn = 1
Loading…


N = total datapoints in the population
M = number of in population 1
• N-M = number in population 2

Left-handed Right-handed
Analysis of proportions: Summary statistics for population data

Population data
Xn = 0

• N = total datapoints in the population


Xn = 1 • M = number of in population 1
• N-M = number in population 2
-given
Left-handed Right-handed
value
Mexu
Analysis of proportions: Summary statistics for population data

Ex. 1

• N = total datapoints in the population


• M = number of in population 1
• N-M = number in population 2

Left-handed Right-handed
Analysis of proportions: Summary statistics for population data

Ex. 2
P =

O=

200 ts
poin 100 Loch
N 100 • N = total datapoints in the population
For :GS • M = number of in population 1
• N-M = number in population 2

Left-handed Right-handed
Analysis of proportions: Summary statistics for population data

Ex. 3

• N = total datapoints in the population


• M = number of in population 1
• N-M = number in population 2

Left-handed Right-handed
scan change p to
highestpossiblenumbe
a
Analysis of proportions: Summary statistics for population data

Ex. 1 Ex. 2 Ex. 3

Xn = 0
G
=

Xn = 1 Xn = 0
Xn = 1 Xn = 1 Xn = 0

Left-handed Right-handed Left-handed Right-handed Left-handed Right-handed



highest degree of dispensi an
Standard deviation of category data

What do Ex.1 – Ex. 3 live on this curve? EX2


A

ex3 Loading…
Highest variability
(equal chance of left-handed and right-handed)
I
No variability No variability
(no uncertainty) (no uncertainty)

ex1p
Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Claire’s sample data

How should Sandra plan data


collection for this new experiment?

Left-handed Right-handed
Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Claire’s sample data

How should Sandra plan data


collection for this new experiment?

Left-handed Right-handed should eqe d


Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Claire’s sample data

How should Sandra plan data


collection for this new experiment?

Left-handed Right-handed
Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Sandra’s sample data

How should Sandra plan data


collection for this new experiment?
Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Sandra’s sample data

How should Sandra plan data


collection for this new experiment?

Improved Same
-
E datu
must inchoe another colleges
Hypothesis testing for proportions

• Now that we understand how to use an analysis of proportions to learn about Claire’s data
(e.g., proportions of left-handed vs right-handed patients our BCI experiment)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?

Sandra’s sample data

How should Sandra plan data


collection for this new experiment?

Improved Same
Hypothesis testing for proportions

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
How should Sandra plan data collection for this new experiment?
Sandra’s sample data
Left-handed data Right-handed data
(n = 100) (n = 100)
plan
data
collection

Improved Same Improved Same


Hypothesis testing for proportions: Case study 2

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
How should Sandra plan data collection for this new experiment?
Sandra’s sample data
Left-handed data Right-handed data
(n = 100) (n = 100)

Improved Same Improved Same


Hypothesis testing for proportions: Case study 2

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
• H0: pleft-handed = pright-handed

Sandra’s sample data


Left-handed data Right-handed data
(n = 100) (n = 100)

Improved Same Improved Same


n = 11 n = 89 n = 10 n = 90
Hypothesis testing for proportions: Case study 2

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
• H0: pL = pR
thesame.
& ask isproportion improvence
of
Sandra’s sample data
Left-handed data Right-handed data
(n = 100) (n = 100)

Improved Same & Improved Same


n = 11 n = 89 n = 10 n = 90

sound
Hypothesis testing for proportions: Case study 2 (USA)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
• H0: pL = pR

Sandra’s sample data


Left-handed data Right-handed data
(n = 100) (n = 100)

Improved Same Improved Same


n = 11 n = 89 n = 10 n = 90
Hypothesis testing for proportions: Case study 2 (Thailand)

• Sandra: Do left-handed patients experience a greater chance of improvement with our BCI
system?
• H0: pL = pR

Sandra’s sample data


Left-handed data Right-handed data
(n = 100) (n = 100)

Improved Same Improved Same


n = 20 n = 80 n=6 n = 94
Hypothesis testing for proportions: Case study 2 (Thailand)

• Is the difference in the Sandra’s Thailand sample big enough to infer a difference in the
underlying population?

Left-handed data Right-handed data


(n = 100) (n = 100)

Improved Same Improved Same


n = 20 n = 80 n=6 n = 94
Overview

• Hypothesis testing for proportions


• Z-test and Chi-squared test
• Risks & odds
Hypothesis testing for proportions: Case study 2 (Thailand)

• Is the difference in the Sandra’s Thailand sample big enough to infer a difference in the
underlying population?
• Two tests we can use:
• Z-test
• Chi-squared test

Left-handed data Right-handed data


(n = 100) (n = 100)

Improved Same Improved Same


n = 20 n = 80 n=6 n = 94
Hypothesis testing for proportions: Case study 2 (Thailand)

• Is the difference in the Sandra’s Thailand sample big enough to infer a difference in the
underlying population?
• Two tests we can use:
• Z-test
• Chi-squared test

Left-handed data Right-handed data


(n = 100) (n = 100)

Improved Same Improved Same


n = 20 n = 80 n=6 n = 94
Case study 2 (Thailand): Z-test

• H0: pL = pR us
results are
similar
Case study 2 (Thailand): Z-test

• H0: pL = pR
Loading…
I t
• Compute z-value: pp
a
Case study 2 (Thailand): Z-test

• H0: pL = pR

• Compute z-value:
Case study 2 (Thailand): Z-test

• H0: pL = pR

• Compute z-value:

Sample-wide
proportion
Case study 2 (Thailand): Z-test

• H0: pL = pR

• Compute z-value: Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
Case study 2 (Thailand): Z-test

Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
t-distribution

Probability distribution function (pdf)


depending a

d
dage
Frieden
impacts
distribute

Key features: shape (heavier tails), degree of


freedom (v), centered at zero t-value (no. SD from the mean)

wikipedia.org
normal distribution
z-distribution is a t-distribution with infinite degrees of freedom

Probability distribution function (pdf) more data point,


I should approach
more
normal

Key features: shape (heavier tails), degree of


freedom (v), centered at zero z-value (no. SD from the mean)

wikipedia.org
Case study 2 (Thailand): Z-test

Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
we can locker critical z value
Case study 2 (Thailand): Z-test

Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
z-distribution is a t-distribution with infinite degrees of freedom

no night,
magdipt
as
nat
z-distribution is a t-distribution with infinite degrees of freedom
z-distribution is a t-distribution with infinite degrees of freedom

X = 0 . OS

8
-

alway met crit


Case study 2 (Thailand): Z-test

Gives us an idea of how


extreme our sample is under H0

Sample-wide Okay, but how extreme are


proportion Sandra’s samples?
1 96
Zarit = .
US A Thailand sample
improve same total

improve Sam a
to

800 694100
all 21 179 200
all 26 174 200

= = 0 11
.
-= = 02
.

n= = 0 10 .

Pr = 0. = 0

:impo

Zu
=
2 . 94

improve same total

Y
all
Case study 2 (Thailand): Z-test

• H0: pL = pR

• Compute z-value: Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
,CT Ho
when 2Zorit
• How extreme are Sandra’s samples?: What’s the chance of observing the computed z-value?
z-distribution is a t-distribution with infinite degrees of freedom

z-value = 2.94

p = 0.003
*
exact p-value
can get
to put it together
z-distribution is a t-distribution with infinite degrees of freedom

z-value = 2.94

p = 0.003

• The chance of getting a


sample as extreme as the
one Sandra got is 0.003 (if
we assume H0).

• We can infer that there’s a


difference in BCI-induced
improvement in left-handed
vs. right-handed patients.
z-distribution is a t-distribution with infinite degrees of freedom

z-value = 2.94

p = 0.003

• The chance of getting a


sample as extreme as the
one Sandra got is 0.003 (if
we assume H0).

• We can infer that there’s a


difference in BCI-induced
improvement in left-handed
vs. right-handed patients.
Chi-squared(x2) to i

have not done this yet


• Compare actual counts vs. those expected under the H0.
I

• Expected counts computed based on column and row totals.


the hull
flexb (more than two
under
-
Chi is
groups
hypothesis
• Compare actual counts vs. those expected under the H0.
• Expected counts computed based on column and row totals.

• Statistic is a function of squared differences in counts.


Overall Total

Degrees of freedom = (r-1) x (c-1)


it
improve same total

h
C =

002
100
-
·

200
&
174
13
Case study 2 (Thailand): Z-test

Gives us an idea of how


extreme our sample is under H0

Sample-wide
proportion
• H0: Handedness and BCI-induced improvement are independent.
• This means there is no association between handedness and BCI-induced improvement.
The proportion of patients experiencing improvement (‘improved’) or no improvement
(‘same’) is the same for both left-handed and right-handed groups.
Any observed differences (e.g., more left-handed patients showing improvement) are due
to random chance.

• In other words, H0: The distribution of BCI-induced improvement is the same for left-handed
and right-handed patients
DF = (r-1) x (c-1)

findcrit of Chi-still
DF = (r-1) x (c-1)
z-value = 2.94

p = 0.003

• The chance of getting a


sample as extreme as the
one Sandra got is 0.003 (if
we assume H0).

• We can infer that


handedness and BCI-
induced improvement are
associated (not
independent).
z-value = 2.94

p = 0.003
Overview

• Hypothesis testing for proportions


• Z-test and Chi-squared test
• Risks & odds

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy