Code covered by the BSD License  

Highlights from
twostone

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 2.34 KB File ID: #19787

twostone

by Antonio Trujillo-Ortiz

 

01 May 2008 (Updated 05 May 2008)

Two-sample Student's t-test when one has only one observation.

| Watch this File

File Information
Description

This m-file is a two-sample Student's t-test when one of the samples has only one observation.

Inputs:
x - vector data of one of the samples
y - one data of the other sample
alpha - significance value (=0.05 by default)

Output:
Complete table of the Student's t-test

Required Products Statistics Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
05 May 2008 Jos x@y.z

since this function requires the stats toolbox, it is recommended to use the standard call to TTEST(X,M) where M is the single observation.

05 May 2008 Antonio Trujillo-Ortiz

Dear Jos,

Thanks for your note. But, please don’t confuse to the users. Your comment doesn’t have any statistical fundamental. You is refering to the one-sample Student’s t-test (ttest), of course comparing one sample mean with one hypothetical mean (expected), where the t-statistics is computed by,

t = (mean(x) – m)/se

where se = sqrt(var(x)/n)

The here proposed twostone m-file deals with two-sample when one of the samples has only one observation. Where,

1) m isn’t a mean, but an observation, for

2) the estimate standard error (se) is

se = sqrt(var(x)[(n+1)/n])

besides

3) the numerator of the t-statistic is

o – mean(x)

where o is the only one observation of one of the samples

Thus, for the next example (given in the twostone m-file)

x = 4.02 3.88 3.34 3.87 3.18 (sample with 5 observations)

y = 3.02 (sample with only one observation)

For this case, if you incorrectly use the ttest you get

t = 3.8303, with a se = 0.1666, and you should reject Ho

Using the adequate twostone m-file you get

t = - 1.5637, with a se = 0.4080, and you should accept Ho

So, this is not a matter of ‘form’, but of the correct statistical procedure.

Yours,

Antonio Trujillo-Ortiz

05 May 2008 Jos x@y.z

Dear Antonio, I stand corrected. Maybe you can incorporate your explanation into your file and description?

05 May 2008 Antonio Trujillo-Ortiz

Dear Jos,

I think that without greater preambles. The description and the explanation have always been incorporated in the twostone m-file. Statistically speaking, this function has nothing to do with the ttest. This is another Student's t-test approach.

Yours,

Antonio Trujillo-Ortiz

Please login to add a comment or rating.
Updates
05 May 2008

It was added an appropriate format to cite this file.

Tag Activity for this File
Tag Applied By Date/Time
statistics Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51
probability Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51
students ttest Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51
twosample Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51
independent samples Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51
one observation Antonio Trujillo-Ortiz 22 Oct 2008 09:59:51

Contact us at files@mathworks.com