独立t检验和配对t检验_配对学生的t检验是什么?
獨立t檢驗和配對t檢驗
There’s a neat YouTube channel I discovered a couple of years ago where Eugene O’Loughlin, Ph.D., does some statistical analyses by hand. I thought it was neat because it allows us to see that statistical analysis is not something that only computers can do. Sure, computers can do these analyses much faster than we ever could, but you really can do a lot with just a pen and paper and a good calculator.
幾年前,我發(fā)現(xiàn)了一個整潔的YouTube頻道 ,其中Eugene O'Loughlin博士是 ,手動進(jìn)行一些統(tǒng)計分析。 我認(rèn)為這很整潔,因為它使我們看到統(tǒng)計分析不是只有計算機(jī)才能完成的事情。 當(dāng)然,計算機(jī)可以比以往更快的速度進(jìn)行這些分析,但是實際上,您只需筆和紙以及一個好的計算器就可以完成很多工作。
Of course, you need some knowledge of numbers and how they work, and the basic statistical concepts that will help you get the work done, but there’s not much else after that. For example, here is Dr. O’Loughlin doing a paired t-test by hand:
當(dāng)然,您需要一些數(shù)字及其工作方式的知識,以及可以幫助您完成工作的基本統(tǒng)計概念,但是在此之后沒有太多其他知識了。 例如,這是O'Loughlin博士手工進(jìn)行的配對t檢驗:
Paired t tests are used to test the theory that the average score of a test taken by one group is different (or the same) as the average score of another test taken by the same group. (One group, two tests… Paired.) Now that you’ve seen the video on how to do it by hand, how can you do it in R in a way that teaches you how the base t.test function works internally?
配對t檢驗用于檢驗以下理論:一組考試的平均分?jǐn)?shù)與同一組另一考試的平均分?jǐn)?shù)不同(或相同)。 (一組,兩個測試…配對。)現(xiàn)在,您已經(jīng)觀看了有關(guān)如何手動執(zhí)行視頻的視頻,如何在R中以教您基本t.test函數(shù)如何在內(nèi)部工作的方式進(jìn)行視頻處理?
First, The Things You’ll Need to Know
首先,您需要知道的事情
Using Dr. O’s data set up there and his example, we know that we need to know the differences between the tests, the square of the differences, and the sum of the differences and the sum of the squared differences. We also need to know the degrees of freedom (number of pairs minus 1) and then go get the critical value of the t score from a table.
使用O博士在那里設(shè)置的數(shù)據(jù)和他的示例,我們知道我們需要知道測試之間的差異,差異的平方,差異的總和以及差異的平方和。 我們還需要知道自由度(對數(shù)減去1),然后從表中獲得t分?jǐn)?shù)的臨界值。
That’s it… So let’s do it in code:
就是這樣...所以讓我們在代碼中完成它:
# First, the pre-lesson scores:pre <- c(23,25,28,30,25,25,26,25,22,30,35,40,35,30)# Then, the post-lesson scores:post <- c(35,40,30,35,40,45,30,30,35,40,40,35,38,41)# What are the average scores?pre.avg <- mean(pre)post.avg <- mean(post)
Here, I’ve created the pre and post datasets. Then I went ahead and calculated the average for each set. The average score in the post set is higher than the average score in the pre set, but is that difference statistically significant? Let’s calculate the values we need:
在這里,我創(chuàng)建了前后數(shù)據(jù)集。 然后我繼續(xù)計算每組的平均值。 帖子集中的平均分?jǐn)?shù)高于預(yù)設(shè)中的平均分?jǐn)?shù),但是這種差異在統(tǒng)計上是否顯著? 讓我們計算所需的值:
# Differences between the setsdifferences <- pre-post # Pre minus post# Sum of differences between the sets:sum.differences <- sum(differences)# Square the differencesdifferences.sqrd <- differences^2# Sum of the squared differences:sum.sqrd.differences <- sum(differences.sqrd)# Sum of differences squared:sum.differences.sqrd <- sum.differences^2# Number of observation pairsn.obs <- as.integer(length(pre))Now, we have everything we need to know to calculate the t score:
現(xiàn)在,我們擁有計算t分?jǐn)?shù)所需的所有知識:
t.score= sum.differences / sqrt((((n.obs*sum.sqrd.differences)-(sum.differences.sqrd))/
(n.obs - 1)
))# Your t score isView(t.score)
You’ll see that the t score is the same as Dr. O calculated, so our conclusion is the same. Of course, you can do this much faster in R:
您會看到t分?jǐn)?shù)與O博士計算的相同,因此我們的結(jié)論是相同的。 當(dāng)然,您可以在R中更快地執(zhí)行此操作:
t.test(pre, post, paired = TRUE, alternative = "two.sided")# The alternative is "two.sided" because we're hypothesizing that the two# sets are different. If we were hypothesizing that the true difference in
# means was greater or less than zero, we would use "greater" or "less" in
# the alternative statement.t.test(pre,post, paired = TRUE, alternative = "less")
And that’s it. You’ve done a paired t test in R the long way and the short way, but now you know how the short way arrives at the calculation that you do by hand and via the short way.
就是這樣。 您已經(jīng)在R和長途中用R完成了配對的t檢驗,但是現(xiàn)在您知道了短途如何通過手工和短途完成計算。
It is essential for you to know how these functions work “under the hood” because there may come a time when someone programming those functions makes a mistake. Do you really want your work to hinge on how someone else — someone you may not even know — does their proofreading of their code?
對您來說,了解這些功能如何“在后臺”工作非常重要,因為有時可能有人對這些功能進(jìn)行編程會出錯。 您是否真的希望您的工作取決于其他人(您甚至可能不認(rèn)識的人)如何對其代碼進(jìn)行校對?
I didn’t think so.
我不這么認(rèn)為。
René F. Najera, MPH, DrPH, is a doctor of public health, an epidemiologist, amateur photographer, running/cycling/swimming enthusiast, father, and “all around great guy.” You can find him working as an epidemiologist a local health department in Virginia, grabbing tacos at your local taquería, or on the campus of the best school of public health in the world where he is an associate in the Epidemiology department. All the opinions in this blog post are those of Dr. Najera and do not necessarily represent those of his employers, friends, family or acquaintances.
RenéF. Najera,公共衛(wèi)生碩士,博士 ,是一名 公共衛(wèi)生 醫(yī)生,流行病學(xué)家, 業(yè)余攝影師 ,跑步/騎自行車/游泳愛好者,父親和“周圍的好人”。 您可以找到他在弗吉尼亞州的一個地方衛(wèi)生部門擔(dān)任流行病學(xué)家,在您當(dāng)?shù)氐膖aquería或世界上最好的公共衛(wèi)生學(xué)院的校園里抓玉米餅,在那里他是流行病學(xué)部門的助理。 本博客文章中的所有觀點均為納杰拉博士的觀點,不一定代表他的雇主,朋友,家人或相識者的觀點。
翻譯自: https://medium.com/swlh/whats-under-the-hood-of-a-paired-student-s-t-test-87db028e28b4
獨立t檢驗和配對t檢驗
總結(jié)
以上是生活随笔為你收集整理的独立t检验和配对t检验_配对学生的t检验是什么?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: delphi uniDac
- 下一篇: 中国天气预报网城市对应代码