www.gusucode.com > stats 源码程序 matlab案例代码 > stats/EffectsPlotforFittedLinearRegressionModelExample.m
%% Effects Plot for Fitted Linear Regression Model % Plot the effects of two predictors in a fitted linear model. %% % Load the |carsmall| data and fit a linear model of the mileage as a function % of model year, weight, and weight squared. load carsmall tbl = table(MPG,Weight); tbl.Year = ordinal(Model_Year); mdl = fitlm(tbl,'MPG ~ Year + Weight^2'); %% % Create an effects plot. plotEffects(mdl) %% % The width of each horizontal line in the figure shows a confidence interval % for the effect on the response of the listed change in each predictor. % The estimated effect of changing |Year| from |70| to |82| is an increase % of about 8, and is between 6 and 10 with 95% confidence.