I'm taking Statistics class. A common calculation is that they give us a table of data of any size from 2x2 to 6x6 or even longer (more rows down). Usually it is 2-4 columns, however one time it was 16 columns.

First we had to calculate RF - relative frequencies of each row, each column.

So, I made a script to calculate it, using table with L1-L6 lists. In the calculation I first added a row with zeros to the bottom to separate data from results. I wish I could add dashes, or empty cells, but it's impossible. Next line is a sum of each column respectively, and next line is RF, which is calculated by dividing column sum by the total sum of the table.

Also I calculate sums of each row and store them in a new list "SUM", calculate RF of each row and store them into another list "RF"

Then our homework got harder and we needed to calculate marginal relative frequencies of each cell, where you divide the value of the cell by the value of the sum of that column. So, I created new lists F1-F6, where I store the results of RF of each cell.

Then with GENERAL probability calculations we had to divide cell value by the total sum of the table. So, I created another branch in my script (using "Menu(" function) to do general probability calculations as an option vs. RF calculations.

Then it got even more complicated with CONDITIONAL probability. Now we need three types of calculations for each cell at the same time

1) cell values divided by total sum

2) — by column sum

3) -—by row sum

I do not have a problem writing a script for calculations themselves. There are other problems. Although usually we have 2-4 columns of data, I want to write a script to be capable to calculate up to 6 columns (or lists). L1-L6 - are 6 lists, SUM and RF - another two, F1-F6 - that's 14 already. If I make 3 sets of "F" lists - that would be 26 lists, and that is over the limit of 20 lists our calculator allows. Also it is not convenient to scroll through anymore.

I was thinking to store everything in F1-6 columns, just posting them below each other, but it would be difficult to find needed cell in second and third set. Let’s say I need cel 4,5 (5th row) in third set with 7 rows in a set, so I need to go down 7, then another 7, then 5, counting as I go down. Also it is easy to make mistake by picking wrong cell and screw up the results. So, it is not convenient. Using the same lists F1-6 and just recalculating back and forth is not attractive either, so I was thinking of using matrixes to store the results. I would need 3 matrixes for those 3 different calculation modes. Probably I would still have to use F1-6 rows and then use List-to-Matrix command to send it to [A], then second calculation, using the same F1-6, storing to [B], and third – to [C].

The problem is that the script creates only as many “F” list as there “L” lists available. I use condition

If sum(L2)=0

…

If sum(L6)=0

To skip calculations and creating F lists that I do not need, but now if I write

List-to-Matrix(F1,F2,F3,F4,F5,F6,[A]

I will get an error if at least one of “F” is not filled.

One option I was thinking is to ask user how many “L” lists are there, but this is a bad idea, because it will make calculations longer time wise, and time sometimes is critical, when you are on the test.

I also could use old trick by checking sum of lists, starting with L2 and as soon as it returns zero, I would get the number of used lists. After this I would reroute the program to 5 different strings, starting with

List-to-Matrix(F1,F2,[A]

…

List-to-Matrix(F1,F2,F3,F4,F5,F6,[A]

And then repeat it two more times for [B] and[C].

Here I need to say that when you check sums of “L” lists you have to have them all pre-filled or you get an error, so what I do, I use “L1” as a reference point because it is always going to be filled and set “dim(“ size of all other “L” lists to that size. At the end of calculation I set “dim(“ of all “empty” lists to 0 if the sum of a list =0.

I was thinking of using the same trick with “F” lists while sending them to matrix, so I can only use one set of strings “List-to-Matrix “ instead of 5, but then I would have to deal with a lot of zeros in the matrix and I do not know how to chop them off.

What do you think?

]]>For reference,

`:Disp √(2 :Disp √(3`

and

`:Disp √(2:Disp √(3`

mean the same thing.

Try `2→A:A+1` on the home screen. The calculator allows these sorts of bundled expressions within the program editor – I used it to fit more information on the screen at one time. Also, you're not limited to two colons per line.

`Ans ^{т}` is taking the result of last computation in memory (which was

expr(Str1

Ans(

to get to a cell of entered column. That helps

Now, what the ":" means?

I looked through the site and couldn't find an answer. I mean, when you use expression like this

Ans→T:[A]

If X:Ansт

and by the way, what is "Ansт"?

]]>`Prompt C,R List►matr(L1,L2, …,listname,[A]`

Ans→T:[A]

If X:Ans

cumSum(Ans

Ans(max({1,0}dim(Ans)),R+X(C-R

End

Ans+T-[A](C,R

The above supports a combination of both user-defined lists and built-in lists, which may appear in any order. (Their positions in the second line will determine the column number that they embody.) The code below is restricted to using only `L1` up to `L6`, but can be made to handle more by tossing out the built-in lists in favor of custom names (of a fixed length) and adapting the `sub(` to select them appropriately.

`Prompt C,R "L1+L2+ …+Ln→Str1 expr(Str1 Ans(C→T expr(sub(Str1,2R-1,1 T+sum(Ans)-Ans(C`

I'm trying to write a script where I want to prompt (or using Input) for a column name and row #, store inputs and use them to cal for a cell value and use it in a formula

Let's say I have a table with L1, L3, and L3 prefilled

for my probability (statistics) calculations I need to calculate a sum of only one column, plus a sum of a given row minus value of a cell of interceprt.

Well, it is easy if you have the same row and column all the time

Let's say I need column 2 (L2), row 5

:L1+L2+L3→L4

"L4 now stores sums of each row

:sum(L2)+L4(5)-L2(5)

It is very simple, the problem starts when I want to request column name and use it to substitute it into a formula

I know how to do it the long way, using menu with 6 options (L1-L6) and branching off to 6 different formulas, but it looks ugly to me.

I wanted something like this:

:Input "Row #",R

:Input "Column name",Str1

and then instead of

:sum(L2)+L4(5)-L2(5)

:sum(Str1)+L4(R)-Str1(R)

Now, sum(Str1) might work if you put exp(

:sum(exp(Str1

Maybe, because it is calling for the content of L2, not the name L2, witch I need to incert in the formula.

So when I want to call just one cell of the column L2(5), using Str1(R), the exp( doesn't help.