统计学_Wilcoxon signed-rank test(python脚本)
python機(jī)器學(xué)習(xí)-乳腺癌細(xì)胞挖掘(博主親自錄制視頻)
https://study.163.com/course/introduction.htm?courseId=1005269003&utm_campaign=commission&utm_source=cp-400000000398149&utm_medium=share
機(jī)器學(xué)習(xí),統(tǒng)計(jì)項(xiàng)目聯(lián)系QQ:231469242
兩個(gè)配對(duì)樣本,均勻分布,非正太分布
Wilcoxon signed-rank test
曼-惠特尼U檢驗(yàn)Mann–Whitney Test
兩個(gè)獨(dú)立樣本,均勻分布,非正太分布
https://en.wikipedia.org/wiki/Frank_Wilcoxon
ranking method
這是a=0.05對(duì)應(yīng)得樣本數(shù)
critical value 對(duì)應(yīng)樣本數(shù),20樣本對(duì)應(yīng)的關(guān)鍵值為52
positive sum:
差異為正值的排名和
negative sum:
差異為負(fù)值的排名和
如果negative sum小于52,表明兩組數(shù)有顯著差異,推翻原假設(shè)
http://blog.sina.com.cn/s/blog_4bcf5ebd0101422n.html
SPSS學(xué)習(xí)筆記之——兩配對(duì)樣本的非參數(shù)檢驗(yàn)(Wilcoxon符號(hào)秩檢驗(yàn))
一、概述
非參數(shù)檢驗(yàn)對(duì)于總體分布沒有要求,因而使用范圍更廣泛。對(duì)于兩配對(duì)樣本的非參數(shù)檢驗(yàn),首選Wilcoxon符號(hào)秩檢驗(yàn)。它與配對(duì)樣本t檢驗(yàn)相對(duì)應(yīng)。
二、問題
為了研究某放松方法(如聽音樂)對(duì)于入睡時(shí)間的影響,選擇了10名志愿者,分別記錄未進(jìn)行放松時(shí)的入睡時(shí)間及放松后的入睡時(shí)間(單位為分鐘),數(shù)據(jù)如下筆。請(qǐng)問該放松方法對(duì)入睡時(shí)間有無影響。
本例可以采用配對(duì)樣本t檢驗(yàn),但由于樣本量少,數(shù)據(jù)可能不符合正太分布,所以考慮用非參數(shù)檢驗(yàn)。
三、統(tǒng)計(jì)操作
數(shù)據(jù)視圖
菜單選擇
打開如下的對(duì)話框
該對(duì)話框有三個(gè)選項(xiàng)卡,第一個(gè)選項(xiàng)卡會(huì)根據(jù)第三個(gè)選項(xiàng)卡的設(shè)置自動(dòng)設(shè)置,故一般不用手動(dòng)設(shè)定。點(diǎn)擊進(jìn)入“字段”選項(xiàng)卡。將“放松前”、“放松后”均選入右邊“檢驗(yàn)字段”框中。
點(diǎn)擊進(jìn)入“設(shè)置”對(duì)話框,選擇檢驗(yàn)方法,切換為“自定義檢驗(yàn)”,選擇“Wilcoxon匹配樣本對(duì)符號(hào)秩(二樣本)”復(fù)選框。“檢驗(yàn)選項(xiàng)”可以設(shè)定顯著性水平。
點(diǎn)擊“運(yùn)行”按鈕,輸出結(jié)果
四、結(jié)果解讀
這就是輸出結(jié)果。原假設(shè)示放松前好放松后差值的中位數(shù)等于0,P=0.015<0.05,拒絕原假設(shè),認(rèn)為放松前后有統(tǒng)計(jì)學(xué)差異。
雙擊該表格,會(huì)彈出如下的“模型瀏覽器”窗口,可以看到更詳細(xì)的信息。如下圖。
# -*- coding: utf-8 -
import scipy.stats as stats
data1=[21,12,12,23,19,13,20,17,14,19]
data2=[12,11,8,9,10,15,16,17,10,16]
stats.wilcoxon(data1,data2)
'''
Out[2]: WilcoxonResult(statistic=2.0, pvalue=0.01471359242280415)
p值小于0.05,兩組數(shù)據(jù)有顯著差異
'''
https://study.com/academy/lesson/non-parametric-inferential-statistics-definition-examples.html
In this lesson, you're going to learn about the major differences between parametric and non-parametric methods for dealing with inferential statistics, as well as see an example of the non-parametric method.
Normal
What is normal? At least in the world of statistics, this has nothing to do with how someone dresses, acts, or what their beliefs are. Normal data comes from a population with a normal distribution. A normal distribution is a distribution that has a symmetrical bell-shaped curve to it, which you're probably well aware of.
Keep this concept in mind as we go over the major differences between parametric and non-parametric statistics.
Parametric Methods
First, let's define our terms really simply. When we talk about parameters in statistics, what are we actually hinting at? Parameters are descriptive measures of population data, such as the population mean or population standard deviation.
When the variable we are considering is approximately (or completely) normally distributed, or the sample size is large, we can use two inferential methods that are concerned with parameters - appropriately called parametric methods - when performing a hypothesis test for a population mean. For instance, if we find that the distribution of the average salary of a sample looks like a bell curve, then parametric methods may be used.
These two methods are probably ones you've heard of before. They are the z-test, which we'd use when the population standard deviation is known to us; or the t-test, which we'd use when the population standard deviation is not known to us.
Non-Parametric Methods
Inferential methods that are not concerned with parameters are known, easily enough, as non-parametric methods. However, this term is also more broadly used to refer to many methods that are applied without assuming normality. So, for instance, if we find that the distribution of the average salary of a sample looks like the histogram you see on the screen now [see video], which is nothing close to that of a bell curve, then we will have to turn to non-parametric methods.
Such non-parametric methods have their pros and cons. On the pro side, these methods are usually simpler to compute and are more resistant to extreme values when compared to parametric methods. On the con side, if the requirements for the use of a parametric method are actually met, non-parametric methods do not have as much power as the z-test or t-test.
By power, I simply mean the probability of avoiding a type II error, which is an error where we fail to reject the false null hypothesis.
Example of a Non-Parametric Method
One example of a non-parametric method is the Wilcoxon signed-rank test. This is a test that assumes the variable under consideration does not need a specific shape and doesn't have to be normally distributed, but is symmetric in its distribution nonetheless. This means that it can be sliced in half to produce two mirror images.
So, for example, a right-skewed or left-skewed distribution would not be appropriate for this test since it's not symmetric. But a normal, symmetric bimodal, triangular, or uniform distribution would be a fit for this test since any one of those can be sliced in half to produce two mirror images of one another.
Other non-parametric tests include the likes of:
The Kruskal-Wallis test
The Mann-Whitney U test
The sign test
Lesson Summary
Normal data comes from a population with a normal distribution. A normal distribution is a distribution that has a symmetrical bell-shaped curve to it, which you're probably well aware of.
Inferential methods that are concerned with parameters are appropriately called parametric methods, and include the z-test and t-test. Parameters are descriptive measures of population data.
Inferential methods that are not concerned with parameters are known as non-parametric methods. This term is also more broadly used to refer to many methods that are applied without assuming normality.
While non-parametric methods are easier to compute than parametric ones, they do not have as much power as parametric methods if the requirements for the use of a parametric method are met. By power, I simply mean the probability of avoiding a type II error, which is an error where we fail to reject the false null hypothesis.
An example of a non-parametric method is the Wilcoxon signed-rank test. This is a test that assumes the variable under consideration does not need a specific shape and doesn't have to be normally distributed, but is symmetric in its distribution nonetheless.
https://study.163.com/provider/400000000398149/index.htm?share=2&shareId=400000000398149(歡迎關(guān)注博主主頁,學(xué)習(xí)python視頻資源,還有大量免費(fèi)python經(jīng)典文章)
總結(jié)
以上是生活随笔為你收集整理的统计学_Wilcoxon signed-rank test(python脚本)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: hammer使用: 代码:捏合、捏开、
- 下一篇: 特斯拉一季度财报发布:营收233.29亿