Use the lgsfit function to fit data to a logistic fit.
1. Define a data set.
These data are the result of a NIST study involving superconductivity magnetization modeling. The response variable is magnetism (column 0), and the predictor variable is the log of time in minutes (column 1).
2. Define a vector of guesses.
It can be challenging to select appropriate guess values for a logistic regression:
◦ The first value should be the approximate intercept of a curve going through the data.
◦ The second guess value should be less than 1 if the center of the data is to the right of the origin, and greater than 1 if the data is to the left of the origin. Here, this guess value is estimated by finding the mean of the independent variable. Usually this number is too large if the independent data is an integer, but it is not the case here.
◦ The last guess value should be large if there is a precipitous drop from high data to low data (greater than 1) and small if the transition is more gradual (smaller than 1). Also, this coefficient should be negative if the data is decreasing from left to right and it should be positive if the data is increasing from left to right. In many situations, you can use 1 or -1 as a guess value.
3. Call the lgsfit function to find the parameters of a logistic fit.
The parameters fit the following logistic equation: