// Numbas version: exam_results_page_options {"name": "Calculate the median of a sample - increasing difficulty", "metadata": {"description": "

A demonstration of the exam-level variable override feature. The student is shown the same question several times, but each instance is set up to suggest a different error in the process of computing the median of a sample. The first instance is very easy, and the last is pretty hard.

", "licence": "Creative Commons Attribution 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", "", ""], "variable_overrides": [[{"name": "n", "definition": "3"}, {"name": "sample_range", "definition": "1..5"}, {"name": "already_sorted", "definition": "true"}], [{"name": "n", "definition": "3"}, {"name": "sample_range", "definition": "1..5"}], [{"name": "n", "definition": "4"}, {"name": "sample_range", "definition": "1..50"}, {"name": "already_sorted", "definition": "true"}], [{"name": "n", "definition": "4"}, {"name": "already_sorted", "definition": "true"}], [{"name": "n", "definition": "5"}, {"name": "already_sorted", "definition": "true"}], [{"name": "n", "definition": "11"}, {"name": "already_sorted", "definition": "true"}], [{"name": "n", "definition": "11"}], [{"name": "n", "definition": "18"}]], "questions": [{"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate the median of a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A question designed to demonstrate the exam-level variable overrides feature. The student must work out the median of a given sample. The exam can override size of the sample, the range of numbers to pick, and whether the sample should be shown to the student in increasing order.

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

A friend has measured the heights of {n} trees, in metres, and obtained the following data.

\n

{table(map(show_sample[i..i+5],i,0..len(show_sample)#5))}

", "advice": "

First, put the measurements in increasing order.

\n

{table(map(sorted_sample[i..i+5],i,0..len(sorted_sample)#5))}

\n

There are {n} measurements in the sample, so the median is the measurement in position {(n+1)/2}the mean of the measurements in positions {n/2} and {n/2+1}.

\n

The median is {median}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Can be overridden", "definition": "random(3..20)", "description": "

The size of the sample.

", "templateType": "anything", "can_override": true}, "sample": {"name": "sample", "group": "Ungrouped variables", "definition": "repeat(random(sample_range),n)", "description": "", "templateType": "anything", "can_override": false}, "sample_range": {"name": "sample_range", "group": "Can be overridden", "definition": "1..10#0.1", "description": "

The range of numbers to sample from, uniformly.

", "templateType": "anything", "can_override": true}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "already_sorted": {"name": "already_sorted", "group": "Can be overridden", "definition": "false", "description": "

If true, the sample is shown to the student in increasing order.

", "templateType": "anything", "can_override": true}, "show_sample": {"name": "show_sample", "group": "Ungrouped variables", "definition": "if(already_sorted,sort(sample),sample)", "description": "", "templateType": "anything", "can_override": false}, "sorted_sample": {"name": "sorted_sample", "group": "Ungrouped variables", "definition": "sort(sample)", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// Either the sample is shown to the student already sorted,\n already_sorted\n or \n (\n// The sample isn't already in order\n sample<>sort(sample)\n and\n// You don't get the median if you forget to sort the sample first\n median<>if(mod(n,2)=0,(sample[n/2]+sample[n/2+1])/2, sample[(n+1)/2]) \n )", "maxRuns": 100}, "ungrouped_variables": ["sample", "show_sample", "median", "sorted_sample", "mean"], "variable_groups": [{"name": "Can be overridden", "variables": ["n", "sample_range", "already_sorted"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the median of this sample?

", "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have calculate the mean of the data instead of the median!

", "useAlternativeFeedback": false, "minValue": "mean(sample)", "maxValue": "mean(sample)", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": false, "showresultspage": "oncompletion", "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": false, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0, "intro": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": []}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}