I want to compare the means for a variable among five different groups. To do so, I use fitlm to perform an ANOVA. The following code provides an example that closely resembles my own data:
x = repmat([1:5]',[10,1]);
y = (x-4).^2 + randn([size(x),1]);
grp = categorical(x);
This yields an intercept, which represents the mean for grp 1, and coefficients for the other groups that represent the difference of the mean for those groups relative to the intercept.
I am unsure (and would also like to know) how to then calculate the standard error (SE) of the group means from the combination of the SE for the intercept and SE for the coefficients. I therefore tried omitting the intercept, expecting coefficients for each group
Here there is indeed no intercept, but also no coefficient for group 1. Where did it go?
Aside, as a workaround, I tried dummy coding the group variable
grp_dummy = dummyvar(grp);
This gives me the expected result, but the SE correspond to the SE of the intercept in the first model. How then do the SE of the coefficients of the first model fit in with this latter model?