Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.

plotAdjustedResponse

Clase: LinearModel

Adjusted response plot for linear regression model

Sintaxis

plotAdjustedResponse(mdl,var)
h = plotAdjustedResponse(mdl,var)
h = plotAdjustedResponse(mdl,var,Name,Value)

Description

plotAdjustedResponse(mdl,var) gives an adjusted response plot for the variable var in the mdl regression model.

h = plotAdjustedResponse(mdl,var) returns handles to the lines in the plot.

h = plotAdjustedResponse(mdl,var,Name,Value) plots with additional options specified by one or more Name,Value pair arguments.

Argumentos de entrada

expandir todo

Full, fitted linear regression model, specified as a LinearModel object constructed using fitlm or stepwiselm.

Variable for adjusted response plot, specified as a variable name or an integer value representing the index of a variable in mdl.CoefficientNames.

Tipos de datos: char | string | single | double

Argumentos de par nombre-valor

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Nota

The plot property name-value pairs apply to the first returned handle h(1).

Color of the line or marker, specified as the comma-separated pair consisting of 'Color' and a ColorSpec specification. For details, see linespec.

Line style, specified as the comma-separated pair consisting of 'LineStyle' and a Line Properties specification. For details, see linespec.

Width of the line or edges of filled area, in points, specified as the comma-separated pair consisting of 'LineWidth' and a positive numeric value. One point is equal to 1/72 inch.

Color of the marker or edge color for filled markers, specified as the comma-separated pair consisting of 'MarkerEdgeColor' and a ColorSpec specification. For details, see linespec.

Color of the marker face for filled markers, specified as the comma-separated pair consisting of 'MarkerFaceColor' and a ColorSpec specification. For details, see linespec.

Size of the marker in points, specified as the comma-separated pair consisting of 'MarkerSize' and a positive numeric value. One point is 1/72 inch.

Output Arguments

expandir todo

Graphics handles, returned as a vector of graphics handles corresponding to the lines or patches in the plot.

Ejemplos

expandir todo

Plot the adjusted responses of 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 = categorical(Model_Year);
mdl = fitlm(tbl,'MPG ~ Year + Weight^2');

Plot the effect of 'Weight' averaged over Year values.

plotAdjustedResponse(mdl,'Weight')

Plot the effect of Year averaged over 'Weight' values. Include the h output.

h = plotAdjustedResponse(mdl,'Year');

Change the adjusted data to black x instead of red o.

h(1).Marker = 'x';
h(1).Color = 'k';

Más acerca de

expandir todo

Sugerencias

  • For many plots, the Data Cursor tool in the figure window displays the x and y values for any data point, along with the observation name or number.