You are on page 1of 44

Perbandingan Rata-Rata Dua

Sampel
Field ecologist often wish to compare the
average value of some variables in two
samples. This problem typically resolves
into two steps:
a. Is the observed difference between the
average of two samples significant, or is
it due to the change of sampling error?
b. If a difference between the average of
two samples is indeed significant, what is
the extent of the difference?
H0: samples are drawn from population with
identical averages and any observed
difference between sampling is due to
sampling error.
H1: samples are drawn from population with
different averages: and observed
difference between samples cannot be
accounted for by sampling error.
Contoh kasus
• Membandingkan jumlah individu satwa
dan tumbuhan dari dua tipe habitat
• Membandingkan diversitas tumbuhan dan
hewan di dua tipe ekosistem
• Membandingkan pengaruh suatu
perlakuan terhadap obyek penelitian
Hipotesis
• Hypothesis - the prediction about what will happen during
an experiment or observational study, or what researchers
will find.

• Examples:
– Drug X will lower blood pressure
– Smoking will increase the risk of cancer
– Lowering ticket prices will increase event attendance
Hypotheses
Example:
Lowering ticket prices will increase event attendance

However, keep in mind that our hypothesis might


be wrong – and the opposite might be true:

 Lowering ticket prices will NOT increase event attendant

 So, each time we investigate a single hypothesis, we actually


test two, competing hypotheses.
Hypothesis testing
• HA: Lowering ticket prices will increase event attendance
– This is what we expect to be true
– This is the alternative hypothesis (HA)

• HO: Lowering ticket prices will NOT increase event


attendance
– This is the hypothesis we have to prove wrong –
before our real hypothesis can be correct
– The default hypothesis
– This is the null hypothesis (HO)
Hypothesis Testing
Every time you run a statistical analysis (excluding
descriptive statistics), you are trying to reject a null
hypothesis

Could be very specific:


Men taking Lipitor will have a lower LDL cholesterol after 6
weeks compared to men not taking Lipitor
Men taking Lipitor will have a similar LDL cholesterol after
6 weeks compared to men not taking Lipitor (no difference)

…or very simple (and non-directional):


There is an association between smoking and cancer
These is not an association between smoking and cancer
Why null vs alternative?

• All statistical tests boil down to…

HO vs. HA
• We write and test our hypothesis in this
‘competing’ fashion for several reasons,
one is to address the issue of random
sampling error (RSE)
Random Sampling Error
 Remember RSE?
 Because the group you sampled does NOT EXACTLY represent
the population you sampled from (by chance/accident)
 Red blocks vs Green blocks
 Always have a chance of RSE

 All statistical tests provide you with the probability that


sampling error has occurred in that test
 The odds that you are seeing something due to chance (RSE)
vs
 The odds you are seeing something real (a real association or
real difference between groups)
Summary so far…
• #1- Each time we use a statistical test, there are two
competing hypotheses
– HO: Null Hypothesis
– HA: Alternative Hypothesis

• #2- Each time we use a statistical test, we have to


consider random sampling error
– The result is due to random chance (RSE, bad
sample)
– The result is due to a real difference or association

These two things, #1 and #2, are interconnected and we have to


consider potential errors in our decision making
Examples of Competing
Hypotheses and Error
• Suppose we collected data on risk of death and smoking

• We generate our hypotheses:


– HA: Smoking increases risk of death
– HO: Smoking does not increase risk of death

• Now we go and run our statistical test on our hypotheses and


need to make a final decision about them
– But, due to RSE, there are two potential errors we could
make
Error…
There are two possible errors:

Type I Error
We could reject the null hypothesis although it was
really true
HA: Smoking increases risk of death (FALSE)
HO: Smoking does not increase risk of death
(TRUE)

This error led to unwarranted changes. We


went around telling everyone to stop smoking
even though it didn’t really harm them

OR…
Error…
OR…
Type II Error
We could fail to reject the null hypothesis when it was
really untrue
HA: Smoking increases risk of death (TRUE)
HO: Smoking does not increase risk of death (FALSE)

This error led to inaction against a preventable


outcome (keeping the status quo). We went around
telling everyone to keeping smoking while it killed
them
Example of RSE
• RSE is the fact that - each time you draw a sample from
a population, the values of those statistics (Mean, SD,
etc…) will be different to some degree

• Suppose we want to determine the average points per


game of an NBA player from 2008-2009 (population
parameter)
– If I sample around 30 players 3 times, and calculate
their average points per game I’ll end up with 3
different numbers (sample statistics)
– Which 1 of the 3 sample statistics is correct?
8 random samples of 10% of population:
Note the varying Mean and SD – this is RSE!
Knowing this…
• The process of statistics provides us with a guide to help us
minimize the risk of making Type I/Type II errors and RSE
– Statistical significance
• Recall, random sampling error is less likely when:
– You draw a larger sample size from the population (larger n)
– The variable you are measuring has less variance (smaller
standard deviation)
• Hence, we calculate statistical significance with a formula that
incorporates the sample size, the mean, and the SD of the
sample
Statistical Significance
• All statistical tests (t-tests, correlation, regression, etc…)
provide an estimate of statistical significance
• When comparing two groups (experimental vs control) – how
different do they need to before we can determine if the
treatment worked? Perhaps any difference is due to the
random chance of sampling (RSE)?
• When looking for an association between 2 variables – how do
we know if there really is an association or if what we’re seeing
is due to the random chance of sampling?

• Statistical significance puts a value on this


chance
Statistical Significance
• Statistical significance is defined with a p-
value
– p is a probability, ranging from near 0 to near1

– Assuming the null hypothesis is true, p is the probability


that these results could be due to RSE
• If p is small, you can be more confident you are
looking at the reality (truth)

• If p is large, it’s more likely any differences between


groups or associations between variables are due to
random chance
Statistical Significance
• All analytic research estimates ‘statistical significance’ –
but this is different from ‘importance’
– Dictionary definition of Significance:
• The probability the observed effect was caused by
something other than mere chance (mere chance =
RSE)

• This does NOT tell you anything about how important or


meaningful the result is!
• P-values are about RSE and statistical
interpretation, not about how “significant” your
findings are
Alpha
• However, this raises the question, “How small a p-value is small
enough?”
– To conclude there is a real difference or real association
• To remain objective, researchers make this decision BEFORE each
new statistical test (p is set a priori)
– Referred to as alpha, α
– The value of p that needs to be obtained before concluding that the
difference is statistically significant
• p < 0.10
• p < 0.05
• p < 0.01
• p < 0.001
p-values
• WARNINGS:
– A p-value of 0.03 is NOT interpreted as:
• “This difference has a 97% chance of being real and a 3%
chance of being due to RSE”
– Rather
• “If the null hypothesis is true, there is a 3% chance of
observing a difference (or association) as large (or larger)”
– p-values are calculated differently for each statistic (t-test,
correlations, etc…) – just know a p-value incorporates the SD
(variability) and n (sample size)
– SPSS outputs a p-value for each test
• Sometimes it’s “0.000” in SPSS – but that is NOT true
• Instead report as “p < 0.001”
Parametric dan Non Parametric
Test of averages:
1. Parametric test: use actual observations
and compare means.
2. Non-parametric test: convert observations
to ranks and compare sample
distributions, essentially their median.
Matched and Unmatched Observations

When analyzing bivariate data such as


correlations, a single sample unit gives a
pair of observations representing two
different variables. The observation
comprising a pair uniquely linked and are
said to be matched.
It is also possible to obtain a pair of
observations of a single variable which are
matched.
Contoh:
Data berat 10 burung merak dari satu lokasi
dibandingkan dengan data berat merak
dari lokasi lain adalah contoh unmatched
samples.
Data berat 10 merak hari ini dan ditimbang
lagi seminggu kemudian, dengan individu
yang sama dikatakan sebagai matched
samples.
Perbandingan rata-rata- parametric test

Syarat;
1.Data harus dalam skala interval atau ratio.
2. Sebaran data mendekati sebaran normal
3. Populasi yang dibandingkan mempunyai
variance yang sama.
F-Test

sample 1 Sampel 2

n = 41 n= 31
X= 24,71 X= 19,60
S=6,34 S=4,82
S2= 40,1956 S2= 23,2324
greater var iance
F=
lesser var iance
F= 40,1956/23,2324 = 1,730

Check pada tabel F pada P=0,05 untuk v1=40 dan v2=30, nilai F tabel= 2,01
Kesimpulan: sample memiliki variance yang sama atau mirip.
Z-test
Kegunaan; untuk uji beda rata-rata sampel yang
besar. Distribusi data tidak harus normal,
asalkan jumlah sampel besar lebih dari 30
observasi.Untuk data yang sebarannya
menceng harus lebih dari 50 observasi

( x1 − x 2)
z=
s12 s22
+
n1 n2
(24,71 − 19,60) 5,11
z= = = 3,89
40,1956 23,2324 1,315
+
41 31

Z> 1,96→ signifikan berbeda


Z> 2,58→ sangat signifikan berbeda
t-Test for two small samples

( x1 − x 2)
t=
 (n1 − 1) s + (n 2 − 1) s
2 2
 n1 + n 2 
 n1n 2 
1 2
 (n1 + n2 − 2)
  
Contoh:
Sampel 1 Sampel 2
n=6 N2=8
X=74,8 X=72,99
S=1,04 S=1,48
S2=1,08 S2=2,20

(74,8 − 72,99) 1,81


t= = = 2,55
 (6 − 1)1,08 + (8 − 1)2,20  6 + 8  0,711
   
6+8−2  6 x8 
t-Test for matched pairs

d
t=
nd − (d )
2 2

n −1
Bandingkan t hitung dengan t table (P=0,05,
df=n-1
t table=2,262
Kesimpulan?
Non Parametric
The Mann-Whitney U-Test for
Unmatched Samples

1. It is a non parametric test.


2. It may be used with as few as four
observations in each sample
3.The test is applicable for interval and
ordinal data too.
4. It is suitable for data that is not normally
distributed, for example count of things,
proportions, or diversity index.
Example:
Seorang ekologis ingin membandingkan
rata-rata jumlah tupai yang tertangkap
dengan trap untuk dua lokasi yang
berbeda. Data jumlah individu adalah
sebagai berikut, diurutkan dari kecil ke
besar.
Sample 1: 8 12 15 21 25 44 44 60
Sample 2: 2 4 5 9 12 17 19
Step Penghitungan

1. Buat urutan untuk kedua sampel.


observasi: 2 4 5 8 9 12 12 15 17 19 21 25 44 44 60
rank : 1 2 3 4 5 6,5 6,5 8 9 10 11 12 13,5 13,5 15

2. Hitung Rank
R1: jumlah rank sample 1
R2: jumlah rank sample 2

3. Hitung uji statistik U1 dan U2

n2 (n2 + 1) n1 (n1 + 1)
U1 = n1n2 + − R2 ; U 2 = n1n2 + − R1
2 2
4. Check penghitungan
U1 + U2 = n1xn2

5.Pilih hasil perhitungan yang terkecil, dan


bandingkan dengan nilai yang di table
Mann Whitney U-Test. Bila nilai
perhitungan lebih kecil dari nilai tabel
maka H0 ditolak.
Wilcoxon Test for Matched Pairs
Mass of bird, weighed in Mass of bird, weighed in d Rank
August, Sample A (g) September, Sample B (g) of d
10,3 12,2 +1,9 +8
11,4 12,1 +0,7 +4
10,9 13,1 +2,2 +10
12,0 11,9 -0,1 -1
10,0 12,0 +2,0 +9
11,9 12,9 +1,0 +6
12,2 11,4 -0,8 -5
12,3 12,1 -0,2 -2
11,7 13,5 +1,8 +7
12,0 12,3 +0,3 +3
2. Hitung rank minus= 1+5+2=8
Hitung rank plus= 8+4+10+9+6+7+3=47
T = 8 (nilai terkecil)
3. Lihat nilai T tabel dengan jumlah N=10. N
tidak selalu sama dengan jumlah
pengamatan, bila ada nilai d=0, maka
tidak diikutkan dalam penghitungan T.
Kruskal-Wallis Test;
Sample Lebih dari Dua
A B C D
27 (12) 48 (16) 11 (6) 44 (15)
14 (7) 18 (9,5) 0 (1) 72 (19)
8 (4,5) 32 (13) 3 (2) 81 (20)
18 (9,5) 51 (17) 15 (8) 55 (18)
7 (3) 22 (11) 8 (4,5) 39 (14)
n 5 5 5 5 N=20
R 36 66,5 21,5 86
R2 1296 4422,25 462,25 7396
R2/n 259,2 884,45 92,45 1479,2 Σ(R2/n)=
2715,3
 12 
K = ( R / n) x
2
 − 3( N + 1)
 N ( N + 1) 

Bandingkan nilai K dengan table χ2 dengan


derajat bebas, jumlah sampel-1 (n-1), dalam hal
ini 4-1=3. Bila nilai K lebih besar daripada nilai
kritis pada table maka H0 ditolak.

You might also like