# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# plotSlice

Class: GeneralizedLinearModel

Plot of slices through fitted generalized linear regression surface

## Syntax

`plotSlice(mdl)h = plotSlice(mdl)`

## Description

`plotSlice(mdl)` creates a new figure containing a series of plots, each representing a slice through the regression surface predicted by `mdl`. For each plot, the surface slice is shown as a function of a single predictor variable, with the other predictor variables held constant.

`h = plotSlice(mdl)` returns handles to the lines in the plot.

## Tips

• If there are more than eight predictors, `plotSlice` selects the first five for plotting. Use the Predictors menu to control which predictors are plotted.

• The Bounds menu lets you choose between simultaneous or non-simultaneous bounds, and between bounds on the function or bounds on a new observation.

## Input Arguments

 `mdl` Generalized linear model, as constructed by `fitglm` or `stepwiseglm`.

## Output Arguments

 `h` Vector of handles to lines or patches in the plot.

## Examples

expand all

Create a slice plot of a Poisson generalized linear model.

Generate artificial data for the model using Poisson random numbers with two underlying predictors `X(1)` and `X(2)`.

```rng('default') % for reproducibility rndvars = randn(100,2); X = [2+rndvars(:,1),rndvars(:,2)]; mu = exp(1 + X*[1;2]); y = poissrnd(mu);```

Create a generalized linear regression model of Poisson data.

`mdl = fitglm(X,y,'y ~ x1 + x2','distr','poisson');`

Create the slice plot.

`plotSlice(mdl)`

Drag the `x1` prediction line to the right and view the changes in the prediction and the response curve for the `x2` predictor.