www.gusucode.com > stats 源码程序 matlab案例代码 > stats/EstimatePredictiveMeasuresOfAssociationExample.m

    %% Estimate Predictive Measures of Association for Surrogate Splits
%%
% Load the |carsmall| data set. Specify |Displacement|, |Horsepower|, and
% |Weight| as predictor variables.

% Copyright 2015 The MathWorks, Inc.

load carsmall
X = [Displacement Horsepower Weight];
%%
% Grow a regression tree using |MPG| as the response.  Specify to use
% surrogate splits for missing values.
tree = fitrtree(X,MPG,'surrogate','on');
%%
% Find the mean predictive measure of association between the predictor
% variables.
ma = surrogateAssociation(tree)
%%
% Find the mean predictive measure of association averaged over the
% odd-numbered nodes in |tree|.
N = 1:2:tree.NumNodes;
ma = surrogateAssociation(tree,N)