Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

glmval - Generalized linear model values

Syntax

yhat = glmval(b,X,link)
[yhat,dylo,dyhi] = glmval(b,X,link,stats)
[...] = glmval(...,param1,val1,param2,val2,...)

Description

yhat = glmval(b,X,link) computes predicted values for the generalized linear model with link function link and predictors X. Distinct predictor variables should appear in different columns of X. b is a vector of coefficient estimates as returned by the glmfit function. link can be any of the strings used as values for the link parameter in the glmfit function.

[yhat,dylo,dyhi] = glmval(b,X,link,stats) also computes 95% confidence bounds for the predicted values. When the stats structure output of the glmfit function is specified, dylo and dyhi are also returned. dylo and dyhi define a lower confidence bound of yhat-dylo, and an upper confidence bound of yhat+dyhi. Confidence bounds are nonsimultaneous, and apply to the fitted curve, not to a new observation.

[...] = glmval(...,param1,val1,param2,val2,...) specifies optional parameter name/value pairs to control the predicted values. Acceptable parameters are:

ParameterValue

'confidence' — the confidence level for the confidence bounds

A scalar between 0 and 1

'size' — the size parameter (N) for a binomial model

A scalar, or a vector with one value for each row of X

'offset' — used as an additional predictor variable, but with a coefficient value fixed at 1.0

A vector

'constant'
  • 'on' — Includes a constant term in the model. The coefficient of the constant term is the first element of b.

  • 'off' — Omit the constant term

Examples

Fit a probit regression model for y on x. Each y(i) is the number of successes in n(i) trials.

x = [2100 2300 2500 2700 2900 3100 ...
     3300 3500 3700 3900 4100 4300]';
n = [48 42 31 34 31 21 23 23 21 16 17 21]';
y = [1 2 0 3 8 8 14 17 19 15 17 21]';
b = glmfit(x,[y n],'binomial','link','probit');
yfit = glmval(b,x,'probit','size',n);
plot(x, y./n,'o',x,yfit./n,'-','LineWidth',2)

References

[1] Dobson, A. J. An Introduction to Generalized Linear Models. New York: Chapman & Hall, 1990.

[2] McCullagh, P., and J. A. Nelder. Generalized Linear Models. New York: Chapman & Hall, 1990.

[3] Collett, D. Modeling Binary Data. New York: Chapman & Hall, 2002.

See Also

glmfit

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS