Usage of the Nelder-Mead program for Logistic Regression in Nspire

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.

Sample data:

The calculations:
nmlr2The 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.


4 thoughts on “Usage of the Nelder-Mead program for Logistic Regression in Nspire

  1. Pingback: A comparison on performance of overclocked Nspire CX CAS and fx-9860GII | gmgolem

  2. Pingback: Overclocking Casio fx-9860gII to the max with portable power bank | gmgolem

  3. Pingback: Exploring maximum likelihood using graphs in TI Nspire | gmgolem

  4. Pingback: Logistic Regression – from Nspire to R to Theano | gmgolem

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s