Let's talk more about the two sample t-test, since we'll want
to compare two different samples in our class project. There are
a few different versions of the t-test that one might employ
,and they depend on really on what assumptions we make about the
data. So we might want to ask questions such as ,do our
samples have the same size ?,and do they have the same
variance? . Let's discuss a variant of the t-test called Welch's
t-test in more depth. Since it's the most general. It doesn't assume
equal sample size ,or equal variance. In Welch's
t-test ,we compute a t-statistic using following equation.
T equals mu1 minus mu2, divided by the
square root of sigma1 squared over n1. Plus
sigma 2 squared over n2. Where mu I ,is the sample mean for the Ith sample.
Sigma squared I is the sample variance for
the Ith sample. And NI is the sample size
for the Ith sample. We'll also want to estimate the number of degrees
of freedom, nu, using the following equation.
Nu is approximately equal to. Quantity sigma1
squared ,over n1 ,plus sigma2 squared over n2 ,squared over sigma1 of the
4th over n1 squared nu1 ,plus sigma2 to the 4th ,over n2 squared nu2.
Where mu I is equal to mi minus one ,and
this is the degrees of freedom associated with the Ith variance
estimate. If you're unfamiliar with degrees of freedom again it might
be a good idea to brush up on your stats concepts
with the audacity's intro to stats course. A link is
provided in the instructor comments. All right so once we have
these two values, we can estimate the P value. Conceptually, the
P-value is the probability of obtaining the test statistic at least
as extreme as the one that was actually observed
,assuming that the null hypothesis was true. The P
value is not the probability of the null hypothesis
is true given the data. So again, just as a
thought experiment. Say we were testing whether left handed
or right handed baseball players. Were better batters by looking
at their average batting average. If the P value
is .05, this would mean that ,even if there is
no difference between left handed and right handed batters, since
that's our null hypothesis. So, even if this was true,
we would see a value of t ,equal or greater
to the one that we saw 5% of the time.
When performing a statistical test like this, we usually set
some critical value of P. Let's call it P critical.
If P falls below P critical, then we would reject
the null hypothesis. In the two sample case, this is equivalent
to stating that the mean for our two samples
is not equal. Calculating this P value for a
given set of data can be kind of of tedious.
Thankfully, we seldom have to perform this calculation explicitly.
دعنا نتحدث أكثر عن العينتين t-test، حيث إننا سنريد
مقارنة عينتين مختلفتين في مشروع الصف الخاص بنا. توجد
إصدارات قليلة مختلفة من t-test التي يمكن أن يستخدمها المرء
وهي تعتمد في الحقيقة على الافتراضات التي نقدمها عن
البيانات. لذلك، قد نريد طرح أسئلة مثل، هل تحتوي
عيناتنا على الحجم نفسه؟، وهل تحتوي على التباين
نفسه؟ . دعنا نناقش متغير t-test الذي يطلق عليه اسم Welch's
t-test باستفاضة أكثر. حيث إنه الأكثر عمومية. إنه لا يفترض
تساوي حجم العينة، أو تساوي التباين. في Welch's
.t-test، نحسب إحصاء t باستخدام المعادلة التالية
T يساوي mu1 طرح mu2، مقسومًا على
الجذر التربيعي لـ sigma1 مربعًا على n1. جمع
.سيجما 2 تربيع على n2. حيث mu I هي متوسط العينة لعينة Ith
سيجما تربيع I هي تباين العينة
للعينة Ith. وNI هي حجم العينة
للعينة Ith. كما سنريد أيضًا تقدير عدد درجات
.الحرية، nu، باستخدام المعادلة التالية
تساوي Nu تقريبًا. كمية sigma1
تربيع، على n1، جمع sigma2 تربيع على n2 تربيع على sigma1 أس 4
.على n1 تربيع nu1، جمع sigma2 أس 4، على n2 تربيع nu2
حيث mu I تساوي mi طرح واحد، وهذه
هي درجات الحرية المقترنة بتقييم
تباين Ith. إذا لم تكن على دراية بدرجات الحرية مرة أخرى، فقد تكون
مراجعة مفاهيم
الإحصائيات لديك باستخدام مقدمة Udacity عن دورة الإحصائيات التدريبية فكرة جيدة. يوجد رابط
في تعليقات المعلم. حسنًا، لذلك عندما
نحصل على هاتين القيمتين، يمكننا تقدير قيمة P. من الناحية النظرية، قيمة P
هي احتمالية الحصول على إحصاء الاختبار على الأقل بالقيمة
،العظمى التي تم ملاحظتها في الحقيقية
على افتراض أن فرضية null كانت صحيحة. قيمة P
ليست احتمالية فرضية null التي تكون صحيحة
على اعتبار وجود البيانات. لذلك، مرة أخرى، كإجراء
تجربة فكرية. لنفترض أننا كنا نختبر ما إذا كان لاعبو كرة القاعدة
الأعسرون أو الأيمنون. ضاربي كرة متميزين من خلال النظر إلى
متوسط معدل الضرب لديهم أم لا. إذا كانت قيمة
P هي 05.، فيعني هذا أنه لا يوجد
اختلاف بين ضاربي الكرة الأعسرين والأيمنين، حيث تكون
هي فرضية null. لذلك، وحتى إذا كان هذا صحيحًا
فسنرى قيمة t مساوية للقيمة ،
.التي رأيناها وهي 5% في هذا الوقت أو أكبر منها
عند إجراء اختبار إحصائي مثل هذا، عادةً ما نعين قيمة
.عظمى لـ P. دعنا نسمِّها القيمة العظمى لـ P
إذا كانت قيمة P أقل من القيمة العظمي لـ P، فسنرفض
حينئذ فرضية null. في حالة العينتين، يعادل هذا
القول بأن متوسط العينتين
غير متساوٍ. يمكن أن يكون حساب قيمة P هذه لمجموعة
.البيانات المحددة نوعًا من الملل
.بامتنان، نادرًا ما نضطر إلى تنفيذ هذه العملية الحسابية صراحةً
後半のプロジェクトの為にも
2つの標本を比較するt検定について
詳しく見ていきましょう
数種類あるt検定のうちのどれを行うかは
データから何を推定するかによって決まります
2つの標本のサイズや
分散が同等なのかも関係してきます
有名なウェルチのt検定における
分散について説明しましょう
これは標本のサイズや分散が
同等であると仮定しません
ウェルチ検定では次のような式で統計量tを計算します
tを求めるにはμ₁-μ₂を
√σ₁²/N₁+σ₂²/N₂で割ります
μiは標本i番目の標本平均値
σ²iはi番目の標本分散値
Niはi番目の標本サイズを表します
次の式を使って自由度を表わすνも計算できます
νを求めるには
(σ₁²/N₁+σ₂²/N₂)を2乗したものを
σ₁⁴/N₁²ν₁と
σ₂⁴/N₂²ν₂の和で割ります
νiはN¡-1と等しく
これはi番目の分散の推定量に関係する自由度です
自由度についてあまり聞いたことがない方は
統計学コースで
ブラッシュアップすることをお勧めします
下記にリンクを張っておきます
tとνの値が分かればpの値を求めることができます
p値とは帰無仮説が真である場合に
実際に得られた検定統計量と同じか
それよりも極端な値を取る確率です
帰無仮説が真である確率を
示しているわけではありません
左打ちと右打ちの野球選手におけるデータから
打率についての比較を行います
pの値が0.05である場合
両者に違いがないという帰無仮説において
仮説が正しかったとしても
5%の確率でt値は同等かそれ以上になります
このような検定を行う時には
臨界値であるp criticalを設定します
pの値がp criticalより小さければ
仮説を棄却します
つまり2つの標本を扱う場合は
平均値は同等ではないということになります
データセットのp値を計算するのは大変ですが
明示的に計算する必要はほとんどありません
Vamos falar mais sobre as duas amostras de t-test, já que queremos
comparar duas amostras diferentes em nosso projeto de classe. Há algumas
versões diferentes de t-test que podem ser utilizadas
, e elas dependem realmente de quais suposições fazemos sobre os
dados. Podemos querer fazer perguntas como, as nossas
amostras têm o mesmo tamanho?, e, elas tem a mesma
variância? . Vamos discutir mais detalhadamente uma variante de t-test chamada Welch's
t-test, já que é a mais geral. Ela não supõe
tamanho de amostra igual nem variância igual. No Welch's
t-test, calculamos uma t-statistic usando a equação a seguir.
T igual mu1 menos mu2, dividido pela
raiz quadrada de sigma1 ao quadrado sobre n1. Mais
sigma 2 ao quadrado sobre n2. Em que mu I é a média da amostra para a i-ésima amostra.
Sigma ao quadrado I é a variância da amostra para a
i-ésima amostra. E NI é o tamanho da amostra
para a i-ésima amostra. Também vamos querer estimar o número de graus
de liberdade, nu, usando a equação a seguir.
Nu é aproximadamente igual à: quantidade de sigma1
ao quadrado, sobre n1, mais sigma2 ao quadrado sobre n2 ao quadrado, sobre sigma1
à quarta potência sobre n1 ao quadrado nu1, mais sigma2 à quarta potência, sobre n2 ao quadrado nu2.
Em que mu I é igual à nu I menos um, e
esse é o grau de liberdade associado à estimativa da i-ésima
variância. Se não estiver familiarizado com graus de liberdade, pode ser
uma boa ideia reciclar seus conceitos de estatísticas
com o curso de introdução a estatísticas da Audacity. Um link é
fornecido nos Comentários do instrutor. Certo, uma vez que temos
esses dois valores, podemos estimar o valor de P. Conceitualmente, o
valor de P é a probabilidade de obter a estatística de teste, pelo menos,
tão extrema quanto a que observamos,
supondo que a hipótese nula fosse verdadeira. O valor
de P não é a probabilidade da hipótese nula
ser verdadeira considerando os dados. Repetindo, apenas como um
experimento, digamos que estivéssemos testando quais jogadores
de beisebol, destros ou canhotos, foram melhores rebatedores examinando
a média das rebatidas. Se o valor de P
fosse 0,05, isso significaria que, mesmo que não houvesse
diferença entre batedores destros e canhotos, uma vez que
essa é nossa hipótese nula, mesmo que fosse verdadeiro,
veríamos um valor de t, igual ou maior
àquele que vimos 5% do tempo.
Ao executar um teste estatístico como este, geralmente definimos
um valor crítico de P. Vamos chamá-lo de P crítico.
Se P ficasse abaixo de P crítico, rejeitaríamos
a hipótese nula. Nos dois casos da amostra, isso é equivalente a
afirmar que a média de nossas duas amostras
não é igual. Calcular esse valor de P para um
determinado conjunto de dados pode ser um pouco tedioso.
Felizmente, raramente temos que executar esse cálculo explicitamente.