Vous êtes sur la page 1sur 10

Title

[R] ttest -- Mean-comparison tests

Syntax

One-sample mean-comparison test

ttest varname == # [if] [in] [, level(#)]

Two-sample mean-comparison test (unpaired)

ttest varname1 == varname2 [if] [in], unpaired [unequal welch level(#)]

Two-sample mean-comparison test (paired)

ttest varname1 == varname2 [if] [in] [, level(#)]

Two-group mean-comparison test

ttest varname [if] [in] , by(groupvar) [options1]

Immediate form of one-sample mean-comparison test

ttesti #obs #mean #sd #val [, level(#)]

Immediate form of two-sample mean-comparison test

ttesti #obs1 #mean1 #sd1 #obs2 #mean2 #sd2 [, options2]

options1

Description

-----------------------------------------------------------------------Main * by(groupvar) unequal welch level(#) variable defining the groups unpaired data have unequal variances use Welch's approximation set confidence level; default is level(95)

-----------------------------------------------------------------------* by(groupvar) is required.

options2

Description

-----------------------------------------------------------------------Main unequal welch unpaired data have unequal variances use Welch's approximation

level(#)

set confidence level; default is level(95)

------------------------------------------------------------------------

Menu

one-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > One-sample mean-comparison test

two-sample, unpaired

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-sample mean-comparison test

two-sample, paired

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Mean-comparison test, paired data

two-group

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-group mean-comparison test

immediate command: one-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > One-sample mean-comparison calculator

immediate command: two-sample

Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Two-sample mean-comparison calculator

Description

ttest performs t tests on the equality of means. ttest tests that varname has a mean of #.

In the first form,

In the second form, ttest

tests that varname1 and varname2 have the same mean, assuming unpaired data. the same mean, assuming paired data. In the fourth form, ttest tests that In the third form, ttest tests that varname1 and varname2 have

varname has the same mean within the two groups defined by groupvar.

ttesti is the immediate form of ttest; see immed.

For the equivalent of a two-sample t test with sampling weights (pweights), use the svy: mean command with the over() option, and then use lincom; also see [SVY] svy postestimation.

Options

+------+ ----+ Main +------------------------------------------------------------

by(groupvar) specifies the groupvar that defines the two groups that ttest will use to test the hypothesis that their means are equal. Specifying by(groupvar) implies an unpaired (two sample) t test. Do not confuse the by() option with the by prefix; you can specify both.

unpaired specifies that the data be treated as unpaired.

The unpaired

option is used when the two set of values to be compared are in different variables.

unequal specifies that the unpaired data not be assumed to have equal variances.

welch specifies that the approximate degrees of freedom for the test be obtained from Welch's formula (1947) rather than Satterthwaite's approximation formula (1946), which is the default when unequal is specified. Specifying welch implies unequal.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

Examples

. sysuse auto . ttest mpg==20

(setup) (one-sample mean-comparison test)

. webuse fuel . ttest mpg1==mpg2

(setup) (two-sample mean-comparison test)

. webuse fuel3 . ttest mpg, by(treated)

(setup) (two-group mean-comparison test)

(no setup required) . ttesti 24 62.6 15.8 75 (immediate form; n=24, m=62.6, sd=15.8; test m=75)

Saved results

ttest and ttesti save the following in r():

Scalars r(N_1) r(N_2) r(p_l) r(p_u) r(p) r(se) r(t) r(sd_1) sample size n_1 sample size n_2 lower one-sided p-value upper one-sided p-value two-sided p-value estimate of standard error t statistic standard deviation for first variable

r(sd_2) r(sd) r(mu_1) r(mu_2) r(df_t)

standard deviation for second variable combined standard deviation x_1 bar, mean for population 1 x_2 bar, mean for population 2 degrees of freedom

References

Satterthwaite, F. E. 1946. variance components.

An approximate distribution of estimates of Biometrics Bulletin 2: 110-114.

Welch, B. L. 1947.

The generalization of `student's' problem when

several different population variances are involved. Biometrika 34: 28-35.

Bilgi Bankas SPSS - Bamsz rneklem t Testi

statistik Merkezi Puan

Bamsz rneklem t-testinde ise tek rneklem t-testinden farkl olarak iki ayr grubun ortalamalar karlatrlr. rnein feminizm konusunda hakknda erkek ve kadnlarn grleri arasnda fark olup olmadn test etmek isterseniz bamsz rneklem t-testini kullanabilirsiniz. Benzer ekilde evli ve bekar kadnlarn kozmetik harcamalar arasnda fark olup olmadn bulmak iin kullanlabilecek yntem yine bamsz rneklem t-testidir.

imdi Bamsz rneklem t Testinin nasl uygulandn bir rnek zerinde inceleyelim.

rnek: Bir snfta kz ve erkek rencilerin matematik dersinden aldklar notlar arasnda anlaml bir fark var mdr?

Bu rnek iin H0 ve H1 hipotezleri ise u ekilde formle edilebilir.

H0 = Kz ve erkek rencilerin matematik dersinden aldklar notlar arasnda anlaml bir fark yoktur.

H1 = Kz ve erkek rencilerin matematik dersinden aldklar notlar arasnda anlaml bir fark vardr.

Bamsz rneklem t Testi iin ncelikle aadaki mnleri kullann:

ANALYZE COMPARE MEANS INDEPENDENT SAMPLE T TEST

Karnza aadaki Independent-Sample T Test iletiim penceresi gelecektir. Bu pencereden inceleyeceiniz deikeni (rnekte, Matematik Notu) Test Variable(s) kutucuunun iine, gruplandrmada kullanacanz deikeni (rnekte, Cinsiyet) Grouping Variable satrna, aradaki oklar kullanarak gnderin.

imdi kullanacanz gruplar tanmlamanz gerek. Bunun iin Define Groups dmesini tklayn. Karnza aadaki iletiim kutusu gelecektir. Burada Kzlar 1, Erkeler 2 ile temsil edildiinden bu rakamlar Group 1 ve Group 2 satrlarna girdik. Bunun dnda rnein gruplamay Eitim Dzeyi deikenine gre yapmay dndnz ve niversite mezunlar ile lisansst eitim grenler karlatrmak istiyorsunuz. Kodlarnzda 1 lkretim, 2 Lise, 3 niversite 4Lisanst eklinde olsun bu durumda Group 1 ve Group 2 satrlarna srasyla 3 ve 4 rakamlarn girmeniz gerekecek. Eer lise ve daha az eitim grmler ile niversite ve daha yksek eitime sahip olanlar karlatrmak istiyorsanz Cut point ifadesinin nndeki radyo dmesini iaretlemeniz ve bu satra 2 deerini girmeniz yeterli olacaktr. SPSS Cut point satrna girilen deeri < = (kk eit) olarak kabul eder.

imdi rneimize dnelim. Srasyla Continue ve OK tularn tklaynz. Karnza aadakiler benzer tablolar gelecektir.

Group Statistics tablosunda her bir grupta ka kii bulunduu, bunlarn ortalama deerleri (rnekte, Matematik dersinden aldklar ortalama puanlar) ile bunlara ait standart sapma ve standart hata deerleri yer almaktadr.

Tabloda kzlarn ortalamasnn erkeklerden daha yksek olduu grlmektedir. Ancak bu farkn rastlantsal m yoksa gerek bir baarnn gstergesi mi olduunu belirleyebilmek iin Independent Samples Test tablosunu incelememiz gerekir.

Independent Samples Test tablosunun Sig. (Anlamllk) stunundaki deerin 0,29 olduu grlmektedir. Sz konusu deer 0,05den kk olduu iin, cinsiyet ile matematik dersi baars arasndaki ilikinin p < 0,05 dzeyinde istatistiksel olarak anlaml olduunu syleyebiliriz.

rneimizde t-testi sonular ve gruplara ait ortamlalar birlikte deerlendirildiinde, H0 hipotezi reddedilmi ve kz rencilerin matematik dersinde erkelerden daha baarl olduu sonucuna ulalmtr.

Vous aimerez peut-être aussi