logistic_regression
Perform ordinal logistic regression.
Suppose y takes values in k ordered categories, and let
P_i (x)
be the cumulative probability that y
falls in one of the first i categories given the covariate
x. Then
[intercept, slope] = logistic_regression (y, x) |
fits the model
logit (P_i (x)) = x * slope + intercept_i, i = 1 … k-1 |
The number of ordinal categories, k, is taken to be the number
of distinct values of round (y)
. If k equals 2,
y is binary and the model is ordinary logistic regression. The
matrix x is assumed to have full column rank.
Given y only, intercept = logistic_regression (y)
fits the model with baseline logit odds only.
The full form is
[intercept, slope, dev, dl, d2l, P, stats] = logistic_regression (y, x, print, intercept, slope) |
in which all output arguments and all input arguments except y are optional.
Setting print to 1 requests summary information about the fitted model to be displayed. Setting print to 2 requests information about convergence at each iteration. Other values request no information to be displayed. The input arguments intercept and slope give initial estimates for intercept and slope.
The returned value dev holds minus twice the log-likelihood.
The returned values dl and d2l are the vector of first and the matrix of second derivatives of the log-likelihood with respect to intercept and slope.
P holds estimates for the conditional distribution of y given x.
stats returns a structure that contains the following fields:
Source Code: logistic_regression