Simulation Of Sampling Without Replacement; Sampling-Without-Replacement Function - Texas Instruments TITANIUM TI-89 User Manual

Titanium graphing calculator
Hide thumbs Also See for TITANIUM TI-89:
Table of Contents

Advertisement

Simulation of Sampling without Replacement

Simulation of Sampling without Replacement
Simulation of Sampling without Replacement
Simulation of Sampling without Replacement
This activity simulates drawing different colored balls from an urn without replacing them.
Detailed information about the steps used in this example can be found in the electronic
chapter Programming.
Sampling-without- Replacement Function
Sampling-without- Replacement Function
Sampling-without- Replacement Function
Sampling-without- Replacement Function
In the
Program Editor
parameters. The first parameter is a list where each element is the number of balls of a
certain color. The second parameter is the number of balls to select. This function
returns a list where each element is the number of balls of each color that were selected.
:drawball(urnlist,drawnum)
:Func
:Local templist,drawlist,colordim,
numballs,i,pick,urncum,j
:If drawnum>sum(urnlist)
:Return "too few balls"
!
:dim(urnlist)
colordim
!
:urnlist
templist
:newlist(colordim)!drawlist
:For i,1,drawnum,1
!
:sum(templist)
numballs
!
:rand(numballs)
pick
(continued in next column)
Activities
, define
drawball( )
:For j,1,colordim,1
:cumSum(templist)
:If pick
:drawlist[j]+1
:templist[j]
:Exit
:EndIf
:EndFor
:EndFor
:Return drawlist
:EndFunc
as a function that can be called with two
!
urncum
urncum[j] Then
!
drawlist[j]
!
1
templist[j]
N
775

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-89 voyage 200Titanium ti-89

Table of Contents