aoctool
Interactive analysis of covariance
Syntax
aoctool(x,y,group)
aoctool(x,y,group,alpha)
aoctool(x,y,group,alpha,xname,yname,gname)
aoctool(x,y,group,alpha,xname,yname,gname,displayopt
)
aoctool(x,y,group,alpha,xname,yname,gname,displayopt
,model
)
h = aoctool(...)
[h,atab,ctab] = aoctool(...)
[h,atab,ctab,stats] = aoctool(...)
Description
aoctool(x,y,group)
fits a separate line to the column
vectors, x
and y
, for each group defined by the values
in the array group
. group
may be a categorical variable,
numeric vector, character array, string array, or cell array of character vectors. These types
of models are known as one-way analysis of covariance (ANOCOVA) models. The output consists of
three figures:
An interactive graph of the data and prediction curves
An ANOVA table
A table of parameter estimates
You can use the figures to change models and to test different
parts of the model. More information about interactive use of the aoctool
function
appears in Analysis of Covariance Tool.
aoctool(x,y,group,alpha)
determines the confidence levels of the prediction intervals. The
confidence level is 100(1-alpha)
%. The default
value of alpha
is 0.05.
aoctool(x,y,group,alpha,xname,yname,gname)
specifies
the name to use for the x
, y
, and g
variables in the graph and tables. If you enter simple variable names for the
x
, y
, and g
arguments, the
aoctool
function uses those names. If you enter an expression for one
of these arguments, you can specify a name to use in place of that expression by supplying
these arguments. For example, if you enter m(:,2)
as the
x
argument, you might choose to enter 'Col 2'
as
the xname
argument.
aoctool(x,y,group,alpha,xname,yname,gname,
enables
the graph and table displays when displayopt
)displayopt
is 'on'
(default)
and suppresses those displays when displayopt
is 'off'
.
aoctool(x,y,group,alpha,xname,yname,gname,
specifies
the initial model to fit. The value of displayopt
,model
)model
can
be any of the following:
'same mean'
— Fit a single mean, ignoring grouping'separate means'
— Fit a separate mean to each group'same line'
— Fit a single line, ignoring grouping'parallel lines'
— Fit a separate line to each group, but constrain the lines to be parallel'separate lines'
— Fit a separate line to each group, with no constraints
h = aoctool(...)
returns
a vector of handles to the line objects in the plot.
[h,atab,ctab] = aoctool(...)
returns
cell arrays containing the entries in ANOVA table (atab
)
and the table of coefficient estimates (ctab
).
(You can copy a text version of either table to the clipboard by using
the Copy Text
item on the Edit menu.)
[h,atab,ctab,stats] = aoctool(...)
returns
a stats
structure that you can use to perform a
follow-up multiple comparison test. The ANOVA table output includes
tests of the hypotheses that the slopes or intercepts are all the
same, against a general alternative that they are not all the same.
Sometimes it is preferable to perform a test to determine which pairs
of values are significantly different, and which are not. You can
use the multcompare
function
to perform such tests by supplying the stats
structure
as input. You can test either the slopes, the intercepts, or population
marginal means (the heights of the curves at the mean x
value).
Examples
This example illustrates how to fit different models non-interactively. After loading the smaller car data set and fitting a separate-slopes model, you can examine the coefficient estimates.
load carsmall [h,a,c,s] = aoctool(Weight,MPG,Model_Year,0.05,... '','','','off','separate lines'); c(:,1:2) ans = 'Term' 'Estimate' 'Intercept' [45.97983716833132] ' 70' [-8.58050531454973] ' 76' [-3.89017396094922] ' 82' [12.47067927549897] 'Slope' [-0.00780212907455] ' 70' [ 0.00195840368824] ' 76' [ 0.00113831038418] ' 82' [-0.00309671407243]
Roughly speaking, the lines relating MPG
to Weight
have
an intercept close to 45.98 and a slope close to -0.0078. Each group's
coefficients are offset from these values somewhat. For instance,
the intercept for the cars made in 1970 is 45.98-8.58 = 37.40.
Next, try a fit using parallel lines. (The ANOVA table shows that the parallel-lines fit is significantly worse than the separate-lines fit.)
[h,a,c,s] = aoctool(Weight,MPG,Model_Year,0.05,... '','','','off','parallel lines'); c(:,1:2) ans = 'Term' 'Estimate' 'Intercept' [43.38984085130596] ' 70' [-3.27948192983761] ' 76' [-1.35036234809006] ' 82' [ 4.62984427792768] 'Slope' [-0.00664751826198]
Again, there are different intercepts for each group, but this time the slopes are constrained to be the same.
Version History
Introduced before R2006a