Categories &

Functions List

Function Reference: glmval

statistics: yhat = glmval (b, X, link)
statistics: [yhat, y_lo, y_hi] = glmval (b, X, link, stats)
statistics: […] = glmval (…, Name, Value)

Predict values for a generalized linear model.

yhat = glmval (b, X, link) returns the predicted values for the generalized linear model with a vector of coefficient estimates b, a matrix of predictors X, in which each column corresponds to a distinct predictor variable, and a link function link, which can be any of the character vectors, numeric scalar, or custom-defined link functions used as values for the "link" name-value pair argument in the glmfit function.

[yhat, y_lo, y_hi] = glmval (b, X, link, stats) also returns the 95% confidence intervals for the predicted values according to the model’s statistics contained in the stats structure, which is the output of the glmfit function. By default, the confidence intervals are nonsimultaneous, and apply to the fitted curve instead of new observations.

[…] = glmval (…, Name, Value) specifies additional options using Name-Value pair arguments.

NameValue
"confidence"A scalar value between 0 and 1 specifying the confidence level for the confidence bounds.
"Constant"A character vector specifying whether to include a constant term in the model. Valid options are "on" (default) and "off".
"simultaneous"Specifies whether to include a constant term in the model. Options are "on" (default) or "off".
"size"A numeric scalar or a vector with one value for each row of X specifying the size parameter N for a binomial model.

See also: glmfit

Source Code: glmval

Example: 1

 

 x = [210, 230, 250, 270, 290, 310, 330, 350, 370, 390, 410, 430]';
 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, '-')

                    
plotted figure