Paired t_test_2 code problem
Afficher commentaires plus anciens
Hi,
I hope this is something basic that someone can quickly point out my error. I am currently on Octave but the problem transfers to matlab also.
I am trying to perform a paired t-test on two data groups sorted by a variable. To test my code I have created a short test spreadsheet that I know the answer to so I can compare.
Below is the code I have used to separate into two groups, it worked fine when I had equal groups in my array but now they are uneven (10 and 9).
Can anyone tell me how I can arrange by the vairable in column 2 and assign to x and y accordingly?
clear
cd "/home/james/mystuff"
filename= 'testttest.csv'
num = csvread(filename);
Xpos=num(:,1);
G=reshape(num, 11,4);
x=G(:,1);
y=G(:,2);
[pval,t,df] = t_test_2(x,y)
The layout in the spreadsheet is two columns, 1st is the dependent variable and the 2nd is the independent.
3 commentaires
Thorsten
le 20 Fév 2013
The function in the statistics toolbox is called ttest. Try
[h p ci stats] = ttest(x, y)
Jimmy
le 20 Fév 2013
Tom Lane
le 20 Fév 2013
You mention a paired t-test. In my experience this is a test on the difference between the two samples. I don't understand how you could have a paired t-test when the two samples have different sizes.
Réponses (0)
Catégories
En savoir plus sur Debugging and Analysis dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!