How do I do a ttest and get a pvalue?

So my question is more complicated then the title suggests. I have a set of 7 participants each with 180 ratings (90 per location). I am very new at MatLab as in I really suck at it. With the help of a pro I have my Excel file of ratings from participants in MatLab form now. He has written code so I have a t-test pvalue of the overall data. What I need to know is how to find(write code to find) the p-value for each individual texture(arm vs hand) pleasantness rating. I have the overall mean values for each texture in each location. I just need to know if there is a significant difference for each separate texture.
>> get_all_hairy_data
>>
>> ratings
ratings =
0.5754 0.8330
0.9510 1.1172
0.9332 1.2223
0.2849 0.2739
So my first column is arm - second column is finger data. (this is not the whole data set, 30 textures in all)
Not sure if my question even makes sense.
My overall ttest
[h,p] = ttest(ratings(:,1),ratings(:,2))
h =
1
p =
0.0341
What I would like to know is my p-value fore each individual texture?

Réponses (1)

Star Strider
Star Strider le 6 Août 2014

0 votes

If I understand your question correctly, you want to do a multiple-comparison test between all the various textures within your test subjects. Unfortunately, a paired t-test isn’t going to get you there. I would use multcompare with 'ComparisonType','scheffe'.
I apologise for seeming to make your problem more complicated rather than simplifying it (it will take a fair amount of coding and experimentation), but I believe this will get you the results you want.
If your version of MATLAB supports the table data type, I suggest you use tables.
If you’re just beginning to learn MATLAB, all this is going to be a bit much. You’ll likely need help from a colleague to get everything set up and coded correctly. If it makes you feel any better, from a statistical perspective, this is very much a non-trivial problem.

2 commentaires

Carrie Balcer
Carrie Balcer le 6 Août 2014
Thank you for your answer - Yes since I am very new with MatLab that is a bit much. I can alter code that is already written a bit (very very little bit) to get the answer I need or use that code to plot/get means etc... but since I do not know how to write a multcompare or what comparisontype and scheffe even are I think I am going to need more help. Thank you anyway.
Star Strider
Star Strider le 6 Août 2014
My pleasure!
I provided a hyperlink to multcompare in the first paragraph of my Answer, so you can click on it to go directly to the online documentation. It describes 'ComparisonType', and I suggested 'scheffe' because it is likely best for your application. You might have to visit your uni library or bookstore to get a book on multivariate statistics to understand what the functions are doing and how best to interpret your results.
And to quote Hitchhiker’s Guide to the Galaxy, Don’t Panic!

Connectez-vous pour commenter.

Catégories

Commenté :

le 6 Août 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by