How do I compute point-by-point t tests between two 101 data point vectors?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two data vectors with 101 data points each. I want to run a t-test between the first elements of both vectors, between the 2nd elements, and so on. Here is a loop I wrote to run the 101 t-tests:
for i = 1:101
[h(i),pr(i)] = ttest(AvgAngle_r,AvgAngle_ASDr(i),'Alpha',0.05);
end
I get 101 h and p values, but I want to make sure that this is accurate, considering I do not have any standard deviations.
Thanks!
4 comentarios
the cyclist
el 8 de Sept. de 2015
I'm still trying to understand your data. Is each value of AvgAngle_r [e.g. AvgAngle_r(17)] itself an average over multiple measurement? I guess the name suggests that.
If you have the data for those multiple measurements, then it seems to me that that is what you want to compare with the t test. (The MATLAB ttest function works on the raw underlying data, not the averages.) That comparison will tell you whether the two average values are significantly different, or just what you would expect from random variation.
If you don't have those data at hand, then you can probably still do the comparison if you have the average, the standard deviation, and the number of measurements that were used to calculate the averages. You'll just have to do the calculation yourself, based on the formula. You can see it here: https://en.wikipedia.org/wiki/Student%27s_t-test#Calculations. I think you'll want the "independent two-sample t-test".
But, as Walter commented, all the autocorrelation in the individual stride probably busts all the assumptions underlying the test.
You are presumably at an academic institution. Might you have a consulting statistician available to you?
Respuestas (1)
Star Strider
el 7 de Sept. de 2015
You cannot test two populations with any test point-by-point. A point has a mean equal to the value of that point, and a variance (and standard deviation) of zero. By definition, they are statistically different from each other unless they are exactly equal.
If you are testing individual values of ‘AvgAngle_ASDr(i)’ against the population described by the 101 values of ‘AvgAngle_r’, your code is technically correct. However it’s not obvious to me that this is superior to doing testing the two populations.
With a population of 101 in each variable, the ztest and the normal distribution will also be appropriate.
8 comentarios
Walter Roberson
el 8 de Sept. de 2015
Do the 101 values correspond to percent of stride in increments of 1%? If so then the adjacent values are going to be correlated for any one measured stride and there is an implicit hypothesis that for any one person all of their measured angles are are periodic with period one stride, which I suspect is not justifiable under the range of motions to be studied.
Ver también
Categorías
Más información sobre Hypothesis Tests en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!