The Nelder-Mead program from the previous post is handy to solve a couple of problems, one being finding the parameters for logistic regression. The TI Nspire comes with logistic regression function but I can’t seem to find a way to have it solve equations with more than one categorical dependent variable. Since finding the parameters for the logistic curve required maximum likelihood, the Nelder-Mead program will be able to help.
A sample problem goes like this: Given the following daily variables (i) temperature, (ii) whether this is Wednesday, Saturday, or Sunday, the sale of a particular product is recorded. Note that “sale of a particular product” referred to a binary value. Either it is sold that day, or not. The number of sale does not matter.
The first equation, l, defined parts of the likelihood function and is a short hand so the resulting function will be less clumsy. It is defined as piece-wise function taking the variables for day of week and temperature with their coefficients, as well as the sold or not value which govern the sign of the return value (p or 1-p). The second equation defined the maximum likelihood function (the next one is an alternative). Setting initial guess into p and plug into the nm function and the results is obtained, in the resultsmatrix. The logistic function is thus y=1/(1+e^-(2.44*x1 + 0.54*x2 – 15.20)) and ready to use for predicting values.