You are on page 1of 6

Random Sampling

Find a random number


On main enter rand( repeat

What happened ? Give a definition of rand()

Psuedo random number

If you selected 100 random numbers what would histogram look like ?

In statistics
In list 1 in Cal enter randList (100) exe and draw histogram

On Spread Sheet
In A1 enter =rand( Fill – Fill range (A1:A100) draw histogram recalculate

Select 10 random numbers and add them and repeat 30 times

On Spread Sheet
In A1 enter rand( Fill – Fill range (A1:J30)
In K1 enter calc List-calculation Sum (A1:J1)
Highlight K1 Fillrange (K1:K30)
Highlight K and draw histogram
Edit Recalculate
To find random number, x 0 ≤ x≤ 8 rand()  8

To find random integer x, 0 ≤ x≤ 8 int(rand()  8 + 1 )  (rand(1,8 )

Simulations
 Draw a histogram obtained
if a single die is rolled 120 times

Spread sheet in A1 enter =int(rand()6+1) exe


Fill A1:A120 Highlight column A draw histogram.

 How many 6’s would you expect if you rolled a single die 120 times.

On a spread sheet
The 120 rolls of the die are already in Column A
In B1 enter Calc Cell-Calculation Cellif Enter A1=6,1,0 Fillrange B1:B120
In C1 enter Calc List-Calculations Sum Enter B1:B120
Graph histogram
Sampling Distributions

Example 1 Select a smartie from a box containing 10 smarties, 3 of which are blue. Replace the smartie
and repeat the experiment 10 times. Record the number of blue smarties for the 10
experiments.
This is a Bernoulli trial. Record the theoretical probabilities on the table.

X 0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
^p
10 10 10 10 10 10 10 10 10 10 10
P( ^
P= ^p ¿

To find the theoretical probabilities


P (x=n) = 10Cn (0.3)n (0.7)10-n
Method 1 Use Main
For zero blue smarties. P (x=0) = 10C0 (0.3)0 (0.7)10
To find the other probabilities for values of x for 1 ≤ x ≤ 10
Edit 0  r to 1  r Exe
And repeat for r = 2 to 10

Method 2 Use Statistics


Statistics Calc Distributions
Binomial PD Next
x = 0 , Numtrial = 10 , p = 0.3
Next select graph icon
Use arrow > to find other values

Method 3 Use Graph& table


To obtain a table of results Keyboard catalogue
B binomialPDf input
in bracket enter (x,10,0.3)
set table to start 0 , end 10 & step
Graph results as scatter plot
Simulation of the above experiment thirty times

Spreadsheet
In cell A1 enter a pseudo random number to simulate the selection of a blue/non blue
Int(rand()+0.3)  0 not blue , 1 blue

Edit to select experiment 30 times.


Edit Fill Fillrange A1:J30 (note: the 10 draws go across the spread sheet)

Calculate the number of “Blue smarties” from 30 draws


In K1 enter Calc List-Calc Sum A1:J1 Exe

Edit Fill Fillrange K1:K30 Exe

Draw histogram of doing the experiment 30 times.

Use calc the find the mean and standard deviation


of the results
Mean = standard deviation =

Repeat a number of times


Edit recalculate

For each the ten selections calculate ^p (sample proportion) (in column L)

For the 30 samples of ^p calculate the mean and the standard deviation

Compare the result


Proportion and Confidence Intervals

Sampling unknown proportion


A 380 g bag of smarties contains 352 smarties of which 43 are blue
43
 Sample proportion ^p =  0.12
352

Consider the actual proportion = ?

We consider ^p to be normally distributed

Consider 90% confidence level

Our result of ^p  0.12 could be the worst case scenario or the best case scenario

i.e

0.092 0.12 0.148


^p  0.12

0.12× 0.88
To find the 90% confidence interval

( ^p )  1.64  sd ( ^p )
note: ^p = 0.12 SD =
√ 352
= 0.017

0.092 ≤ p ≤ 0.148 ( to 3 decimal places )

Alternative methods

1. Statistics Calc Inv Dist Inv Normal CD center prob = 0.9, sd= 0.017, ^p=
0.12

Confidence interval 0.092 – 0.148

1. Statistics Calc Interval One-prop Z int c-level = 0.90


x = number blue smarties = 43
n = total number smarties=352
Confidence interval 0.093 – 0.151

You might also like