Using aoctool for a 1-way ANCOVA (+plot)
12 次查看(过去 30 天)
显示 更早的评论
I have two groups of subjects, each with scores on a memory task and on an IQ test. I would like to check whether there's a significant group difference in the memory measure while controlling for IQ.
I reckoned that for that, I need a 1-way between-subjects ANCOVA, with DV=memory score, predictor=group, and covariate=IQ. The Matlab command to achieve this appears to be aoctool.
Following the example in its (rather incomplete) documentation , and having coded group as a categorical variable, I typed:
[h,a,c,s] = aoctool(PIQ, mem, group, 0.05, 'PIQ','mem','group','off','separate lines');
However, that just gives me the slopes&intercepts for the groups, which does not help me. What I need is a categorical comparison between the groups, rather than a regression between x vs y, as the aoctool example seems to put it.
How can I use aoctool to:
- obtain a p-value for the between-subjects effect of the group factor?
- scatter-plot the memory score as a function of IQ, with groups color-coded as in the documentation example? The above command does return a figure handle h, but it's an empty matrix (even in the case of the example dataset!), and I don't think it can be used to base a plot on it.
Thanks for any help!
采纳的回答
Matthias Stangl
2017-11-30
Hey,
Unfortunately, I also do not know how to get what you want using aoctool. However, given that no one else has replied so far, I thought you might be interested in alternative ways...
As I just tried to solve a similar problem, I came across these two solution, which both work fine for carrying out an ACOVA as you described: 1. There is a tool on matlabcentral fileexchange, which I found very useful and easy to use: https://de.mathworks.com/matlabcentral/fileexchange/27014-mancovan
2. Brani Vidakovic gives code examples in the book "Engineering Biostatistics: An Introduction using MATLAB and WinBUGS". I think, Example 14.8. describes almost exactly what you want, so you can just re-program what is shown in the book.
Best, Matthias
2 个评论
Xiaoran Song
2018-1-31
many thanks Matthias! by the way, the example from Brani Vidakovic's book is example 16.7 from chapter 16-8. The example clearly illustrates the one-way ANCOVA
更多回答(1 个)
Matyas Varga
2018-1-25
编辑:Walter Roberson
2018-1-25
You can perform a multiple comparison test by using the stats output structure from aoctool as input to the multcompare function. The multcompare function can test either slopes, intercepts, or population marginal means (the predicted MPG of the mean weight for each group). The example in Analysis of Covariance Tool shows that the slopes are not all the same, but could it be that two are the same and only the other one is different? You can test that hypothesis.
multcompare(stats,0.05,'on','','s')
ans =
1.0000 2.0000 -0.0012 0.0008 0.0029
1.0000 3.0000 0.0013 0.0051 0.0088
2.0000 3.0000 0.0005 0.0042 0.0079
This matrix shows that the estimated difference between the intercepts of groups 1 and 2 (1970 and 1976) is 0.0008, and a confidence interval for the difference is [–0.0012, 0.0029]. There is no significant difference between the two. There are significant differences, however, between the intercept for 1982 and each of the other two. The graph shows the same information.
Note that the stats structure was created in the initial call to the aoctool function, so it is based on the initial model fit (typically a separate-lines model). If you change the model interactively and want to base your multiple comparisons on the new model, you need to run aoctool again to get another stats structure, this time specifying your new model as the initial model.
1 个评论
AmirH
2019-8-18
anyone solved the between group pvalue issue?
didn't quite handle the mancovan...
please help :)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!