Sampler Solo
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
SAMPLER Solo is part of the ProbLab curricular models, in which students engage in probability-and-statistics activities as individuals and as a classroom. SAMPLER stands for Statistics as Multi-Participant Learning-Environment Resource. It is called "multi-participant", because there is a HubNet version of this model, which was created before the solo version was built.
In both versions, users take samples from a giant grid consisting of tiny squares that are revealed as either green or blue, and then the users guess the greenness of the grid on the basis of these samples. The suggested activities are designed to create opportunities for learners to discover and discuss several basic notions of statistics, such as mean, distribution, and margin of error.
In SAMPLER Solo, a teacher can prepare to run the HubNet version by getting to know the environment and encountering features that simulate the classroom functioning of the model. Or a student could work on the model on her own, in class or at home, whether to prepare for participating in the classroom version - becoming an expert sampler! - or as a follow-up activity. Or one could work on the model regardless of the classroom context.
PEDAGOGICAL NOTE
In SAMPLER, statistics is presented as a task of making inferences about a population under conditions of uncertainty due to limited resources. For example, if you wanted to know what percentage of students in your city speak a language other than English, how would you go about it? Would it be enough to measure the distribution of this variable in your own classroom? If so, then how sure could you be that your conclusions hold for a school in another neighborhood? Are there certain groups of people that it would make more sense to use as a sample? For instance, would it make sense to stand outside a movie house that is showing a French film with no subtitles and ask each patron whether they speak a second language? Is this a representative sample? Should we look at certain parts of town? Would all parts of town be the same? Oh, and by the way, what is an average (a mean)? A variable? A value? What does it mean to measure a distribution of a variable within a population?
Many students experience difficulty understanding statistics--not only in middle and high school, but also in college and beyond. Yet, we all share certain natural capabilities that could be thought of as naive statistics. These capabilities are related to proportional judgments that we cast in our everyday life. We make proportional judgments when we need to decide how to maximize the utility of our actions on the basis of our cumulative experience of how events were distributed For instance, when we come to a new place we may say, "People in this town are very nice." How did we decide that? Or, "Don't buy fruit there--it's often overripe." How did we infer that? Or, "To get to school, take Main street--it's the fastest route in the morning; but drive back through High street, I find that's faster in the afternoon."
HOW IT WORKS
The View features a "population" of 10,000 tiny squares that are each either green or blue, like a giant matrix of coins that are each either heads or tail. The model can be set to select a random value for the proportion of green and blue in the population, so that the user does not know this value. Moreover, these colors are not initially shown - the squares are grey - so that we cannot initially use proportional judgment to guess the proportion of green in the population. Yet we can reveal the hidden color by "sampling", that is, by clicking on the View. When you click on a square, not only do you reveal that particular square, but also its surrounding squares, so that the overall shape of the sample is a larger square. The total number of tiny squares revealed in this sample will be determined by the current value set in a slider called "sample-block-side". For example, if the slider is set at 3, taking a sample will expose a total of 9 squares (3-by-3), with the clicked square in the center. On the basis of the revealed colors, you can make a calculated guesses as to the percentage of green squares within the entire population. You can then reveal the population to find out this unknown value.
A special feature of this model is that it includes an element that simulates what it looks like to use the HubNet version of this model. In the classroom PSA, all students input their guesses for green, and these collective guesses are plotted as a histogram. In the solo model it's only you guessing, and so the model creates histograms that are meant to demonstrate distributions of guesses that a classroom might produce. These demo distributions are based on what we saw in classes where we researched SAMPLER.
HOW TO USE IT
SETUP -- initializes all variables RERUN - creates a new population REVEAL POP - all tiny squares reveal their color SAMPLE - enables sampling by clicking on the View SIMULATE CLASSROOM HISTOGRAM - creates in the graphics window STUDENT GUESSES a histogram similar to what you would see if you were working as part of a large group. CLEAR HISTOGRAM - returns the histogram to its initial blank state. CLUSTER-GUESSES? - use this slider to control the size of the bins in the histogram. This can be helpful to see the distribution of guesses in the simulated classroom collective guesses. RANDOM-RERUN? - When Off, the Rerun will create a population with a greenness proportion set in the %-TARGET-COLOR slider. When On, the model will assign a random value for the greenness, irrespective of the slider value (and it will send that slider to 0). ABNORMALITY - determines the "clumpiness" of the green and blue squares in the population. When set at 0, there is typically no clumpiness (the distribution is normal). The higher the value, the larger the clusters of green (the distribution is "abnormal"). ORGANIZE? - if at Off, then when you reveal the population, each square will show its true color. However, when On, the green and blue squares relocate, as through there were a green magnet on the left and a blue one on the right. This results in a contour running vertically down the View. Note: the contour is always a straight line, because it rounds up to the nearest line. SAMPLE-BLOCK-SIDE - determines the size of the sample, for example the value 3 will give a 3-by-3 sample for a total of 9 exposed squares. KEEP-SAMPLES? - When set to Off, each time you take a sample, the previous sample becomes dark grey again. When set to On, the next sample you take, and all subsequent samples, will remain revealed. GRID? - When set to On, the View will feature a grid. The grid is helpful to interpret a sample in cases of extreme green or blue, because it enables you to count the number of squares.
THINGS TO NOTICE
When you press REVEAL POP and Organize? Is On, the green and blue colors "move" to the left and the right of the screen, respectively, forming a contour line. The location of this contour line is comparable to two other elements on the interface: the contour line falls directly below the slider handle above it and directly above the mean line of the histogram. The reason we can compare these three features directly is because the 0 and 'whole' (100%) of each of these features are aligned. That is, the sliders, graphics window, and plot have all been placed carefully so as to subtend each other precisely.
THINGS TO TRY
Set RANDOM-RERUN? to ON, press RERUN, and now take some samples. What is the minimal number of samples you need in order to feel you have a reasonable sense of the overall greenness in the population?
Try setting the ABNORMALITY slider to different values and press RERUN over and over for the same percentage green, for instance 50%. Can you think of situations in the world where a certain attribute is distributed in a population in a way that corresponds to a high value of ABNORMALITY? What do we mean when we speak of a 'uniform distribution' within a population? For instance, is a distribution of ABNORMALITY = 0 uniform? Or must there be strict order, for instance stripes of target-color, in order for you to feel that the distribution is uniform? Also, is there a difference between your sense of uniformity whether you're looking at the whole population or just at certain parts of it? If you threw a handful of pebbles onto a square area, would you say they fell 'uniformly'? What kinds of patterns are natural, and what kinds of patterns would you think of as coincidental?
EXTENDING THE MODEL
Change the procedure that separates green an blue, so that same green and blue squares remain when you reveal the population.
NETLOGO FEATURES
The abnormality distribution feature does not take much code to write, but is effective. Look at the code and try to understand it.
RELATED MODELS
See the HubNet SAMPLER model.
CREDITS AND REFERENCES
This model is a part of the ProbLab curriculum Thanks to Dor Abrahamson for his design of ProbLab. The ProbLab curriculum is currently under development at Northwestern's Center for Connected Learning and Computer-Based Modeling and at the Graduate School of Education at University of California, Berkeley. For more information about the ProbLab curriculum please refer to http://ccl.northwestern.edu/curriculum/ProbLab/.
HOW TO CITE
If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:
- Abrahamson, D. and Wilensky, U. (2009). NetLogo Sampler Solo model. http://ccl.northwestern.edu/netlogo/models/SamplerSolo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
COPYRIGHT AND LICENSE
Copyright 2009 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variable and Breed declarations ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; breed [frames frame] breed [gatherers gatherer] breed [clients client] breed [pending-clients pending-client] globals [ ;; holds the actual value used to determine how many patches should choose ;; target-color. this is set when the setup or rerun buttons are pressed. ;; if random-rerun? is true, this will be set to a random value from 0 to 100. ;; otherwise, this is set to whatever the current value of %-target-color is. real-%-target-color ;; Users guess the % of target-color in the population target-color ;; set to green currently other-color ;; set to blue currently hide-patch-color ;; the color that patches are colored when they are not revealed ;; holds the number of patches in the observer's last sample num-patches-in-observer-sample ;; holds the number of target color patches in the observer's last sample num-target-color-patches-in-observer-sample ;; if you were to segregate the patches by color, target-color to the left and ;; other-color to the right, you would create a contour line at approximately ;; xcor-of-organize-contour xcor-of-organize-contour ;; variables for storing various statistics of guesses guesses-list ;; list of all the clients guesses for this current population guess-average ;; the average of all the students' guesses averages-list ;; list of all the averages since we last pressed rerun or setup ] patches-own [ my-color ;; variables for when user toggles between samples and reveal displays ;; a list of the users (including the observer/instructor/server and all active clients) ;; that have this patch in their current sample agents-with-me-in-sample ] ;;;;;;;;;;;;;;;;;;;;; ;; Setup Functions ;; ;;;;;;;;;;;;;;;;;;;;; ;; setup the model to be used to initialize [ full-setup? ] clear-plot initialize-variables initialize-patches hide-frames abnormality-distribution set organize? false reset-ticks tick end ;; initialize-variables when rerunning or setting up to initialize-variables init-color-vars ;; the contour line between colors will be at a location proportionate to the ;; real-%-target-color of screen-size-x. for example, if real-%-target-color ;; is 70 then about 70% of the Graphics Window will be solid target-color ;; beginning from the left and extending to the right. set xcor-of-organize-contour min-pxcor + (real-%-target-color * world-width / 100) set averages-list [] start-over-variables end ;; initialize the color-related variables to init-color-vars set target-color green - 1 set other-color blue set hide-patch-color 3 ifelse random-rerun? [ set real-%-target-color random 101 set %-target-color 0 ] [ set real-%-target-color %-target-color ] end ;; initialize variables that are needed when collecting a set of data for the ;; current population to start-over-variables set num-patches-in-observer-sample 0 set num-target-color-patches-in-observer-sample 0 set guesses-list [] set guess-average 0 end ;; initialize patch variables to initialize-patches set-default-shape frames "frame" ask patches [ initialize-patch-colors setup-frames set agents-with-me-in-sample [] ] end ;; initialize patches colors. this is where the patches determine whether they ;; are target-color or other-color to initialize-patch-colors ;; patch procedure set pcolor hide-patch-color ;; default color of patches when not revealed ;; each patch "throws a die" to determine if it's target-color or other-color ifelse random-float 100.0 < real-%-target-color [ set my-color target-color ] [ set my-color other-color ] end ;; each patch creates a frame which give the optional grid appearance to setup-frames ;; patch procedure if not any? frames-here [ sprout 1 [ set breed frames ht ] ] end ;; ask all the frames to hide, even if grid? is true to hide-frames ask frames [ ht ] end ;; create and kill gatherers which modify the bi-linear random distribution of ;; target-color and other-color patches in the population. in other words, it ;; creates turtles which clump like-colored patches to abnormality-distribution create-gatherers (4 + random 4) ;; create gatherers [ ht setxy (random-float world-width) (random-float world-height) rt random-float 360.0 gather die ] end ;; clump like-colored patches by swapping patch colors from progressively ;; further patches around your location based on the abnormality slider to gather ;; gatherer procedure let index 0 let a-patch 0 let another-patch 0 set index ( 20 * abnormality ) while [ index > 0 ] [ set a-patch one-of patches in-radius 16 with [ my-color = target-color ] set another-patch one-of patches in-radius 8 with [ my-color = other-color ] if (a-patch != nobody and another-patch != nobody) [ swap-my-color a-patch another-patch ] set index (index - 1) ] end ;; swap my-colors between two patches to swap-my-color [ a-patch another-patch ] let color-buffer 0 set color-buffer [my-color] of a-patch ask a-patch [ set my-color [my-color] of another-patch ] ask another-patch [ set my-color color-buffer ] end ;; setup the model for use. this kills all the turtles and should only be used ;; with a new group to setup ca set organize? false initialize true ;; initialize turns back on the display reset-ticks ; ] end ;; setup the model for use. this doesn't kill all the turtles and so should be ;; used if you want to create a new population for the current set of clients. to go initialize false end ;; make sure that the user really wants to use the same population ;; prepare the patches to be sampled with the same population to start-over-patches ask patches [ set pcolor hide-patch-color ;; don't clear the agents-with-me-in-sample list if we are keeping the samples if not keep-samples? [ set agents-with-me-in-sample [] ] ] hide-frames end ;; plot means and mean of means to start-over-plot let list-counter 0 clear-plot set-current-plot-pen "means" set list-counter 0 ;; plot a line for each item in averages-list repeat length averages-list [ plot-pen-up plotxy (item list-counter averages-list) 0 plot-pen-down plotxy (item list-counter averages-list) 25 set list-counter list-counter + 1 ] ;; if there are at least 2 items in averages-list, plot the mean of all the items if length averages-list > 1 [ set-current-plot-pen "mean-of-means" plot-pen-up plotxy mean averages-list 0 plot-pen-down plotxy mean averages-list 25 ] end ;;;;;;;;;;;;;;;;;;;;;;; ;; Runtime Functions ;; ;;;;;;;;;;;;;;;;;;;;;;; ;; if the user clicks in the graphics window, take a sample where the click ;; occurred. the size of the sample depends upon the current value of the ;; sample-block-side slider to sample if mouse-down? [ change-sample (round mouse-xcor) (round mouse-ycor) sample-block-side "observer" ] tick end ;; based on input, create the chosen sample and have all patches in it set pcolor to my-color to change-sample [ x y block-side agent ] let patches-in-sample 0 set patches-in-sample nobody ;; designates all patches in a square around the mouse spot as being in the sample. ;; the sample-block side is set on the interface using the slider ask patch x y [ set patches-in-sample (in-rectangle patches ((block-side - 1) / 2) ((block-side - 1) / 2) ) ] ;; hide all the patches and frames ask patches with [ true ] [ set pcolor hide-patch-color ] ask frames [ ht ] ;; show the patches their frames (if grid? is true) in the currently chosen sample ask patches-in-sample [ set pcolor my-color ask frames-here [ set hidden? not grid? ] ] if keep-samples? [ ;; show all the patches which were previously sampled while ;; keep-samples? was true ask patches with [ member? agent agents-with-me-in-sample ] [ set pcolor my-color ] ask patches-in-sample [ ;; add agent to my list of agents that have me in their samples ;; so that the agent will keep seeing me when taking subsequent ;; samples (if keep-samples? is true) if( not member? agent agents-with-me-in-sample ) [ set agents-with-me-in-sample fput agent agents-with-me-in-sample ] ] ] if agent = "observer" [ set num-patches-in-observer-sample count patches-in-sample set num-target-color-patches-in-observer-sample count patches-in-sample with [pcolor = target-color] ] end ;; report the agentset within a box that has a width = (width/2 * 2) + 1 ;; and a height = (height/2 * 2) + 1 and is centered on the calling agent to-report in-rectangle [ patchset width/2 height/2 ] ;; turtle and patch procedure ;; this procedure does not work with a non-patch-agentset variable if not is-patch-set? patchset [ report nobody ] report patchset with [ pxcor <= ([pxcor] of myself + width/2) and pxcor >= ([pxcor] of myself - width/2) and pycor <= ([pycor] of myself + height/2) and pycor >= ([pycor] of myself - height/2) ] end ;; reveal the whole population - have all the patches show their 'true' colors to reveal set num-patches-in-observer-sample 0 ;; grid? is the option to have frames around each patch ask frames [ set hidden? not grid? ] ask patches [ ifelse organize? [ ;; When we reveal the population with organize? true, we get a vertical ;; contour. Patches with target-color are on the left and other ;; patches are on the right ifelse pxcor < round xcor-of-organize-contour [ set pcolor target-color ] [ set pcolor other-color ] set %-target-color real-%-target-color ] [ set pcolor my-color ] ] tick end ;; reports the proportion of patches with target-color in the current sample ;; if there has been no sample chosen yet, patches-in-sample is nobody. so ;; report -1 as an error code. to-report target-color-%-in-sample ifelse (num-patches-in-observer-sample = 0) [ report -1 ] [ report ( 100 * num-target-color-patches-in-observer-sample / num-patches-in-observer-sample ) ] end ;; cause the graphics window to show all the samples that students have ;; taken this far to pool-samples ask patches [ ifelse length agents-with-me-in-sample = 0 [ set pcolor hide-patch-color ] [ set pcolor my-color ;; put all the clients (including "observer") into agents-with-me-in-sample set agents-with-me-in-sample lput "observer" sort clients ] ] tick end to simulate-classroom-histogram let class-size 25 let err 0 let class-mean 0 let stand-dev 0 if real-%-target-color = 0 [set stand-dev 0 set class-mean 0 set err 0] if real-%-target-color > 0 and real-%-target-color <= 5 [set class-mean %-target-color + 2 set stand-dev 1.5 set err 1] if real-%-target-color > 5 and real-%-target-color <= 7 [set class-mean %-target-color + 3 set stand-dev 2 set err -2 + random 5] if real-%-target-color > 7 and real-%-target-color <= 30 [set class-mean %-target-color + 3 set stand-dev 6 set err -2 + random 5] if real-%-target-color > 30 and real-%-target-color <= 70 [set class-mean %-target-color + 3 set stand-dev 8 set err -3 + random 7] if real-%-target-color > 70 and real-%-target-color <= 93 [set class-mean %-target-color + 3 set stand-dev 6 set err -2 + random 5] if real-%-target-color > 93 and real-%-target-color < 100 [set class-mean %-target-color - 2 set stand-dev 1.5 set err -1] if real-%-target-color = 100 [set stand-dev 0 set class-mean 100 set err 0] set class-mean ( real-%-target-color + err ) set organize? true reveal set guesses-list [] repeat class-size [ set guesses-list ( lput random-normal class-mean stand-dev guesses-list ) ] plot-guesses end to plot-guesses set-current-plot "Student Guesses" clear-plot set-current-plot-pen "guesses" set-histogram-num-bars 100 / cluster-guesses histogram guesses-list set-current-plot-pen "mean-of-guesses" plot-pen-up plotxy (mean guesses-list) plot-y-min plot-pen-down plotxy (mean guesses-list) plot-y-max end ; Copyright 2009 Uri Wilensky. ; See Info tab for full copyright and license.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Sampler Solo.png | preview | Preview for 'Sampler Solo' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.