// Numbas version: exam_results_page_options {"name": "Stats extension: data binning function", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Stats extension: data binning function", "tags": [], "metadata": {"description": "

Shows how to use the bin function to group data into equal-sized intervals.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{num_measurements} measurements were taken.

\n

They have been grouped into {num_bins} equal intervals below.

\n

{bin_frequency_table}

", "advice": "", "rulesets": {}, "extensions": ["stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"measurements": {"name": "measurements", "group": "Ungrouped variables", "definition": "repeat(normalsample(mean,stdev),num_measurements)", "description": "

Randomly generated measurements. From a normal distribution.

", "templateType": "anything", "can_override": false}, "binned_measurements": {"name": "binned_measurements", "group": "Ungrouped variables", "definition": "bin(measurements,num_bins,bin_range)", "description": "

The measurements, binned.

", "templateType": "anything", "can_override": false}, "bin_frequencies": {"name": "bin_frequencies", "group": "Ungrouped variables", "definition": "map(len(bin),bin,binned_measurements)", "description": "

For each bin, the number of measurements in that bin.

", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "15", "description": "

The mean measurement.

", "templateType": "anything", "can_override": false}, "stdev": {"name": "stdev", "group": "Ungrouped variables", "definition": "3", "description": "

The standard deviation of the measurement.

", "templateType": "anything", "can_override": false}, "bin_intervals": {"name": "bin_intervals", "group": "Ungrouped variables", "definition": "let(\n bin_width, (range_max - range_min)/num_bins,\n map(\n let(\n a, range_min + i * bin_width,\n b, a + bin_width,\n inequality, if(i=num_bins-1, \"\u2264\", \"<\"),\n \"$\"+\"{a} \u2264 x {inequality} {b}\"+\"$\"\n ),\n i, 0..(num_bins-1)\n )\n)", "description": "

Text descriptions of the intervals covered by each bin.

", "templateType": "anything", "can_override": false}, "num_bins": {"name": "num_bins", "group": "Ungrouped variables", "definition": "10", "description": "

The number of bins to put the data into.

", "templateType": "number", "can_override": false}, "bin_range": {"name": "bin_range", "group": "Ungrouped variables", "definition": "range_min..range_max", "description": "

The range spanned by the bins. Defined to contain all the measurements, rounded up the nearest multiple of 5.

", "templateType": "anything", "can_override": false}, "bin_frequency_table": {"name": "bin_frequency_table", "group": "Ungrouped variables", "definition": "table(transpose([bin_intervals,bin_frequencies]))", "description": "

A table showing the interval spanned by each bin, and the number of values in that bin.

", "templateType": "anything", "can_override": false}, "num_measurements": {"name": "num_measurements", "group": "Ungrouped variables", "definition": "100", "description": "", "templateType": "anything", "can_override": false}, "range_min": {"name": "range_min", "group": "Ungrouped variables", "definition": "floor(min(measurements)/5)*5", "description": "

The start of the range spanned by the bins. Defined to contain all the measurements, rounded down to the nearest multiple of 5.

", "templateType": "anything", "can_override": false}, "range_max": {"name": "range_max", "group": "Ungrouped variables", "definition": "ceil(max(measurements)/5)*5", "description": "

The end of the range spanned by the bins. Defined to contain all the measurements, rounded up to the nearest multiple of 5.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "sum(bin_frequencies)=100", "maxRuns": 100}, "ungrouped_variables": ["num_measurements", "mean", "stdev", "measurements", "num_bins", "range_min", "range_max", "bin_range", "binned_measurements", "bin_frequencies", "bin_intervals", "bin_frequency_table"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}