Center and Variability

Examples

Customize the distribution of kicks

The distribution of kicks per screen and per kicker (Variability screen) can be preset before or after soccer balls have been kicked using the kickDistributionStrategy.

To test a kickDistributionStrategy, navigate to the data entry text box and enter the desired kickDistributionStrategy, then press Set Value.

Below are four customizations for setting a specific kickDistributionStrategy.

Probability by Distance

Set the distribution by giving frequencies or relative frequencies for each of the 15 locations on the number line. If frequencies are entered, the model calculates probabilities (i.e. relative frequencies) automatically. Using this type of distribution strategy allows for a semi-unpredictable distribution where the likelihood of a ball landing in each position is known, but the exact kick distances are unknown.

To test this strategy, navigate to the data entry text box in the Element Panel, enter the value such as the one below, and then press Set Value.

{
   "type": "probabilityByDistance",
   "values": [0,0,1,3,5,7,3,3,1,1,0,0,0,0,1],
   "skewType": null
}

Exact locations in order of kicks

Set the distribution of exact kick distances in the order given in the array. The size of the array is determined by the maximum number of kicks as set in Preferences.

To test this kickDistributionStrategy, navigate to the data entry text box in the Element Panel, enter a value such as the one below, and then press Set Value. The example below tells the model to kick the first ball 5 meters, the second ball 11 meters, and so on.

{
   "type": "distanceByIndex",
   "values": [5,11,9,12,10,2,7,3,4,14,1,15,8,13,2,4,12,10,6,1,13,9,3,14,5,6,11,8,7,15],
   "skewType": null
}

Note: If there are already soccer balls in the play area, the next kick will land in its corresponding array position. For example, if four balls have been kicked into positions 5, 11, 9, and 12 meters, and then the kickDistributionStrategy is set to the above value, the next kick will travel 10 meters (the 5th ball will land at the 5th value in the array).

Random skew

Set the model to randomly choose between a left and a right skewed distribution with equal probability. The array to set a skewed distribution uses the Probability by Distance kickDistributionStrategy described above.

To test this kickDistributionStrategy, navigate to the data entry text box in the Element Panel, enter the value below, and then press Set Value. The given example will first create a left skewed kick distribution. The next time a distribution is created (e.g., upon reset), the kick distribution will randomly have a left or right skew.

{
   "type": "randomSkew",
   "values": null,
   "skewType": "left"
}

Note: The default array used to provide the left-skewed distribution is: [4,4,4,4,4,4,4,5,10,12,18,30,45,25,10]. The right skewed array is reversed.

Fixed Skew

Choose a left or right skewed distribution. Once chosen, the distribution of kicks will continue to have this skew until changed.

To test this kickDistributionStrategy, navigate to the data entry text box in the Element Panel, enter the value below to set the distribution to always be left skewed, and then press Set Value. Replace “left” with “right” to set the distribution to always be right skewed.

{
   "type": "skew",
   "values": null,
   "skewType": "left"
}

Get array of card values or distribution of soccer balls

A command can be used in the API to get the array of soccer ball positions or values of cards in the order they appear.

Get the array of soccer ball locations for the indicated screen

await phetioClient.invokeAsync( 'centerAndVariability.medianScreen.model', 'getDataPoints', [] );
await phetioClient.invokeAsync( 'centerAndVariability.meanAndMedianScreen.model', 'getDataPoints', [] );
await phetioClient.invokeAsync( 'centerAndVariability.variabilityScreen.model', 'getDataPoints', [] );

Get the array of card values, in the order they appear on screen

await phetioClient.invokeAsync( 'centerAndVariability.medianScreen.model.distanceAccordionBox.cardContainerModel', 'getData' )

Collect current scene data

The statistical data related to any distribution is collected under the sceneModel.

Median and Mean & Median screens

The mean and median are the only statistical data provided on these screens.

Variability Screen

The Variability screen contains a separate scene for each kicker, e.g. sceneKicker1Model, which contains a larger variety of statistical data including range, IQR, and MAD.

For brevity, the measures of center and spread on the Variability screen are shown above for kicker 1 only. The phetioIDs for each kicker can be found in the variabilityScreen.model:

In addition to finding statistical data in the PhET-iO Studio tree on the Variability screen, the data for the currently selected scene can be extracted using the API. The example below demonstrates how to get the mean value for the current scene, but the command can be adapted for any of the properties listed above. Note: this is only relevant to the Variability screen. Data for the Median and Mean & Median screens should be obtained using the phetioIDs listed above.

let mean = await phetioClient.invokeAsync( 'centerAndVariability.variabilityScreen.model.selectedSceneModelProperty', 'getValue' )
  .then( async sceneElement => phetioClient.invokeAsync( sceneElement.phetioID + '.meanValueProperty', 'getValue' ) );

Enable or disable soccer balls individually or as a group

Enable/disable soccer balls individually

Each soccer ball on the field can be individually enabled/disabled before or after it has been kicked. Each soccer ball’s phetioID follows the pattern below, replacing variabilityScreen.view.sceneKicker1View with the desired screen and scene, and soccerBallNode1 with the corresponding ball number.

In general, all soccer balls can be found nested under the phetioIDs listed below.

Note: Since each ball has a unique phetioID, the ball number needs to be known so the correct ball is enabled/disabled. If there is a stack of balls at a single location, only the top ball in a stack is auto-selectable, meaning only the top ball’s phetioID is known. It is recommended to disable soccer balls as they are kicked if it is desired to have specific soccer balls disabled and others enabled.

Enable/disable soccer balls as a group

The entire group of soccer balls can be enabled/disabled rather than one ball at a time. If the group is disabled, any remaining soccer balls not yet kicked will be disabled upon kicking.

Note: Disabling the group of soccer balls on the Variability screen will disable the group for all kickers. It is not possible to disable Kicker 1’s group but not Kicker 2’s group, for example.

Listen for manual card sort

The cards on the Median screen can be manually or auto-sorted. The API can listen for an emitter that fires when the cards have been manually sorted. For example, the command below will print “hello” upon a successful manual sort:

phetioClient.invoke( 'centerAndVariability.medianScreen.model.distanceAccordionBox.cardContainerModel.manuallySortedEmitter', 'addListener', [ () => console.log( 'hello' ) ] )

Note: The emitter fires every time the cards have been sorted manually. The Sort Data checkbox auto-sorts the cards, and when any card is moved away and back to its position, the emitter will fire. It is recommended to hide the checkbox or the checkbox group to encourage genuine manual sorting.

Note: The areCardsSortedProperty becomes true regardless of whether the cards were sorted via the checkbox or manually, so to listen for the manual sort, be sure to use the command above rather than the phetioID shown below:

Hide data points in accordion box

The entire distribution of points (x’s or dots, according to the Preferences) can be hidden in the Accordion Box on the Mean & Median or Variability screens.

Customize or hide question bar

The question at the top of each screen can be customized, or the entire bar can be hidden. When the question bar is hidden, the entire accordion box shifts up to the top of the screen.

Customize the question with:

Hide the question bar with:

Customize statistical vocabulary

As noted in PhET-iO guide, most strings are auto-selectable by pressing shift+alt (PC) or shift+option (Mac) and mousing over the text. Strings involving mathematical expressions or calculations, however, are not auto-selectable, such as the mean and median.

All strings in the simulation can be found under general.model.strings and are sorted alphabetically. For example, if you prefer to use the term “average” instead of “mean”, look for instances of “mean” under centerAndVariability.general.model.strings.centerAndVariability and update the strings accordingly. Double check your strings, keeping in mind some of the strings only appear when checkboxes are active, or when dialogs are open.

Control cueing hand on soccer balls and cards

There are two cueing hands in the sim that indicate objects are moveable: one on the Median screen only that appears on the cards in the Accordion box, and one on each screen in the soccer ball area.

Card cueing hand

On the Median screen, the cueing hand on the cards appears upon the second kick and disappears once any card has been moved. If it is desired to create a specific order of the cards prior to launching the sim, it is not possible to move the cards to the desired order as the cueing hand will disappear. We offer two suggestions to force the cue to remain on the cards upon launch:

Soccer ball cueing hand on all screens

The cueing hand that indicated soccer balls are moveable on all screens appears upon the last kick and not before (per Max Kicks value set in Preferences). Like the cueing hand on the cards described above, this cueing hand's visibility nor location is customizable. The hand will appear on the last ball kicked, unless the ball is in the median stack, in which case the hand will move to a new stack. If a specific distribution is desired, we recommend the following:

Set location and visibility of predict tools

The position of the Predict Median, Predict Mean, and Pointer tools can be customized by direct interaction with the simulation in PhET-iO Studio or by using the properties listed below. The positions of these tools will be retained when the checkbox is toggled off and on.

Preset the location of the prediction pointer tools with:

Set the visibility of the prediction pointer tools with:

Customize interval tool

The interval tool has two handles that move independently to create a custom width, and the entire interval tool block can be translated left and right without changing its width. Customize the location of each handle to set the width of the interval tool by direct interaction with the simulation in PhET-iO Studio or by using the properties listed below. Each handle can be made visible/invisible without impacting the translatability of the tool.

Handles

Set the value of each handle with:

Hide the handles to fix the width of the interval. The interval tool block can still be translated left and right.

Interval tool block

Prevent the entire tool from being translatable while still allowing each handle to be interactive:

Preferences

There are four preferences in the Preferences dialog, located under centerAndVariability.global.model.preferences.

Maximum number of kicks

This is a global setting and indicates the maximum number of kicks for all screens.

Since Reset All does not change any preferences, it is recommended to hide the Max Kicks option in the preferences menu when setting the maximum number of kicks via the PhET-iO Standard Wrapper.

Note: Due to the limited space in the accordion box, the maximum number of kicks on the Median screen is 15, regardless of whether the maximum number kicks is set higher than 15 in the Preferences.

Plot type

This setting changes the markers on screens 2 and 3 to be either x’s or dots.

Show outliers

On the Variability screen, outliers can be shown when the boxplot radio button is chosen. Using the standard calculation, any values less than Q1 – 1.5(IQR) or greater than Q3 + 1.5(IQR) are considered outliers and are indicated by a diamond. The default setting is to not show outliers (i.e. include outliers in the whiskers)

The preferences listed above can also be hidden using the phetioIDs below. Note that the preferences dialog must first be opened.

Additionally, the Plot Type radio button can be visible but disabled: