字幕列表 影片播放 由 AI 自動生成 列印所有字幕 列印翻譯字幕 列印英文字幕 Hi. It's Mr. Andersen and welcome to my podcast on the Chi-squared test. Chi-squared 你好,我是安德森先生,歡迎收看我的Chi-squared測試播客。Chi-squared test if you look at the equation lots of students get scared right away. It's really simple 測試如果你看公式很多學生馬上就會害怕。它真的很簡單 once you figure it out. So don't be scared away, but Chi-squared test especially in AP 一旦你想通了。所以不要被嚇跑了,但是Chi-squared測試尤其是在AP中的 biology, especially in science is very important. And it's a way to compare when you collect 生物學,特別是在科學是非常重要的。而且它'是一種比較的方法,當你收集 data, is the variation in your data just due to chance or is it due to one of the variables 數據,你的數據的變化是僅僅由於偶然性,還是由於其中的一個變量造成的 that you're actually testing. And so the first thing you should figure out is what are the, 你'實際測試。所以你首先應該弄清楚的是什麼是。 what do all these variables mean? 這些變量意味著什麼? So the first one, this right here stands for Chi-squared. And so this was developed way 所以,第一個,這個就在這裡代表Chi -squared。所以這是開發的方式 in the early part of the 1900s by Carl Pearson. Pearson's Chi-squared test. So, what is this 在20世紀初,由卡爾-皮爾遜。皮爾遜'的Chi-squared檢驗。那麼,這是什麼呢? then? That is going to be a sum. So we're going to add up a number of values in a Chi-squared 然後呢?那將是一個總和。所以,我們'要加起來的值的數量在一個Chi平方的 test. What does the O stand for? Well that's going to be for the data you actually collect. 測試。O代表什麼?嗯,這'將是你實際收集的數據。 And so we call that observed data. And then the E values are going to be the expected 所以我們稱之為觀測數據。然後E值將是預期的。 values. And so if you're ever doing an experiment, you can actually figure out your expected 值。是以,如果你'做一個實驗,你實際上可以計算出你的預期的 values before you start. And then you just simply compare them to your observed values. 在你開始之前,數值。然後你只需簡單地將它們與你的觀察值進行比較。 Let me give you an example of that with these coins over here. 我給大家舉個例子,這邊的這些硬幣。 Let's say I flip a coin 100 times. And I get 讓我們'說我拋硬幣100次。我得到 62 heads and I get 38 tails. Well is that due to just chance? Or is there something 62個頭,我得到38個尾巴。那麼,這是由於只是偶然?還是有什麼原因? wrong with the coin? Or the way that I'm flipping the coin? And so the Chi-squared test allows 硬幣有問題?還是我翻轉硬幣的方式?所以Chi-squared測試允許 us to actually answer that. And so what I'm thinking in my head is something called a 我們實際回答。所以我腦子裡想的是一個叫作 "的東西"。 Null Hypothesis. And so if we're flipping a coin 100 times. And I think I said 62 head 空心假說。所以如果我們'擲硬幣100次。我想我說的62頭 and 38 tails. Well that would be the observed value that we get in an experiment. But there'd 和38個尾巴。嗯,這將是我們在實驗中得到的觀察值。但有'd also be expected values because you know it should be 50 heads and 50 tails. And so you 也是預期值,因為你知道它應該是50頭50尾。所以你 used something called a null hypothesis in this case where you're saying there's not 在這種情況下,使用的東西稱為無效假設,你說有's不 statistical significant difference between the observed values and the expected frequencies 觀測值與預期頻率之間的顯著性差異。 that we expect to get and what do we actually find. 我們期望得到的和我們實際發現的。 And so it's cool, Chi-squared, because we 所以它很酷,Chi-squared,因為我們的。 can actually measure our data, or look at our data and see is there a statistical difference 可以實際測量我們的數據,或者看我們的數據,看看是否有統計學上的差異。 between those two. The best way to get good at Chi-squared is actually to do some problems. 這兩者之間。想要學好Chi平方,其實最好的方法就是做一些題。 Before we get to that there's two terms that I have to define. One is degrees of freedom 在我們討論這個問題之前,有兩個術語我必須要定義一下。一個是自由度 and then one is critical values. And so the whole point of a Chi-squared test is either 然後一個是臨界值。所以Chi-squared檢驗的全部意義是要麼 to accept or reject our null hypothesis. And so you have to either exceed or don't exceed 以接受或拒絕我們的零點假設。是以,你必須要麼超過或不超過。 your critical value. But first of all we have to figure out where that number is in this 你的臨界值。但首先我們要弄清楚這個數字在哪裡,在這個 big chart right here. 大圖就在這裡。 First thing is something called degrees of freedom. So since we're comparing outcomes, 第一件事是一種叫做自由度的東西。所以既然我們'比較結果。 you have to have at least two outcomes in your experiment. So in this case if we have 你必須在實驗中至少有兩個結果。所以在這種情況下,如果我們有 heads and tails, we have two outcomes that we could get, so we'll say that's 2. And then 頭和尾,我們有兩個結果,我們可以得到,所以我們'會說,'是2。然後 we simply subtract the number 1 from that to get the degrees of freedom. And so in this 我們只需從中減去數字1就可以得到自由度。所以在這個 case we have two outcomes minus 1 and so we would have 1 degree of freedom. Now you might 的情況下,我們有兩個結果減1,所以我們將有1個自由度。現在你可能會 think to yourself why isn' there a zero on this chart? Well, if you just have one outcome 想到自己為什麼不';這個圖上有一個零?那麼,如果你只有一個結果 you have nothing to compare it to. So that's an easy way to think about that. So we figured 你沒有什麼可以比較的。所以,這'是一個簡單的方式來思考這個問題。所以我們想 out that there is one degree of freedom in this case. The next thing you're looking at 出,在這種情況下有一個自由度。接下來你'看的是 is for a critical value. And the critical value that we'll always use in the class is 是為一個臨界值。而我們在類中會一直使用的臨界值是 the 0.05 value. And so that's going to be this column right here. So the first thing 0. 05值。所以這'將是這一列就在這裡。所以第一件事 you do is find the 0.05 value and you don't worry about all of the other numbers. So that's 你要做的是找到0.05的值,你不'擔心所有的其他數字。所以這 3.841 is something I just know because it means that I'm in the right chart or I'm in 3.841是我只知道的東西,因為它意味著我'在正確的圖表或我'在。 the right column. 右欄。 A way that I explain this to kids is that you can think of that as being 95% sure that 我向孩子們解釋的一個方法是,你可以把它看成是95%的肯定。 you're either accepting or rejecting your null hypothesis. And you can see that our 你'要麼接受要麼拒絕你的零點假設。你可以看到,我們的 critical values get higher over here. So you can think as we move this way, if we really 這裡的臨界值會越來越高所以你可以想,當我們這樣移動時,如果我們真的... want to be sure we'd have to exceed a higher critical value. So what's our null hypothesis 想要確定我們'd必須超過一個更高的臨界值。所以我們的零點假設是什麼? again. Null hypothesis's no statistical difference between observed and expected and so we either 再次。Null hypothesis'的觀察到的和預期的沒有統計學上的差異,所以我們要麼是。 accept or reject that value. So in this case our critical value would be 3.841. And so 接受或拒絕該值。所以在這種情況下,我們的臨界值將是3.841。所以 when you calculate Chi-squared, if you get a number that is higher than 3.841 then you 當你計算Chi-squared時,如果你得到的數字高於3.841,那麼你就 reject that null hypothesis. And so there actually is something aside from just chance 拒絕這個零假設。是以,實際上有一些東西 除了只是機會 that is causing you to get more heads than tails. And if you don't exceed the critical 是導致你得到更多的頭比尾。如果你不超過臨界值 value then you accept that null hypothesis. And this is usually what ends up happening, 值,那麼你就接受這個零點假設。而這通常是最終的結果。 unless you have a variable that's impacting your results. Let's apply this in a couple 除非你有一個變量,'的影響你的結果。讓我們把這個應用在幾個例子中吧 of different cases. 的不同情況。 So this is my wife here. I asked her to flip a coin and so I asked the statistics teacher 所以這是我老婆在這裡。我讓她拋硬幣,所以我問統計學老師。 how much data do you have to get before you can actually apply the Chi-squared test? And 你要得到多少數據才能真正應用Chi-squared檢驗?還有 Mr. Humberger said something magic about 30. And so I want to exceed that number in each 杭博格先生說過一個神奇的數字,大約是30。所以我希望在每一個環節都能超過這個數字。 of these experiments and so this is my wife down here. This is her hand. And what she's 這些實驗,所以這是我的妻子在這裡。這是她的手。而她 going to do is she's going to, let me get a value you can see, she's going to flip 50 要做的是她'的打算,讓我得到一個值 你可以看到,她'的打算翻轉50。 coins. You can see she's really fast so she's flipping 50 coins and then she's sorting them 幣。你可以看到她的速度非常快,所以她翻轉了50枚硬幣,然後她把它們分揀出來 out. And so if we look at that, the first thing, even before you collect the data is 出。是以,如果我們看一下,第一件事, 甚至在你收集數據之前,是: we could look at the expected values. And so we've got heads or tails. And so if you 我們可以看看預期值。所以我們'已經得到了頭或尾。所以,如果你 flip 50 coins how many do we expect to come up as heads? The right answer would be 25. 拋出50枚硬幣,我們預計有多少枚會出現人頭?正確答案是25個。 And how many would we expect to come up as tails? 25 as well. Now let's say your data 又有多少會以尾巴的形式出現呢?25個也是。現在,讓我們'說你的數據 is not as even as that. If you're looking at fruit flies it might be 134 or 133. Well 是沒有那麼均勻的。如果你'在看果蠅,可能是134或133。嘛 let's say I flip 51 coins for example instead of 50 then my expected values would be 25.5 比如說我拋出51枚硬幣,而不是50枚,那麼我的期望值將是25.5 and 25.5. So expected values since they're just due to probability don't have to be a 和25.5。所以,預期值既然只是由於概率不',那麼就不一定是一個 whole number. 整數。 If we look at our observed values, well let's look down here. How many heads did we get? 如果我們看一下我們的觀測值,好吧,讓我們看下這裡。我們有多少人頭? 28 heads. And how many tails did we get? So that would just be 22. Okay. So now we're 28個頭。那我們得到了多少個尾巴?所以,這將只是22。好了,現在我們 going to apply Chi-squared and come up with a critical value. And so, what does that mean? 要應用Chi -squared 並拿出一個臨界值。那麼,這意味著什麼? Well let me get this out of the way. So we're going to take our equation which is O minus 好吧,讓我把這個問題說清楚。所以,我們要把我們的公式 這是O減去。 E squared over E, and we're going to do that for the heads column and then we're going E的平方在E上,我們'要做到這一點的頭列,然後我們'要。 to do it for the tails column. So we've also got O minus E squared over E for the tails 來做尾部列。所以,我們也得到了O減E的平方在E上的尾數。 column. And so our observed value is going to be 28. So it's 28 minus 25, which is expected, 列。所以我們的觀測值將是28。所以是28減去25,這是預料之中的。 squared over 25. Now this sum means that we're going to add these two values together so 25的平方。現在這個總和意味著我們要把這兩個值加在一起,所以。 I'm going to put a plus sign right here. Now we're going to do the tails side. So what's 我在這裡放一個加號。現在我們要做的是尾部。所以,什麼 our observed? It's 22 minus 25 squared over 25. So you can do this in your head. 28 minus 我們的觀察?這是22減25的平方超過25。所以,你可以在你的腦袋裡做這個。28減 25 is 3, square that is 9. 9 over 25 plus 22 minus 25 is negative 3 squared. It's 9 25是3,平方就是9,9過25加22減25是負3的平方。它的9 over 25. And so our answer is 18 over 25 which equals 0.72. 超過25。所以我們的答案是18大於25,等於0.72。 Okay. So that's our Chi-squared value for 這就是我們的Chi-squared值。 this data that we just collected. Now let's go over here to our critical values. Well 這個數據,我們剛剛收集。現在讓我們到這裡來看看我們的臨界值。好了 we said that we had 1 degree of freedom, because there's two outcomes. 2 minus 1 is 1. So we're 我們說我們有1個自由度,因為有'的兩個結果。2減1是1,所以我們'。 in this right here, this row right here. And then here is our magical 0.05 column and so 在這裡,這一行就在這裡。然後這裡是我們神奇的0. 05欄,所以。 our critical value is 3.841. And so if we get a number higher than that we reject our 我們的臨界值是3. 841所以,如果我們得到的數字比這個高,我們拒絕我們的。 null hypothesis. We didn't, so we got a value that is lower than that, 0.72 so that means 零假設。我們沒有't,所以我們得到了一個比這個值更低的值,0.72,所以這意味著。 we have to accept our null hypothesis. That means that my wife did a great job. There's 我們必須接受我們的零假設。這意味著我的妻子做得很好。There's nothing wrong with the coins. There's not way more heads then there should be and so 幣沒有什麼問題。有''s不方式更多的頭,然後有應該是,所以。 we have to accept the null hypothesis that there's no statistical difference between 我們必須接受零假設,即沒有';之間的統計學差異。 what we observe and what we expect to see. 我們觀察到的和我們期望看到的。 So now let's try a little more complex problem. Now we've got dice. So we've got 36 dice. 所以,現在讓我們試試更復雜一點的問題。現在,我們已經得到了骰子。所以我們有36個骰子。 So let me get this out here. So our expected values, well there are six things you could 所以讓我在這裡把這個說出來。是以,我們的預期值, 好了,有六件事情,你可以。 get. So we could get a 1, 2, 3, 4, 5 or 6. And so let's play this out. So expected values, 得到。所以我們可以得到1、2、3、4、5或6。所以讓我們'玩這個了。所以預期值。 since I have 36 dice here, we would expect to get 6 of each of those numbers coming up. 因為我這裡有36個骰子,我們希望能從這些數字中各得到6個。 So I'm just taking 36 total dice divided by 6 so I got 6. But let's see what we get for 所以我'只是把36個總骰子除以6,所以我得到了6個。但讓我們看看我們得到了什麼。 observed values. Oh, it looks like we're getting a lot of sixes. So if we look at the observed 觀測值。哦,看起來我們'得到了很多6。所以,如果我們看一下觀察到的 values for one here we get 2 ones. We look at the twos, we get 4 of those. For the threes 這裡的1的值,我們得到2個1。我們看看二,我們得到4個二。對於3 it looks like 8 threes. For the fours we get 9. For the fives we just get 3. And then for 它看起來像8個三。四個四,我們得到9個。5號的我們只得到3個。然後是 the sixes, look at all the sixes, so we get 10 right here. Okay. Now we have to figure 六,看看所有的六, 所以我們得到10在這裡。好了,現在我們要算出現在我們要計算 out a Chi-squared value. So let me get this out of the way. 出一個Chi-squared值。所以讓我把這個問題說清楚。 And I'm going to stop talking and do the math 我就不說了,先算算賬吧。 and speed up the video a little bit. And so hopefully I don't screw up any of this. So 並加快視頻一點點。所以希望我不'搞砸了任何這一點。所以... that is 58 over 6 which is 9.6. So that is our Chi-squared value. It's 9.6 in this case. 那就是58大於6,也就是9.6。所以這就是我們的Chi平方值。它'9.6在這種情況下。 Since we added all these up. So now we've got to go over here to our chart. And so first 既然我們把這些都加起來了。所以現在我們'''已經得到了在這裡去我們的圖表。所以首先 of all we have to figure out how many degrees of freedom do we have. Well, since there are 我們必須弄清楚我們有多少自由度。好吧,既然有 6 different outcomes and we take 6 minus 1, so we've got 5. We're in this column of the 6種不同的結果,我們取6減1,所以我們'已經得到5。我們在這一列的。 0.05 right here so if I read across our critical value is 11.070. And so if we look at that, 0. 05就在這裡,所以如果我讀過我們的臨界值是11. 070。所以如果我們看一下, did our value go higher than that, no it's only 9.6, it's lower than that, so in this 我們的價值是否比這更高,不,它'只有9.6,它'比這更低,所以在這個。 case since it's 9.6, even though we had all of those sixes we still need to accept our 的情況下,因為它的9.6,即使我們有所有這些六,我們仍然需要接受我們的。 null hypothesis that there's no statistical significance between or difference between null hypothesis that there's no statistical significance between or difference between what we observed and then what we expected. 我們觀察到的,然後是我們預期的。 So now let's leave you with this question. So in the animal behavior podcast as I talk 所以現在讓我們'留給你這個問題。所以,在動物行為播客中,當我談到 about that, we're looking at pill bugs and if they spend more time in the wet or if they 關於這一點,我們'正在尋找藥丸蟲,如果他們花更多的時間在潮溼或如果他們 spend more time in the dry. And so if you look at the values right here, this is recording 花更多的時間在乾燥。所以,如果你看這裡的值,這是錄音 how much time they spend in the wet and how much time they spend in the dry. So what I've 他們花多少時間在潮溼和多少時間在乾燥。所以我've done is we would expect since there are 10 pill bugs we'd have 5 on each side. But since 做的是我們會期望因為有10個藥蟲,我們'會有5個在每邊。但由於 it looks like they're spending more time on the wet, you can even see them in the video 它看起來像他們'花更多的時間在溼的,你甚至可以看到他們在視頻中 here spending more time in the wet, I take the average of the wet and the average of 在這裡花了更多的時間在潮溼的,我採取的平均溼和平均的。 the dry column. And that gives me my wet and my dry and so now I'm not going to show you 幹柱。這給了我我的溼和我的幹,所以現在我'不打算告訴你。 how to do this one, but try to apply Chi-squared to figure out if there's a statistical difference 如何做到這一點,但嘗試應用Chi-squared來計算,如果有'的統計學差異。 between the expected values of what we expect and what we observed. And you can put your 我們所期望的和我們觀察到的預期值之間。你可以把你的 answer down in the comments. And so I hope that's helpful. 在評論中回答下來。所以希望對大家有所幫助'。