ttest2 with a group describing independent values (statistics)
Show older comments
Hi,
I use Matlab ttest2 function to assess if observations from vectors x and y come from populations with different means. The function works fine if vectors are passed as arguments:
[h, p] = ttest2(x, y)
My data includes biomarker (as blood pressure) in x and y during day and night, respectively. Therefore, we assess paired groups into a matrix [x y], where:
x = [120, 110.5, 123, 140, 142, 151, 121, 119, 110, 115, 130]' % there are more observations
y = [118, 110, 120, 135, 134, 140, 120, 116, 110, 113 ,127]' % there are more observations
m = [x y];
The point is that we also want to compare unpaired or independent groups (males vs. females), at day and night. For this, a third column is included defining the group (male=0, female=1) in matrix [x y g], where
g = [0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1]' % there are more observations
m = [x y g];
Function anova1() has the functionality of including a group as second argument for each observation in x or y.
I wonder if it is possible to use ttest2 function in anova1() fashion, something like
[h, p] = ttest2(x, g) % where x contains the observation and g contains categorical values
To compare the biomarker, e.g. during night, between male and female, without rearrenge vectors
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!