Showing posts with label instructions. Show all posts
Showing posts with label instructions. Show all posts

Friday, June 26, 2009

Standard deviation using the TI-30x IIs

With this list, we can use the TI-30x IIs to get the average and both standard deviations, sx, the standard deviation for a sample and sigmax, the standard deviation for a population.

The buttons to press will be written in red.



Here is a data set we will input.


60, 60, 60, 61, 62, 62, 63, 63,64, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66,

68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 74, 76, 77, 78

[2nd][DATA][ENTER] This puts the calculator in one variable mode.
[2nd][DATA][LEFT][ENTER] This clears the data.
[DATA]
X1= 60 [DOWN]
FRQ= 3 [DOWN]
X2= 61 [DOWN]
FRQ= 1 [DOWN]
X3= 62 [DOWN]
FRQ= 2 [DOWN]
X4= 63 [DOWN]
FRQ= 2 [DOWN]
X5= 64 [DOWN]
FRQ= 1 [DOWN]
X6= 65 [DOWN]
FRQ= 2 [DOWN]
X7= 66 [DOWN]
FRQ= 8 [DOWN]
X8= 68 [DOWN]
FRQ= 2 [DOWN]
X9= 69 [DOWN]
FRQ= 3 [DOWN]
X10= 70 [DOWN]
FRQ= 2 [DOWN]
X11= 71 [DOWN]
FRQ= 3 [DOWN]
X12= 72 [DOWN]
FRQ= 2 [DOWN]
X13= 74 [DOWN]
FRQ= 1 [DOWN]
X14= 76 [DOWN]
FRQ= 1 [DOWN]
X15= 77 [DOWN]
FRQ= 1 [DOWN]
X16= 78 [DOWN]
FRQ= 1 [DOWN]
[STATVAR]
This shows the statistics variables.
n x-bar sx sigmax
35[RIGHT]
n x-bar sx sigmax
67.37142857[RIGHT]
n x-bar sx sigmax
4.747046848[RIGHT]
n x-bar sx sigmax
4.67870455[RIGHT]


Tuesday, April 28, 2009

Class Notes for 4/27 and 4/29

Dependence and Independence
The first line of Leo Tolstoy's Anna Karenina is "All happy families are alike; each unhappy family is unhappy in its own way." In statistics, all independent trials are alike, in that the probability of a particular outcome of one trial does not effect the outcome of later trials, nor was it effected by earlier trials. With dependent probability, the outcome of one trial is effected by the outcome of previous trials, but how that effects things is not always the same.

For example, if we talk about a 70% free throw shooter taking two shots, does missing the first shot effect the probability of missing the second shot? Let's look at this simple problem three different ways.

Predicting the future mathematically by carefully studying the past: Let's say I called this person a 70% free throw shooter because so far in the season, she has made 7 of 10 shots from the line. If she misses, she has now made 7 of 11 shots from the line, and she is now a 63.6% shooter. Should we factor that in to be more precise? Some mathematical models would say yes.

Using this method, missing a shot would make her percentage worse and making one would make it better, no matter how many shots she had taken. But if she had made 70 of 100 so far in the season, one miss would make her 70 of 101, which would lower her percentage to 69.3%, a much smaller effect than it has if she had made 7 of 10. If instead we were looking at her entire career instead a single season, perhaps she has made 700 of 1000, and missing one would mean she was 700 of 1001, which changes her percentage to 69.9%. When discussing free throw percentage, announcers on TV usually round to the nearest percent, so the first example of 7 of 10 to 7 of 11 would be a drop from 70% to 64%, the second example would be a drop from 70% to 69%, and in the third example, 69.9% would round to 70% and the change would be too small to notice.

Factors effecting success and failure: The free throw shooter goes to the line for two shots and misses the first. Is there a physical reason? We might treat free throw shooting as we would picking a random number from 1 through 100, where we count any number from 1 through 70 as a success and 71 through 100 as failures, but shooting free throws includes the human factor. Maybe she missed because she is nervous or distracted. Maybe it's late in the game and she is tired or injured, changing her technique. If any of these are the case, it might make more sense for us to downgrade the probability of making the next shot, though exactly how much it should be downgraded is no longer some simple formula like turning a fraction into a percentage.

Compensating for failure: Again, let's add in the human factor in this problem. She misses the first free throw, and her coach notices her technique looks inconsistent. "Elbow up!" the coach shouts from the sidelines, and the shooter hears the coach and readjusts her technique to match the way she shoots in practice. Should this change bring her back to being a 70% shooter, or even upgrade her chance of success? That is uncertain, but the failure on the first shot and the diagnosis of at least one reason for the failure could effect the odds, and that effect means the second shot should not be considered independent of the first.

The dependent probabilities in a 52 card deck

One of the simplest mathematical models of dependency is sampling without replacement, which is the way most card games or lotteries or the game of Bingo works. You have a set of outcomes which get effectively randomized and a trial is performed, meaning a card is taken from the deck or a ping pong ball is removed from the hopper or a bingo marker is removed from the spinner. Once removed, the number of possible outcomes has been reduced by one and probabilities for success and failure of certain outcomes change.

Looking for an ace: There are 52 cards is a standard deck and 4 of them are aces. If I draw a card from a randomized deck, the chances are 4/52 = 1/13 ~= 7.7% that the card will be an ace. What are the chances the second card is an ace?

That depends on the first card.

Probability that the second card is an ace, given the first card is an ace is 3/51 = 1/17 ~= 5.9%.

Probability that the second card is an ace, given the first card is not an ace is 4/51 ~= 7.8%.

Unlike the mathematical model of free throw shooting where we re-calculate the probabilities by adding the most recent make or miss into the precentage, which means a miss brings the odds down and a make brings the odds up, not getting an ace makes the odds a little better next time, and getting an ace makes the odds worse.


This is the formula for the dependent probability model of sampling without replacement is given at the left. The two numbers in parentheses are a binomial coefficient, the numbers you get when you use nCr on your calculator, which I pronounce "n choose r" in class. The pairs of numbers that look like a base and an exponent, except that the exponent is underlined, is the convention developed by Donald Knuth at Stanford for writing the numbers that you get on your calculator using the nPr function, which I pronounce "n fall r", referring to the name "the falling factorial". If we think about a deck of cards, the lowercase letters refer to the size of the hand n, where r is the number of successful trials (r for right) and w is the number of unsuccessful trials (w for wrong), and r+w=n. The uppercase letters refer to the size of the deck, where T is the size of the deck, G is the number of cards we consider success if we draw them and B is the number of cards we consider a failed trial if we draw them. The letter T stands for Total, G for Good and B for Bad. Again, we have an equation, G+B=T.

Example: If we want consider drawing a heart a success and anything else a failure, what is the probability of drawing three hearts and two non hearts in a five card hand from a well-shuffled 52 card deck.

Here are the six numbers we need.
n = 5
r = 3
w = 2
T = 52
G = 13
B = 39

On a TI-30XIIs, here are the keys you would press.

5[prb][right]3×13[prb]3×39[prb]2÷52[prb]5[enter]

The calculator will read as follows.

5 nCr 3*13 nPr 3*39 nPr 2/52 nPr 5
0.081542617

This means the probability of exactly three hearts and two cards of some other suit is about 8.15%.

The Expected Value (EV) of a two outcome game

Let us assume we have a game that has only two outcomes, winning and losing. Let us further assume that two players have decided to wager on this game, both putting money into a pooled amount and the winner taking all at the end.


If we look at the game from the point of view of one of the players, we need to know the probability of winning p, how much that player put in, which we call Risk and how much the opponent put in, called Profit. The expected value EV equals the probability of victory p times the sum of Profit and Risk divided by Risk.

Different books use different formulas for this. Some do not divide by Risk. By dividing, the number we get is a percentage of return, and a game of flipping coins for $1 a game is equivalent to a game of flipping coins for $100 a game. Some subtract 1 from this formula. This just changes the most important number in identifying results from 1 to 0.

If EV = 1, we consider this a "fair game". For every $1 risked on this game, the expected value is that you will have that dollar returned to you, breaking even. Notice if we are flipping coins, that event never happens on any single play. Either the player makes a dollar profit or a dollar loss, but expected value is about the long run.

If EV > 1, the game is advantageous to the player. If EV < 1, the game is disadvantageous to the player.

In the game of roulette, there are 38 slots where the ball can land, and for simplicity's sake we will assume each has an equal chance of showing up, so p = 1/38. For every $1 you risk, you can make a profit of $35 if you correctly guess in the exact slot where the ball will land. To find the expected value using the TI-30xIIs, you should type in this.

1÷38×(35+1)÷1[enter]

The calculator will read as follows.

1/38*(35+1)/1
0.947368421

What this number means is that for every dollar risked on the spin of a roulette wheel, you should expect about 94.7 cents returned to you in change. In other words, about 5.3 cents is lost from every dollar you bet on every spin of the wheel.

Another way to play the game is to bet red or black. Of the 38 compartments, 18 are red and 18 are black and 2 are green. The probability of victory on betting one of the two major colors is 18/38 = 9/19 ~= 0.473684211. The profit and risk are now both $1. Here's what to type on the TI-30xIIs.


16÷38×(1+1)÷1[enter]

The calculator will read as follows.

16/38*(1+1)/1
0.947368421

The game has changed, both in probability and amount of profit compared to risk, but from the player's point of view, the expected value is precisely the same and still in favor of the casino.

No matter what the levels of profit and risk are, we can find a probability p that will make the expected value equal to 1, and that is p = Risk/(Profit+Risk). If the probability is increased with the profit and risk remaining unchanged, the game becomes advantageous. If is is decreased, the game becomes disadvantageous.

Modern and Classic Parimutuel odds

Profit and risk are listed either in classic form like 3-1 or 2-7 (or sometimes with colons 3:1 or 2:7), where profit is the first number and risk is the second.

In online betting sites, the numbers are given as numbers with absolute value greater than 100, with either a + or - in front of them. +250 means 250 is the profit and 100 is the risk, while -250 means 10o is the profit and 250 is the risk. The fourth page of the yellow sheet explains this in greater detail and shows how to switch back and forth between the two systems.

Practice problems

1. With a well-shuffled 52 card deck, find the probability of getting exactly r hearts in a five card hand when
a) r = 0
b) r = 1
c) r = 2
d) r = 3 (already solved above)
e) r = 4
f) r = 5

2. Find the break-even p when Profit and Risk are as given. Round to three places after the decimal point.

a) Modern parimutuel = +150
b) Modern parimutuel = -110
c) Classic parimutuel = 5:3
d) Classic parimutuel = 5:11

Answers in the comments.

Sunday, March 15, 2009

using the TI30X IIs for confidence intervals



Let's say we have the following statistics from a data set and we want to find the 95% confidence interval for mux, the underlying population's true average value.

n = 36
x-bar = 25.35
sx = 6.78

The degrees of freedom will be n-1 = 35, but 35 is not one of the choices on Table A-3, so we have to go with row 34 instead. The Confidence Level Multiplier for 95%, or CLM95%, is 2.032. If you have a TI-30xIIs, key in the following numbers into your calculator to get the high threshold.

25.35+2.032*6.78/[2nd][x^2]36[enter]

The answer should be 27.64616, which we can round to 27.65.

All we have to do to get the low threshold is to change the + to a -. Key in the following.

[up][right][right][right][right][right]-[enter]

After you key this in, the equation line should look like

25.35-2.032*6.78/sqrt(36

and the answer is 23.05384, which rounds to 23.05.

This says we are 95% confident using this data set that the true average of the underlying population is between 23.05 and 27.65.

Tuesday, March 3, 2009

Class notes for 3/2

For most of the rest of the semester, we will be working with the idea of standard deviation, a way to measure how spread out a set of data is. There are going to be a lot of different ways to compute standard deviation depending on what kind of set we are dealing with, and the first two we will learn are sx and sigmax, which are the standard deviations for a sample of numerical data and a population of numerical data, respectively. I am going to go through the steps of calculating these numbers with a small set of data first, then show how to key in the data to the TI-30XIIs, which is a huge time saver.

Data set #1: 1, 2, 3, 4, 5, 6

Step #1: Find the average. 1+2+3+4+5+6 = 21, and 21/6 = 3.5. So x-bar or mux is 3.5, depending on whether we have a sample or a population.

Step #2: Take the squares of all the values of data minus the average, then add them together.

(1-3.5)^2 = (-2.5)^2 = 6.25
(2-3.5)^2 = (-1.5)^2 = 2.25
(3-3.5)^2 = (-0.5)^2 = 0.25
(4-3.5)^2 = 0.5^2 = 0.25
(5-3.5)^2 = 1.5^2 = 2.25
(6-3.5)^2 = 2.5^2 = 6.25
sum = 17.5

Step #3: Divide the sum by N or n-1, depending on population or sample.

17.5/6 = 2.91666...
17.5/5 = 3.5

Step #4: Take the square root of the value from Step #3.

sigmax = sqrt(2.91666...) ~ 1.707825...

sx = sqrt(3.5) ~ 1.870828...

For a small set of data and an average that is exact, this isn't so hard. As data sets get larger, this becomes a lot of work to do by hand, which is why a calculator is so valuable.

Steps for TI-30x

Step #1: Get into one variable mode and clear the data set.
If the word STAT is on your screen, this key sequence will do the trick.

[2ND][STATVAR][ENTER][2ND][DATA][ENTER]

If the word STAT is not on your screen, type these key strokes.

[2ND][DATA][ENTER]

Now you are ready to enter in the data. Type in the stuff written in red, where the stuff in black is what is already on the screen.

[DATA]
X1= 1 [DOWN]
FRQ = 1 [DOWN]
X2= 2 [DOWN]
FRQ = 1 [DOWN]
X3= 3 [DOWN]
FRQ = 1 [DOWN]
X4= 4 [DOWN]
FRQ = 1 [DOWN]
X5= 5 [DOWN]
FRQ = 1 [DOWN]
X6= 6 [DOWN]
FRQ = 1 [DOWN]
[STATVAR]

The read out will now give you the following information as your scroll left and right.

n = 6
x-bar (or mux) = 3.5
sx = 1.8708...
sigmax = 1.7078...
sum(x) = 21
sum (x^2) = 91

If you move the underline to the x-bar and press [ENTER], the equation line will now have the symbol x-bar on it, which means the calculator can do equations with the exact values of the average and the standard deviations in them, which will be useful in calculating z-scores.

The standard deviations are roughly equal to the average distance away from the average of all the data in the set. The reason for the n-1 instead of n in the sx equation is the idea of degrees of freedom in a data set. If you know the average of a set of data and the size of the set, you know the total, and if I give you the total of all but one of the values of a set, you can subtract to find the last value.


Why we work with these rough approximations of the average distance instead of the exact value comes from calculus. The normal curve is a bell shaped curve that has area = 1 under the curve from negative infinity to infinity, so any vertical line we draw can cut the area into two parts, where the area under the curve to the left of the line is x and the area to the right of the line is 1-x. A lot of data sets, though not all, have this kind of distribution, and by using z-scores of the raw scores, which is (raw-average)/(standard deviation), we can compare two data sets that are normally distributed, even if they have different averages and different standard deviations. We will look at this in greater detail next class.

Thursday, January 29, 2009

Inputting a data set into the TI-30X II s

In the following instructions, I will write comments in this font and the stuff from the calculator in a blocky font called Courier. The things the calculator will put on the screen are in black, while the keys you type in will be in red.

First, you want to be in one-variable stat mode. If you are in stat mode, the word STAT shows up on the output screen in small letters.

Step 0: If you don't see the word STAT on your screen, type the following.

[2nd][DATA][ENTER]

This puts you in stat mode. Before you hit enter, the screen should read

1-VAR 2-VAR

and by pressing enter when 1-VAR is underlined, you go into 1-variable statistics mode. You can skip now to Step 2.

Step 1: If you see the word STAT on the screen, type the following.

[2nd][DATA]

What you will see are the words

1-VAR 2-VAR [left][left]

come up on the screen, and then when you scroll left twice, you will see the word

CLRDATA [ENTER]

underlined. That's when you press enter, which clears out any old data you have.

Step 2: Inputting a data set. The two important buttons here are [DATA] and [STATVAR]. [DATA] lets you start inputting data, and when you are finished pressing [STATVAR] will get you to the statistics associated with the data set you just entered.

One variable statistics in the TI-30X II s are input as a frequency table, a value followed by how many times it shows up on the list. Consider the following list.

20, 20, 19, 18, 18, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 15, 15,
14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 12, 12, 12, 11, 11, 11, 11, 11,
9, 9, 8, 7, 7, 4, 4, 4,

[DATA]
x1= 20 [down]
frq= 2 [down]
x2= 19 [down]
frq= 1 [down]
x3= 18 [down]
frq= 2 [down]
x4= 17 [down]
frq= 5 [down]
x5= 16 [down]
frq= 7 [down]
x6= 15 [down]
frq= 2 [down]
x7= 14 [down]
frq= 5 [down]
x8= 13 [down]
frq= 5 [down]
x9= 12 [down]
frq= 3 [down]
x10= 11 [down]
frq= 5 [down]
x11= 9 [down]
frq= 2 [down]
x12= 8 [down]
frq= 1 [down]
x13= 7 [down]
frq= 2 [down]
x14= 4 [down]
frq= 3 [down]
x15= [STATVAR]

The screen will go blank, then show the word CALC for a few seconds, then the statistics for the data set appear. You can use the [left] and [right] buttons to look at different statistics. The number that appears is the underlined statistic. On this list, the numbers are as follows.

Step 3: Reading the statistics of the sample. (Or it could be the parameters of the population, depending on how the data set was defined.)

What you will see on the screen is in black, what keys you will press are in red. The only key in these instructions are the left button, but the right button works for scrolling as well.

n x-bar sx sigmax
45 [left]

n x-bar sx sigmax
13.333333... [left]
n x-bar sx sigmax4.073193967 [left]n x-bar sx sigmax
4.027681991 [left]
sum(x) sum(x^2)
600 [left]

sum(x) sum(x^2)
8730


To get out of the screen showing the statistics, press [CLEAR]. If you press [ENTER] instead, the screen will show the equation line with the symbol of the statistic you were looking at added to whatever equation you were just looking at. This will be useful later in the class when we need the average x-bar and one of the standard deviations, either sx or sigmax, for calculating z-scores.

If you have any questions about how to use one-variable mode on the TI-30 X II s, leave a comment or send me an e-mail.

Sunday, January 25, 2009

The basics of the TI-30X II S



The TI-30X II S is the recommended calculator for the class. It has many features that will do some very difficult calculations automatically. In the instructions, any time a key press or series of key presses is discussed, the instructions will be in red in the font called Courier.

One of the most important keys on the calculator is the blue key [2nd] at the upper left. Using this key, almost all the black keys and the bottom row of the white keys have double uses. For example, the

[ON]

button is at the lower left. If you press

[2nd][ON]

that turns the calculator off. Some, but not all the functions on the regular black buttons have an inverse function associated with it by pressing 2nd. For example, the 4th button from the bottom in the left column, with [x^2] on it, will square a number, while if you key in [2nd][x^2], it takes the square root of a number. Be careful. To get a square root, you need to type

[2nd][x^2] 3 [ENTER]

which will give you 1.732050808, while to get 3 squared, you type

3 [x^2][ENTER]

to get 9.

To enter in data sets, we will be using the DATA and STATVAR keys, as well as the four arrow buttons in the upper right. Since the four symbols are not available in the text editor I use for this blog, I shall type [up], [down], [left] and [right] to identify the four buttons.

Getting in and out of STAT mode: There are some words written in a small font below the output line for answers. If you see STAT written on that line, this means the calculator has a current set of data it is storing. If you don't see that word, there is nothing currently stored.

If you don't see STAT: Press

[2nd][DATA]

and the equation line of the output screen will give the choices of 1-VAR and 2-VAR. You can use the [left] and [right] buttons to toggle back and forth. Pick the one you want, then press

[ENTER]

(The first data sets we are going to deal with will be 1-variable applications.)

If you want to start a new data set, press

[2nd][DATA][left]

This gives you the CLRDATA option. If you press

[ENTER]

all data that was stored will be erased.

Now we know how to get in and out of STAT mode and erase old data. Next we will learn how to enter a data set and how to get the parameters or statistics, which is to say some of the important numbers associated with the data set, which could be a population or a sample.