Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Data Manipulation > Numerical Data > Statistical Model Analysis >
Mathematica > Data Manipulation > Statistics > Statistical Model Analysis >
Mathematica > Mathematics and Algorithms > Statistics > Statistical Model Analysis >

LogitModelFit

LogitModelFit[{y1, y2, ...}, {f1, f2, ...}, x]
constructs a binomial logistic regression model of the form 1/(1+ⅇ^(-(beta_0+beta_1f_1 +beta_2f_2 +...))) that fits the yi for successive x values 1, 2, ....
LogitModelFit[{{x11, x12, ..., y1}, {x21, x22, ..., y2}, ...}, {f1, ...}, {x1, x2, ...}]
constructs a binomial logistic regression model of the form 1/(1+ⅇ^(-(beta_0+beta_1f_1 +beta_2f_2 +...))) where the fi depend on the variables xk.
LogitModelFit[{m, v}]
constructs a binomial logistic regression model from the design matrix m and response vector v.
  • LogitModelFit returns a symbolic FittedModel object to represent the logistic model it constructs. The properties and diagnostics of the model can be obtained from model["property"].
  • The value of the best-fit function from LogitModelFit at a particular point x1, ... can be found from model[x1, ...].
  • With data in the form {{x11, x12, ..., y1}, {x21, x22, ..., y2}, ...}, the number of coordinates xi1, xi2, ... should correspond to the number of variables xi.
  • The yi are probabilities between 0 and 1.
  • Data in the form {y1, y2, ...}, is equivalent to data in the form {{1, y1}, {2, y2}, ...}.
  • LogitModelFit produces a logistic model of the form under the assumption that the original ni yi are independent observations following binomial distributions with mean .
  • In LogitModelFit[{m, v}], the design matrix m is formed from the values of basis functions fi at data points in the form {{f1, f2, ...}, {f1, f2, ...}, ...}. The response vector v is the list of responses {y1, y2, ...}.
  • For a design matrix m and response vector v, the model is where Beta is the vector of parameters to be estimated.
  • When a design matrix is used, the basis functions fi can be specified using the form LogitModelFit[{m, v}, {f1, f2, ...}].
Define a data set:
Fit a logistic model to the data:
See the functional forms of the model:
Evaluate the model at a point:
Plot the data points and the models:
Compute the fitted values for the model:
Visualize the deviance residuals:
Define a data set:
In[1]:=
Click for copyable input
Fit a logistic model to the data:
In[2]:=
Click for copyable input
Out[2]=
See the functional forms of the model:
In[3]:=
Click for copyable input
Out[3]=
Evaluate the model at a point:
In[4]:=
Click for copyable input
Out[4]=
Plot the data points and the models:
In[5]:=
Click for copyable input
Out[5]=
Compute the fitted values for the model:
In[6]:=
Click for copyable input
Out[6]=
Visualize the deviance residuals:
In[7]:=
Click for copyable input
Out[7]=
Fit data with success probability responses:
Weight by the number of observations for each predictor value:
This gives the same best fit function as success failure data:
Fit a model given a design matrix and response vector:
See the functional form:
Fit the model referring to the basis functions as x and y:
Obtain a list of available properties:
Fit a logit model:
Extract the original data:
Obtain and plot the best fit:
Obtain the fitted function as a pure function:
Get the design matrix and response vector for the fitting:
Examine residuals for a fit:
Visualize the raw residuals:
Visualize Anscombe residuals and standardized Pearson residuals in stem plots:
Fit a logit model to some data:
The estimated dispersion is one by default:
Use Pearson's Chi2 as the dispersion estimator instead:
Plot the deviances for each point:
Obtain the analysis of deviance table:
Get the residual deviances from the table:
Extract the numeric entries from the table:
Use Grid to add formatting:
Obtain a formatted table of parameter information:
Extract the column of z statistic values:
Get the unformatted array of values from the table:
Add formatting using Grid:
Add formatting via TableForm:
Fit some data containing extreme values to a logit model:
Check Cook distances to identify highly influential points:
Check the diagonal elements of the hat matrix to assess influence of points on the fitting:
Fit a logit model:
Plot the predicted values against the observed values:
Obtain a table of goodness of fit measures for a logit model:
Compute goodness of fit measures for all subsets of predictor variables:
Rank the models by AIC:
Perform other mathematical operations on the functional form of the model:
Integrate symbolically and numerically:
Find a predictor value that gives a particular value for the model:
The default gives 95% confidence intervals:
Use 99% intervals instead:
Set the level to 90% within FittedModel:
Fit a logit model:
Compute the covariance matrix using the expected information matrix:
Use the observed information matrix instead:
Fit a logit model:
Compute the covariance matrix:
Compute the covariance matrix estimating the dispersion by Pearson's Chi2:
Fit a logit model:
Fit the model with zero constant term:
Fit data to a logit model:
Fit data to a model with a known Sqrt[x] term:
Fit the data treating the first variable as a nominal variable:
Treat both variables as nominal:
Fit a model using equal weights:
Give explicit weights for the data points:
Use WorkingPrecision to get higher precision in parameter estimates:
Obtain the fitted function:
Reduce the precision in property computations after the fitting:
A default "Binomial" model from GeneralizedLinearModelFit is equivalent to the model for LogitModelFit:
ProbitModelFit is equivalent to a "Binomial" model with "ProbitLink":
LogitModelFit assumes binomially distributed responses:
NonlinearModelFit assumes normally distributed responses:
The fits are not identical:
Responses outside the interval from 0 to 1 are not valid for logit models:
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team