Monthly Archives: January 2016

Simplex Algorithm on the Casio 9860GII

With matrix capable calculator, simplex algorithm for common maximization problem can be solved easily like in the TI-84.

The Casio 9860GII is also equipped with equivalent matrix operations to solve the same problem.

casiosimplex1

casiosimplex2

casiosimplex4

casiosimplex3

Advertisements

Rank function in TI Nspire for Wilcoxon signed rank test

The Wilcoxon signed rank test is a non-parametric method for t-test under situation where normal distribution cannot be assumed on the sample data.

There is no built-in function for this hypothesis test in the TI Nspire, but the process is straight forward. During the calculation of the W statistic, a ranking process is required on the sorted input list. For ties, the handling is to assign the average value of the span of the tie. It is easy to create the ranking list using the built-in newlist() function, but for assigning this particular ranking rule, a program is created to facilitate.

The core part of this program is to iterate through an input list (assumed sorted with the SortA function), and the check if there is duplicates using the countIf() function.
wilcoxon1

The sample usage in calculator is easy.
wilcoxon2

P-Value of 2-way ANOVA in TI Nspire

The TI Nspire CX provided very convenient facility to perform 2-way ANOVA analysis. The P-values are displayed in the spreadsheet as well as being stored in designated variables that can be recalled from the calculator screens and other applications.

anova-F-stat1

As shown above, the last two equations are refresher of how the P-values are determined from the F statistics.

Graphical representation can also be plotted in the Graph application. With the aid of the Integral tool, the shaded area in the below example represents the area from 0 to the F statistics. Recall that the whole area under the curve is 1, the P-value from F statistics to infinity is then 1 – 0.961 = 0.039

anova-F-stat2

Date arithmetic in TI Nspire

The TI Nspire CX (and also 83, 84, 89 series) provided a useful date function, dbd(), for finding the number of days between two input dates. However, after nothing turn up searching for function to perform days addition, a quick and dirty program is developed by taking advantage of this built-in function.

The program takes two parameters: a date and the number of day to add, and basically brute force a range of dates to check if the dbd() function returns a value equals that of the intended number of days to add. The program assumed the format DDMM.YY, while the built-in dbd() function accepts format in either DDMM.YY or MM.DDYY.

datecalc1

Calculating prediction interval in multiple regression using Mahalanobis distance

In TI Nspire, the prediction interval can easily be obtained from the Statistic function Confidence Interval > Multiple Reg Interval.

predinterval1

On the result section, the lower and upper prediction intervals are displayed for convenient reference.
predinterval2

Alternatively, using Mahalanobis distance, this prediction interval value can be calculated as in below.

predinterval3

$1.3 billion Powerball Odds

As reported in news the prize of Powerball grows to $1.3 billion. The last change of the rule of the game increased the odds, which is believed to be the cause for accumulation of jackpot since November. Using TI-84, the odds for the old and new rules are calculated below using the nCr() function. Old odds is 1 in 175 million while under the new rule it is now 1 in 292 million.

powerball

Black-Scholes formula in TI-84 Solver

Came across a ten-year old article from TI on working with the Black-Scholes pricing model in TI-84. In it, a couple of examples are given to utilize various features of the TI-84 to work with the equation to derive an European call option in the Black-Scholes model. One of these method being invoking the Solver.

Entering the equation again is considered quite cumbersome, and it is not quite sure how to archive the Solver equation for later use. After a couple of tries, it become obvious that the Solver wouldn’t work with a function stored in String at all. Fortunately alternative method is found to somehow persist the equation for later use.

The trick is to make use of the following build-in functions available in the TI-84:

  • String>Equ()
  • expr()

By making use of these two functions, the Solver will be able to handle the Black-Scholes equation which is stored in String properly. Firstly the equation must be stored in a String, and then by making use of String>Equ() function, the equation will be able to persist in one of the equation variables. In this form, the Solver will be happy to work with it in its entirety, which means all variables are considered. The equation stored in Str0 is converted to function Y0, and is then processed properly by the Solver as shown in the below screens. For persisting, this can be done in a program including the definition of the Black-Scholes formula itself.