0% found this document useful (0 votes)
139 views136 pages

41-47 Introductory Biostatistics Notes - Osmosis

Uploaded by

040974
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views136 pages

41-47 Introductory Biostatistics Notes - Osmosis

Uploaded by

040974
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 136

decimalpoint

exist a

yontorionsonly

hi
Gorica

ftp.y
Thitating

É
Biosta s cs

During course:

 Analysis of one scien fic publica on in medicine, and an oral presenta on about it -


class 18
~
 Oral presenta on of independent work in pairs must have a

statistical analysis
Exam:
30MC 30 min
~
,

 MCQ with theore cal and prac cal ques ons (worth 50%) #O CHAT GPT

 Prac cal work (worth 50%) CHATYES GPT

Reliable scien fic literature:

 h ps://www.ncbi.nlm.nih.gov/pubmed/
 h ps://scholar.google.lv/
 h ps://bestprac ce.bmj.com/info/evidence-informa on/
 h ps://www.cochrane.org
Lesson 1

Sta s cs: a branch of mathema cs dealing with the collec on, organiza on, analysis, interpreta on and
presenta on of data.

Popula on: every member of a group, a set of similar items or


events which is of interest for some ques on or experiment

Sample: the selected subset of individuals from within the


popula on, used to es mate characteris cs of the popula on as
a whole

 Sampling varia on: the extent to which the value of a


sta s c differs across a series of samples (different
samples from the same popula on will incur different
results)
 The sample should be as representa ve as possible and
include the essen al elements of the popula on
 Randomiza on: the act or process of ordering or selec ng people, things, or places in a random
way, as in a sample or experiment, especially in order to reduce bias and interference by
irrelevant variables
 Control group: the standard to which comparisons are made in an experiment

Sta s cal methods: 2 parts

 Descrip ve sta s cs: a set of brief descrip ve coefficients that


summarize a given data set representa ve of an en re or of MiF
proportion

sample popula on ex :
-
# of

mean
people
age
in group

o Provide simple summaries about the sample and the


observa ons which were made
o Percentage
o Mean: “average”
E
when to use each :

o Median: the value that is sequen ally in the middle


o standard devia on:
 Inferen al sta s cs hypothesis reaches conclusions extend beyond how the is tested , that the Law data alone

ow Dispersion analysis
o Factor analysis X

owe Correla on analysis


o Nonparametric sta s cs ~

o Covariance sta s cs -

data types data measurement scales


categorical (qualitative)
scale BMT
e
g ,
-

nominal
g

·
:

g w/ predetermined answers

number functions as a label for variable


ordinal
a
e g BMI category (e g underweight)
multinomial dichotomous
.,
.
.
.,
,
count ,
percentage
demographics out come factors
marital status do you have an HTN diagno is " M F
nominal
"

e g or
overweight subjects
.
., , ,

e .

g .

Ordinal pain scale


likert
·
:

e .

g ..
VAS ,
scale
a rating scale used to measure
no mean values opinions, attitudes, or
behaviors
median value only stage of cancer
count , percentage
19R

numerical
(quantiform abnormene
2 .
I
distribution

· interval

· ratio
descriptive stats parameters
I numerical

3 has decimal points


which is logical
and
need for
verification
and proof
enter data on a
single worksheet wherever possible
gather data in excel first before using
, SPSs

spss can
only open one worksheet at a time
names :

sass will only lead one now X


length of therapy X MTX-length of tx

G2 MTX A/B
colors aren't lead
by spss

preparing data :

law data
only divide
into years months age w/ decimals
, ,

pestation : XX 37 Koplus
no words e .

g . F =

0 , M =
1

w column for was
vcolumn for days
codify worded data
be consistent 3 ,

accurate a/ data
entry
Descriptive statistics
Biostatistics
RSU, The Statistics Unit
Descriptive Statistics
Descriptive statistics involves summarizing and organizing the
data so they can be easily understood.

Descriptive statistics includes:


• Frequency distribution,
• Measures of central tendency,
• Measures of variability (spread),
• Measures of normality.
Frequency distribution
Frequency distribution
The frequency distribution describes the number of times each
value of a variable occurs in a sample. Shown mostly either - % or
relative frequency.

Most commonly
used for categorical
data, especially
nominal data.
Frequency distribution
Percentage
Relative frequency

0 0,2 0,4 0,6 0,8 1,0

https://www.spss-tutorials.com/spss-stacked-bar-charts-percentages/
Frequency Distribution

• Bars should be ordered in ascending or descending order


(exception: for ordinal data or if order contains meaning).
• Pie charts  for nominal data only with 2 to 5 slices, stacked
bars are better idea.
• Show percentage instead of count for proportions if there are 2
or more categories, especially if size of groups is different.
Careful with Pie charts
A B C

1 2 3 4 5 1 2 3 4 5
1 2 3 4 5

25 25 25

20 20 20

15 15 15

10 10 10

5 5 5

0 0 0
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Count or %? Count %
N Year male female male female
60 1st year 20 40 33 67
30 3rd year 20 10 67 33

Male and female participants, count Male and female participants, %


45
40 70
35 60
30
50
25
40
20
30
15
20
10
5 10

0 0
male female male female
1st year 3rd year 1st year 3rd year
Frequency Distribution
Age Group Frequency Relative frequency/
(Count) Percentage
0-19 0 0/30…0%
20-29 2 2/30 = 0.0667 = 6.67%
30-39 5 5/30 = 0.1667 = 16.67%
40-49 6 6/30 = 0.2000 = 20.00%
50-59 8 8/30 = 0.2667 = 26.67%
60-69 5 5/30 = 0.1667 = 16.67%
70-79 4 4/30 = 0.1333 = 13.33%
Total: 30 100%
Frequency Distribution

needed Histogram Cumulative histogram


forQuantitative
data
Population Pyramid
Measures of central tendency
Measures of central tendency

if the symmetrical Ag if the difference


is in median
data reallybig
all values 00008088
should beequal Sothern twill chase
oralmestegar dear
especiallyMcanadlesian morestable
thinMean
Arithmetic Mean vs Median
Employees Wage 1​ Wage 2​
A​ € 700​ € 700​
B​ € 720​ € 720​
C​ € 760​ € 760​
D​ € 800​ € 800​
E​ € 840​ € 840​
F​ € 860​ € 860​
G​ € 950​ € 10 000​
Average wage (Mean) € 804.29​ € 2097.14​
Average wage (Median) € 800.00​ € 800.00​
Which is Better to Use?

Mode - Most often patients stay for 10 days in the hospital after surgery.
Median - 50% of the patients stay for 15 days or less in the hospital after surgery.
Mean - On average patients stay for 20 days in the hospital after surgery.

In this example, Mode is useful since hospitals can estimate the bed occupancy days. Median is useful for
the patients to evaluate duration of hospital stay. Mean is not useful because of extreme outliers!
Measures of variability
Measures of variability (spread)
P H N emo N
• Range (Max - Min)
• Variance howspreadthe data
• Standard deviation (SD) Tarrant
• Interquartile range
σ^2 = Σ(xi - μ)^2 / n
We
Where: E
σ^2 represents the variance.
xi represents each individual data point.
μ represents the mean (average) of the
dataset.
n is the total number of data points in the
dataset.
Standard deviation

https://www.mathsisfun.com/data/standard-deviation.html
Standard deviation and Variance Xieachdatapoint
gon nfr.name on
now
waste Me Fmean
5141001 theman 65ps E sigmasignasuz
head you no push
a an no mayst
SDisenessinto
next SD e
one's
glans

Variance = s2
Percentiles
Percentiles splits the data into 100 equal parts.
Quartiles
Quartiles splits the data into quarters (four equal parts):
Q0  zero quartile; the same as minimum value and 0th
percentile;
Q1  first quartile; the middle number between the minimum
value and the median of the data set, the same as 25th
percentile;
Q2  second quartile; the same as median and 50th percentile;
Q3  third quartile; the middle value between the median and
the maximum value of the data set, the same as 75th
percentile;
Q4  fourth quartile; the same as maximum value and 100th
percentile;
IQR = Q3 - Q1 = interquartile range.
Boxplot

Data

Data
sorted in
ascending 1, 2, 2, 2, 4, 5, 6, 8, 8, 9, 9, 10, 12, 12
order median from Mediayform
Min Max
Box plot
IQR = interquartile range
Q3
Box Plot & Histogram
https://openlab.citytech.cuny.edu/math1272statistics-fall2013-ganguli/2013/09/30/example-boxplots-olympic-athletes/
Summary
How to describe data?
Nominal Ordinal Quantitative
Males/Females Stage of the cancer Pain scale No normal Normal distribution
(I-IV) (0 to 10) distribution
Count, Count, Median, Median, Mean, SD or
Percentage Percentage IQR IQR Median, IQR

or
How to write the result
Follow APA/AMA style or recommendations from publications
how to write the result correctly. Here are some examples.

Data are represented as means (M) and standard deviations (SD):


The sample as a whole was relatively young (M 19.2 years, SD
3.4).
The average age of students was 19.22 (SD 3.45) years.
How to write the result
Data are represented as medians and interquartile ranges (IQR):
• Median weight was 72 (Q1; Q3 60 to 87) kg.
• After 8 weeks, weight (median and interquartile range) was 72
(60 to 87) kg.

Q1 = 25th percentile = P25


Q3 = 75th percentile = P75
Practical work
Practical Work – IBM SPSS Statistics
Analyze → Descriptive Statistics → Frequencies
Analyze → Descriptive Statistics → Explore
Analyze → Tables → Custom Tables
Frequency distribution

Select the variable(s)


you want to analyze,
Percentage without make sure «Display
missing values. frequency tables» is
checked, and click «OK».

Percentage with missing values.


Central tendencies and measures of spread I A
Select statistics you want
to obtain, click «Continue»
and then «OK».

Select the variable(s) you want to analyze, make


sure «Display frequency tables» is NOT checked.
Central tendencies and measures of spread I B

Number of participants analysed


Number of missing values

Use «Split File»


function to obtain
First quartile
Median
descriptive statistics
Third quartile for separate groups.
Central tendencies and measures of spread II A

Select the variable(s) you want to


analyze.

In case you need, select the


variable you want to use as a
grouping variable (to divide
variables from «Dependent list» in
two or more groups).
Central tendencies and measures of spread II B

Choose «Percentiles»
in order to obtain
values of quartiles.
Central tendencies and measures of spread II C
Check the number of valid and
missing values. Analyzing multiple
variables at the same time, only
those participants will be included
where all values in all variables are
valid.

First quartile,
median, third
quartile.
Frequencies for multiple choice questions

«Yes» is coded as «1» and «no» is coded as «0».


Frequencies for multiple choice questions
Select variables you Type in the number which is
want to analyze. coded for condition present.

Write in new
name for the
whole variable
set, click «Add»
and «Close».

Open again
«Multiple
response», and
now option
«Frequencies»
are available.
Frequencies for multiple choice questions

Percent calculated Percent calculated from the total


Move the name of
from the total amount of participants. Can exceed
the variable set to
amount of answers. 100%. Participants who did not
window «Table(s)
select any of options are not
for:» and click «OK».
included.
Do I know this?
• What is meant by a frequency distribution? How can I calculate
relative frequency?
• How to calculate and when to use arithmetic mean, mode, and
median?
• How to calculate and when to use percentiles, quartiles, range,
variance, and standard deviation?
• What information can be red from histogram and boxplot?
wegonna usevalidprecentnotprecut presentindude
missing
ones
Spgg
Analyze Descriptivestatics frequency nominal
O 95
came Orser ordinal data
first onlymedian
Quantitative

tabs areonlyfor frequencydistribution


cross
ordinalnominal data countedprecentage
y

Row FI w
ne me
É
axisx a pis
a
staff

a
i
a memo
on

Charts p
l
on d Ageo f perron int
Skewness measures the symmetry or
lack of symmetry in a dataset.
g
Kurtosis measures the thickness or
thinness of the tails of a distribution.

wear
M
on is
I

asclosetozeroisbetterstewnessbetter
than
kurtosis

outcome
age

i
cause
grouping any
nominations
ascountry
Hypothesis Testing and
Qualitative Data Analysis
Biostatistics
RSU, The Statistics Unit

Hypothesis Testing

What is Hypothesis? Why We Need Hypothesis Testing?


•Research hypothesis is scientific
assumption, which is a logical and
plausible, but needs for verification and 20 patients studied:
proof. • 10 received new drug
•Statistical hypothesis, or sometimes
• 10 used placebo
called confirmatory data analysis has
the aim - to make decisions about the
general population using random data Time to recovery (days):
of the sample(s). • With new drugs: 12, 11, 10, 9, 16, 10, 8, 12, 13, 14;
•Hypothesis is based on a probability • With placebo: 18, 11, 10, 8, 7, 15, 14, 17, 11, 13.
theory and has a degree of certainty
that is less than 100%.
Why We Need Hypothesis Testing? Why We Need Hypothesis Testing?
18

Average time to recovery 16 12.4 – 11.5 = 0.9 days


• with drug:
14

11.5 days 12 Is it enough?

Days to recovery
12,4
11,5

• with placebo: 12.4 days


10

6
If the difference would be 7 days?
4 (With placebo 11.5 and with drugs
2

0
4.5 days)?
New drug Placebo

Research hypothesis: Use of new drugs for the treatment of the Is it enough now?
disease shortens the time to recovery. Where to draw the line to tell the
Is this information enough to compare average time to difference is significant?
recovery?

Histogram Bellshape symmetricalsinglepeakcentral


Why We Need Hypothesis Testing? Statistically Significant Difference
Difference between the average recovery times of the two
groups may be:
• statistically significant (believe that one group has
recovered more quickly) or
• not statistically significant (despite the fact that one
group at the average has shorter recovery time, we can
not say that this group really recovered faster; the
difference is due to chance).
Most of the time data from both samples overlap. How to tell is
there a difference between mean values caused by independent In order to answer such questions we do hypothesis testing.
variable?
Steps of Hypothesis Testing
1. Define the null hypothesis and the alternative hypothesis.
2. Choose the level of significance.
3. Choose the appropriate test.
4. Calculate the test statistic and corresponding p-value.
5. Reject or fail to reject the null hypothesis.

Steps of Hypothesis Testing

1. Null Hypothesis (H0) Alternative (Alternate) Hypothesis


H0: Mean1 = Mean2

Example:
White blood cell count is not
diferent in patients
with lung cancer treated with
chemotherapy or radiation.
H0 – null hypothesis
Ha – alternative hypothesis

http://www.socialresearchmethods.net/kb/stat_t.htm https://www.slideshare.net/NirajanBam/hypothesis-testing-38588210
Wgggwwhere wedon'tknow
whichdirection
b e p
Alternative (HA or H1) Hypothesis One-tailed vs Two-tailed me
mostly
Yant usedfor
that
inmedicine willbe
Two sided/tailed
White blood cell count is statistically different in patients with
lung cancer treated with chemotherapy or radiation.
toy author what
https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faq-
what-are-the-differences-between-one-tailed-and-two-tailed-
tests/
the
result

One sided/tailed
White blood cell count in patients with lung cancer treated with
chemotherapy is significantly higher than for patients treated
with radiation.
Or
White blood cell count in patients with lung cancer treated with
chemotherapy is significantly lower than for patients treated
with radiation.

2. Level of Significance () 3. The Choice of the Approprite Test


The level of significance is defined as the probability of rejecting •What do I want to analyze (differences/relationship/something
a null hypothesis by the test when it is really true. else)?
•Measurement scale of the data (nominal, ordinal or
quantitative)?
90% level of confidence  = 1 - 0.90 = 0.10 •Dependent or independent samples?
95% level of confidence  = 1 - 0.95 = 0.05 •How many samples?
99% level of confidence  = 1 - 0.99 = 0.01 •Does my data meet all assumptions for the specific test I chose?

Level of significance is chosen by a scientist before the research.


Ho nullhypothesis is accepted
I
if Pvalue coos thereis
significance Stastisticly
4. Test statistic and P-value One sample t-test:
P-value HAistrue
4.1. Each test have a formula that calculates the test statistic – •P-value = the probability of getting the observed value of t or a
an indicator of the extent of differences between compared
units. Example with the one sample t-test. more extreme value by chance, if the null hypothesis is true.
25 patients participated in the study, with mean (SD) value of •P-value: as a probability of H0 being “true”
BMI = 25,3 (5,1). Scientists in another 95% 2,5%
country published similar research with mean BMI 27,0.
More likely observation (simplified explanation). 2,5%
Reject null Do not reject Reject null
hypothesis null hypothesis hypothesis
4.2. Appropriate form of the distribution
is selected (for degrees of freedom in Two-tailed
•If p-value ≤ , then reject the H0.

Probability density
data) that shows the likelyhood of p-value
the difference between •If p-value > , then do not
two means being not significant.
Very un-likely
4.3. Two-tailed p-value (shaded observation
Very un-likely
observation
reject the H0.
t-value Observed
area) is the probability of an (observed value
observed (or more extreme) result data point)
assuming that the null hypothesis is In this example critical t-value is 2.06.
true. -1.67 +1.67 -2.06 +2.06

EY e Beta agha's
5. Reject or fail to reject Type I and Type II Errors
• Or we can say that P-value is probability of the difference being • Choosing 95% confidence level, there may be a 5% risk that
gained due to chance. the null hypothesis is rejected wrongly – type 1 error
(α=0,05).
•If  = 0.05:
• There may be a situation where the null hypothesis is false,
1
H0 is not rejected but it is not rejected – type 2 error (significance level β).
Conclusion – the difference is not statistically
significant • Decision to reject or fail to reject H0 is based only on α.
P-value

0.05 Not rejected H0 Rejected H0


H0 is rejected and HA is accepted
Conclusion – the difference is statistically H0 is true Correct Error type I
significant (There is no effect) conclusion (Alpha)
0
H0 is false Error type II Correct
(The effect is significant) (Betha) conclusion
Type I and Type II Errors Hypothesis testing step by step I
H0: The drug is not effective. 1. Define the null hypothesis and alternative hypothesis.
Null hypothesis: There is no difference in time to recovery between placebo and
Data: Mean SBP value before taking drugs = 143 (SD 17) mmHg, new-drug groups.
but after = 137 (SD 19) mmHg. Alternative hypothesis: There is statistically significant difference in time to
Error type I: Rejecting H0 and stating that this drug is effective. recovery between placebo and new-drug groups.

2. Choose the level of significance (maximum error type I probability acceptable) 


Not rejected H0 Rejected H0
Alpha () = 1 - Confidence level. For example, 1 – 95% = 5% or 0.05.
H0 is true Correct Error type I
(There is no effect) conclusion (Alpha) 3. Choose the appropriate test. (Will learn throughout the course.)
H0 is false Error type II Correct
(The effect is significant) (Betha) conclusion

Hypothesis testing step by step II Hypothesis testing step by step III


4. Calculate the test statistic (amount of arguments against the null hypothesis) and 5. Reject or fail to reject the null hypothesis.
corresponding p-value (error type 1 probability).  Read it from the SPSS output.
Placebo New drug Placebo New drug If p>0.05: For example, p=0.524, then we have 52.4% chance for error type 1 – falsly
Mean (X) 12.4 11.5 Mean (X) 16.6 11.5 reject null hypothesis (Step 1). It is more than we are ready to accept (Step 2). Not
SD (s) 3.2 2.4
enough arguments to reject null hypothesis, we fail to reject it. Conclusion: There is no
SD (s) 3.7 2.4
statistically significant difference (name the arguments from Step 4 - the test statistic
t-value -0.649 t-value -4.047
and p-value) in recovery time between groups.
p-value 0.524 p-value 0.001
If p<0.05: For example, p=0.001, then we have 0.1% chance for error type 1 – falsly
reject null hypothesis (Step 1). It is less than maximum we chose to accept (Step 2).
There is enough arguments to reject the null hypothesis. Conclusion: there is a
statistically significant difference (name the arguments from Step 4 - the test statistic
and p-value) in recovery time between groups.
Can I proove H0 is true?
Conclusions "I can't reject H0" and "I can accept H0" are not the
same.
H0=All swans are
white.
A - I don't have
enough proof to
reject H0,
B - I have enough
Specifics in Hypothesis Testing proof to reject H0.

Power Power
•Statistical power is the likelihood that a study will detect an •Statistical power is affected chiefly by the size of the effect and
effect when there is an effect there to be detected. If statistical the size of the sample used to detect it. Bigger effects are easier
power is high, the probability of making a Type II error, or to detect than smaller effects, while large samples offer greater
concluding there is no effect when, in fact, there is one, goes test sensitivity than small samples.
down. Power = 1- β. •Usually it's requred to have power not less than 0.8 or 80% and
•Typically used type II errors: is choosed before the study.
β = 0.20 •Sometimes power is asked to calculate for results that are not
β = 0.10 statistically significant.
β = 0.05
https://www.statisticsteacher.org/2017/09/15/what-is-power/
https://effectsizefaq.com/2010/05/31/what-is-statistical-power/

Clinicalsignificance otherfactorsremoving
effects
aslongsamplesize bigger Pvaluewill besmaller
butsmallersamplebiggerPvalue
Sample Size
How to Calculate Sample Size for Different Study Designs in
Medical Research?
Jaykaran Charan and Tamoghna Biswas
Indian J Psychol Med. 2013 Apr-Jun; 35(2): 121–126.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3775042/

Depends on design of the study and the measurement scale of


the variable of interest.

https://wnarifin.github.io/ssc_web.html

Tests of Normality
https://onlinecourses.science.psu.edu/stat100/book/export/html/698
Tests of Normality Tests of Normality
“The normality tests are supplementary to the graphical Keep in mind that tests of normality are not perfect, use them
assessment of normality. The main tests for the assessment of together with other methods.
normality are Kolmogorov-Smirnov (K-S) test, Lilliefors corrected In SPSS you can find Kolmogorov-Smirnov and Shapiro-Wilk test.
K-S test, Shapiro-Wilk test, Anderson-Darling test, Cramer-von Shapiro-Wilk test is mostly recommended as the best choice for
Mises test, D’Agostino skewness test, Anscombe-Glynn kurtosis testing the normality of data.
test, D’Agostino-Pearson omnibus test, and the Jarque-Bera test.”
• H0 = The shape of the actual data
distribution is the same as for theoretical
normal distribution. (Sample comes from
normally distributed population.)
• H1 = The shape of the actual data
distribution is not the same as for
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3693611/ theoretical normal distribution.

Tests of Normality Tests of Normality


Shapiro-Wilk test is used to check normality, conclusion: Pulse A
Is normally distributed (p = 0.999), Pulse B is not normally
distributed (p<0.001).
Practical Work
•Normality testing with Kolmogorov-Smirnov and Shapiro-Wilk
test.
•Write 1 null hypothesis and alternative hypothesis.

Practical work

Difference between proportions


Used for data measured in nominal and ordinal measurement
scale - data you describe with count and/or frequencies.
Only the count can be used, not percentages, proportions,
Qualitative Data Analysis means, etc.

Biostatistics
RSU, The Statistics Unit
Difference between proportions 2x2 and RxC tables
Independent samples:
Pearson's chi-squared test/
Paired samples:
McNemar's test
Rhi 2x2 table
crosstabsn
Smoker
RxC table Y.toiggc Oral health
Eigg
Fisher's exact test Yes No
Poor Fair Good

Gender Female Gender Female

Male Male

Tables with >2


cells are called
RxC tables.

fisherFreemanHatto
exactest

Two Samples Chi-squared Test

*Count is not the


same because one
male has not
answered the
Pearson's Chi-squared (χ2) test question about
smoking.
When the difference becomes statistically Chi-squared value
significant? Expected count =
row totals * column totals / sample size
Smokers Nonsmokers
Females =150*42/270 =150*228/270
Males =120*42/270 =120*228/270
Expected counts are the projected
frequencies in each cell if the null
hypothesis is true (no association
between the variables).

t
Chi-squared vs Fisher's Exact Test Chi-squared vs Fisher's Exact Test
You can use Chi-squared test if:
• 80% expected values  5
• All expected values  1 If ≥1, you can use
chi- square test
results.
Otherwise use Fisher's Exact test. If <1, you need to

j
use Fisher's Exact
Test results.

If the percentage is ≤20, you can use chi-square test results,


If the percentage is >20, you need to use Fisher's Exact Test results.

test symbol d f d test statusthe


X Chisquare p valuewith
Two Samples Chi-squared Test Two Samples Chi-squared Test Select «Observed»
count, you can add
Select variables you «Expected» count
want to analyze, as well.
choosing which one will
be shown in rows, and Select the way
which – in columns. how percentages
will be calculated
(what number will
be considered as
100%).

Choose «Adjusted
standardized» to
gain additional
information.

association
Chi-squared Test
Chey g Fisher's Exact test for R x C tables
H0: There is no association between
gender and smoking.
HA: There is association between
gender and smoking.

Conclusion: 18.3% of males


are smoking, compared to Tables with
only 13.3% of females. The more than 2x2
association of gender and cells Fisher’s
smoking is not statistically Exact test need
significant, Chi-squared test, to be chosen
χ2(1,N=270)=1.269, p=0.260. separately.
Adjusted residuals Adjusted Residuals for R x C tables
Is the marital status
Adjusted Residuals show relative
associated with the trouble
difference between observed count
falling asleep?
and expected count. Higher values
show more expressed difference. Cells with adjusted
«+» Positive values – observed count residual ≥ 2 is contributing
higher than expected count. to significance of p-value.
«-» Negative values – observed count Conclusion: there is higher
lower than expected count. percentage of people with
trouble falling asleep
Conclusion: Females tend to be non-smokers and tend not to be among single participants,
smokers; males tend to be smokers and tend not to be non- as compared to married
smokers. participants.

Strength of association Strength of Association


•“Phi” – for 2 x 2 table fernand
0.1 = small effect, 0.3 = medium effect, 0.5 = large effect.

•“Cramer’s V” – for R x C table (more than 2 x 2).


Effect size estimation depends on degrees of freedom (df).

Degrees of Freedom = (c - 1)(r - 1) = 2(2) = 4


c – number of columns, r – nomber of rows
To estimate the strength of association between two variables,

Kendell'stan B
choose “Phi” and “Cramer’s V”.
ordinal
Strength of Association Conclusion
Only 18,5% of those who do not
eat breakfast have gastritis, as
compared to 73,3% of those who
don’t eat breakfast. This
association between habit of
eating breakfast and having
gastritis is statistically significant
(chi-squared test,
χ2(1,N=42)=12,286, p<0,001) and
shows large effect (Phi = 0,541).

http://www.real-statistics.com/chi-square-and-f-distributions/effect-size-chi-square/

McNemar's Test
Test for qualitative data, repeated samples. Often used to
estimate the effectiveness of the treatment.
•H0: Proportion of non-smokers before intervence = Proportion
of non-smokers after intervence
•H1: Proportion of non-smokers before intervence ≠ Proportion
of non-smokers after intervence

McNemar's Test
proportion
McNemar's Test McNemar's Test
• 25 (53.2%) non-smokers and 22
(46.8%) smokers started the research.
• After the intervention the count of
non-smokers reached 36 participants
(76.6% of 47), the count of smokers
decreased to 11 participants (23.4%
of 47).
• 16 smokers quit smoking, bet 5 non-
smokers started to smoke.
• There was a statistically significant
difference in the proportion of non-
smokers pre- and post-intervention
(p=0.027).

McNemar's Test Practical Work


•Pearson's Chi-squared (χ2) test or Fisher's Exact test where
appropriate.
•Example with McNemar's test

Choose percentage
from the total
amount of
participants.
Chart builder & Categorical Data I Chart builder & Categorical Data II

Choose the
type and
subtype of Drag and drop
the plot you variables from the
Click «OK», if you have assigned want to list to defined
proper measurement scales for use. places.
your variables in the «Variable
View».

Chart builder & Categorical Data Do I know this I?


•Can I define these terms: null hypothesis, alternative
hypothesis, test statistic, P-value, significance level?
Choose between count •How the P-value is used to make a decision about rejecting or
and percentage. not rejecting the null hypothesis?
Specify how you •What are Type I and Type II errors?
want to calculate
percentage, and
•How to interpret results of tests of normality?
click «Apply» and
«OK».
Do I know this II?
•What is observed count and expected count in chi-squared
test?
•When Chi-squared test can be used?
•When Fisher's Exact test can be used?
•When McNemar’s test can be used?
Correlation and Regression
Analysis
(Linear regression)
Biostatistics
RSU, The Statistics Unit
Correlation Analysis
all are
quartitare No groups are involved

Correlation
tell how close these ants to eat
Correlation is a statistical technique
that can show whether and how
strongly pairs of variables are related.
When we have two variables we can
ask about the degree to which they
co-vary.

Correlation Between
Total Mental Toughness (MT) and
Medicine Ball Throw (MBT)
Performance.
Nota Bene!

CORRELATION DOES NOT IMPLY CAUSATION!


Correlation, not Causation

https://prometejs.wordpress.com/2012/11/15/sokolade-un-nobela-premija-korelacija-un-celonsakariba/
Correlation, not Causation
Correlation coefficient
1 co O
• Computation of the correlation IN s
coefficient results in a number d.ve
between -1.00 and 1.00.
• The number can be positive or
negative.
• Picture represents perfect linear
correlation.
Positive and Negative Correlation
Negative Correlation
Negative correlation does not mean the result is bad by meaning.

(High)

(Low)
Strength of the linear relationship
The description of
correlation coefficient is
differently used in various
fields of sciences. More
detailed is better in https://statistics.laerd.com/statistical-guides/pearson-correlation-coefficient-statistical-guide.php

medicine, and use it


together with the value of
correlation coefficent
always.

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3576830/#R4
Non-linear Correlation

https://opentextbc.ca/researchmethods/chapter/describing-statistical-relationships/

welcome linear and


non linear correlation
https://www.freecodecamp.org/news/learn-how-to-improve-your-linear-models-8294bfa8a731/
Plot your data!
Plot your data before
interpretation of numerical values
to check if numbers represent
valid information (exclusion – data
in ordinal measurement scale in
some cases).
thisnetof
Explore your data!

Subsets of data can show different situation than the whole data
set. Explore your data to avoid misleading conclusions (Simpson’s
paradox).
Correlation and the Range of Data
For all ages r = −0.77, for 18- to 24-year-olds (in the blue box) r = 0.

Use all the data you have to calculate correlation coefficient,


otherwise the sample is not random anymore.
https://opentextbc.ca/researchmethods/chapter/describing-statistical-relationships/
P-value in Correlation
H0: There is no relationship between both variables (r = 0).
HA: There is a relationship between both variables (r  0).

If  = 0.05:
1
H0 is not rejected
Conclusion – the correlation is not statistically
significant
P-value

0.05
H0 is rejected and HA is accepted
Conclusion – the correlation is statistically
significant
0
P-value in Correlation
• If the sample size is small, r=0,846
correlation has to be p=0,358
stronger to be statistically
significant.
• In large samples correlation
can be weak and it still
might be statistically r=0,141
significant. p=0,035
Pearson's and Spearman's correlation coefficient
Iinear correlation
Pearson's
Spearman's correlation coefficient
coefficient

weighther ears
ghaseing
Both variables are quantitative, Both variables are One or both variables are
and both are normally quantitative but one or both ordinal.
distributed. In the scatter-plot
no non-linearity is observed,
are not normally distributed,
N < 30. In the scatter-
Fix
no outliers. N ≥ 30. plot relationship is
nonlinear or with outliers.
nonlinear
Pearson Correlation Coefficient
• Two variables should be measured at the interval or ratio level.
• There is a linear relationship between your two variables.
• There should be no significant outliers.
• Variables should be approximately normally distributed.
• Random samples are used.
• Independent samples (no manipulation with one of the variables,
and only one measurement from each subject) are used.
• Sample size > 30.

(If you want to asses how the same thing is assessed, using two
different methods, look for interclass correlation.)
Pearson Correlation Coefficient

r=0,40 r=0,70

It doesn't mean you are allowed to delete all


outliers. Choose nonparametric methods instead!
https://statistics.laerd.com/statistical-guides/pearson-correlation-coefficient-statistical-guide-2.php
Correlation in IBM SPSS Select variables you
want to analyze.

Choose the
appropriate
coefficient
and click
«OK».
Correlation coefficient (0,163)
P-value (0,147)
Number of participants (sample size)
Spearman’s Rank Correlation Coefficient
• One or both variables is measured on an ordinal
scale.
• One or both variables are not normally
distributed.
• The sample size is small (<30).
• The relationship between both variables is non-
linear.
If any of those statements is true, use Spearman's
Rank Correlation Coefficient.
Plot your data! For U-shaped relationhsip no
coefficient will show the proper strength of
relationship.
Spearman’s Rank Correlation Coefficient
First steps are the same as in calculation of Pearson correlation
coefficient.
Scatter plot
Choose the
type of
diagram and
click «Define».

Choose
variables you
want to plot
and click «OK».
Results

Gian
Correlation between time
spent revising and exam
performance is strong and
statistically significant,
coerient
r(41)=0,817; p<0,001.
df=N-2 pvalue
ifparametric samesize 2
astraysignificance
Linear regression
hurt need normal distribution
Linear Regression
Linear regression uses mathematical model to describe
relationship between both variables.
Types of regression
1. By number of factors in the
model:
• One-factor
• Multiple factor
2. By mathematical model of
relationship:
• Linear
• Non-linear
 logarithmic
 exponential
 Cox proportional hazards
 etc.
Regression line
• If there is a relationship between x and y → we might want to
find the equation of a line that best approximates the data.
• This is called the regression line (also called best-fit line or
least-squares regression line).
• We can use this line to make predictions and evaluate the ratio
of change in y per change in x.
Regression
• One variable is regarded as the predictor,
explanatory, or independent variable (x).
• Other variable is regarded as the response,
outcome, or dependent variable (y).

resianal
slog constant

ordinal
data e MY
slopethee
of in

y a bx y
b
constant X
intertant
careabout
ordinal data
that
Straight line equation
In algebraic terms, a straight line is defined by the following
formula:
Y = a + bX
Where:
• Y is the predicted variable.
• a is the intercept (where the straight line intercepts the
vertical Y-axis on a graph).
• b is the slope of the straight line.
• X is the value on the predictor variable.
Once we know the values for the intercept a and the slope b,
we can insert various X values into the equation in order to
predict values of Y (only in interval of known values of X).
The same intercept, different slopes

http://core.ecu.edu/psyc/wuenschk/docs01/regr1.gif
The same slope, different intercepts

http://qcbs.ca/wiki/_media/fig_7_w5.png?w=600&tok=ab7bc2
Least square method (LSM)
Residuals (errors)
Example

x y
1,00 1,00
2,00 2,00
3,00 1,30
4,00 3,75
5,00 2,25
Example
x y ŷ y-ŷ (y-ŷ)^2

1,00 1,00 1,210 -0,210 0,044

2,00 2,00 1,635 0,365 0,133

3,00 1,30 2,060 -0,760 0,578

4,00 3,75 2,485 1,265 1,600

5,00 2,25 2,910 -0,660 0,436

(y-ŷ)^2 = smallest sum


Coefficient of determination (R2)
In statistics, the coefficient of determination R2 or r2 is a number
that indicates how well data fit a statistical model
0 ≤ R2 ≤1 or 0% ≤ R2 ≤ 100%
Example: If r=0,93364, R2=0,933642=0,872 or 87,2%.
R2 represents the proportion of the variability of y that can be
attributed to its linear relationship with x.
There is no formal test to assess R2; we have to rely on subjective
judgment to evaluate the fit of the regression line.
R & R2
r = 0.99 r = 0.91 r = 0.61

http://work.thaslwanter.at/BSA/html/_images/RegCoefficients.jpg
Regression and p value
H0: the slope of the regression line is zero (the change in
independent variable(s) do not predict changes in dependent
variable).

https://www.researchgate.net/publication/259983890_Quantitative_Assessment_of_Pancre
atic_Fat_by_Using_Unenhanced_CT_Pathologic_Correlation_and_Clinical_Implications
Assumptions
• Both variables should be interval or ratio scale.
• There needs to be a linear relationship between the two
variables.
• There should be no significant outliers.
• The residuals (errors) of the regression line need to be
approximately normally distributed.
• The residuals should not be correlated with another variable.
Assumptions
• Your data need to show homoscedasticity (homogenity), which
is where the variances along the line of best fit remain similar
as you move along the line.
Linear regression in SPSS
Analyze  Regression  Linear
Select the dependent
variable.

Select the
independent
variable.
Linear regression in SPSS
Results I

• R square - average hours spent


revising explain 67% of
variation in exam score.
• Durbin-Watson statistic cheks
assumption about correlation
of residuals - values can be
from 0 to 4. For regression it is
good if the value is
approximately 2 (±0.7).
Results II

Average time spent revising can predict exam score statistically


significantly, F(1, 41)= 82.349, p<0.001.
Results III

Y= a+bX = 15,82+1,27*X
Exam performance = 15,82 + 1,27*Time spent revising
With every hour spent revising, the test score increases by 1.27
(95% CI = 0,99, 1,56) points, this relationship is statistically
significant at 95% level of confidence (t=9.075, p<0,001).
Plots of residuals - homoscedasticity

Homoscedasticity Heteroscedasticity
https://www.statisticssolutions.com/testing-assumptions-of-linear-regression-in-
spss/
Plots of residuals - normality
Multiple linear regression

https://statisticspicturebook.wordpress.com/category/regression/
Multiple linear regression in SPSS
Additional assumption - covariates should not correlate strongly
with each other (to avoid multicollinearity).
Select the dependent
variable.

Select independent
variables, not more
than 5, if the
chosen method is
«Enter».

Choose the preferred method and click «OK». Method


«Enter» includes all independent variables in the model.
Results I
• Use Adjusted R square for
multiple linear regression.
Both average hours spent
revising and anxiety
explain about 65% of
variation in exam score.

• The model is still


statistically significant
(p<0,001).
Results II

Multicollinearity avoided if VIF <5.


Beta - A standardized beta coefficient compares the strength of
the effect of each individual independent variable to the
dependent variable. The higher the absolute value of the beta
coefficient, the stronger the effect. For example, a beta of - 0,9
has a stronger effect than a beta of + 0,8.
You can decide weather to keep not statistically significant
variables in the model or not.
Practical Work
1. Parametric and nonparametric correlation.
2. Linear regression example.
Do I know this I?
• What scatter diagram shows?
• When it is approproate to calculate the Pearson correlation
coefficient to show relationship between two variables?
• What is null hypothesis in correlation analysis?
• What is positive and negative correlation?
• What is coefficient of determination and how to calculate it?
• When the Spearman rank correlation coefficient is better
estimate than Pearson correlation coefficient?
Do I know this II?
• Explain the terms commonly used in regression analysis:
dependent variable, explanatory variable, regression
coefficient, intercept, residual, covariate.
• How the simple (univariable) regression line looks like and what
is the meaning of it's coefficients?

You might also like