// Numbas version: finer_feedback_settings {"name": "Coursework 1", "metadata": {"description": "", "licence": "None specified"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", "", ""], "variable_overrides": [[], [], [], [], [], [], [], []], "questions": [{"name": "Classify described random variables as qualitative or quantitative (edited)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "tags": ["checked2015"], "metadata": {"description": "

Choosing whether given random variables are qualitative or quantitative.

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

State whether the following variables are Qualitative or Quantitative. 

\n

Note that you will be deducted one mark for every wrong choice. However the minimum mark is 0.

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"qual1": {"name": "qual1", "group": "Ungrouped variables", "definition": "[\"Types of PC used by small businesses in the north-east\",\"Marital status of questionnaire respondents\",\"Month of the year in which small shops record their highest sales\",\"Type of tenure for those in the licensed trade business\",\"Subjects studied at A level by students in this class\"]", "description": "", "templateType": "anything", "can_override": false}, "ind1": {"name": "ind1", "group": "Ungrouped variables", "definition": "2*vector(ind)-vector(1,1,1)", "description": "", "templateType": "anything", "can_override": false}, "ch1": {"name": "ch1", "group": "Ungrouped variables", "definition": "switch(ind[0]=0,random(qual),random(quant))", "description": "", "templateType": "anything", "can_override": false}, "ch2": {"name": "ch2", "group": "Ungrouped variables", "definition": "switch(ind[1]=0,random(qual except ch1),random(quant except ch1))", "description": "", "templateType": "anything", "can_override": false}, "qual": {"name": "qual", "group": "Ungrouped variables", "definition": "qual1+qual2", "description": "", "templateType": "anything", "can_override": false}, "quant2": {"name": "quant2", "group": "Ungrouped variables", "definition": "[\"The number of people requiring a special in-flight meal\",\"The average volume of bottles of wine imported from South America\",\"Salaries of University of Leicester graduates six months after graduation\",\"The distance travelled by taxis for a particular cab firm every day\",\"Total annual sales for a large American departmental store\",\"The total cost of a student's text books for this semester\"]", "description": "", "templateType": "anything", "can_override": false}, "ch3": {"name": "ch3", "group": "Ungrouped variables", "definition": "switch(ind[2]=0,random(qual except [ch1,ch2]),random(quant except [ch1,ch2]))", "description": "", "templateType": "anything", "can_override": false}, "qual2": {"name": "qual2", "group": "Ungrouped variables", "definition": "[\"Ice cream flavour preferred by children\",\"Brand of sportswear preferred by athletes\",\"Favourite type of film by UK cinema-goers\",\"Mobile phone price-plan\",\"Shape of swimming pools in local authority-run leisure centres\"]", "description": "", "templateType": "anything", "can_override": false}, "quant1": {"name": "quant1", "group": "Ungrouped variables", "definition": "[\"The number of orders received by a catering company\",\"The height of students taking Statistics courses at Leicester this year\", \"Your quarterly gas bill\", \"The time spent on hold at a credit call centre\",\"The average shipping time for orders placed with a TV shopping channel\",\"The annual electricity bill for a large UK Supermarket\"]", "description": "", "templateType": "anything", "can_override": false}, "quant": {"name": "quant", "group": "Ungrouped variables", "definition": "quant1+quant2", "description": "", "templateType": "anything", "can_override": false}, "cind": {"name": "cind", "group": "Ungrouped variables", "definition": "-1*ind1", "description": "", "templateType": "anything", "can_override": false}, "ind": {"name": "ind", "group": "Ungrouped variables", "definition": "random([[0,0,0],[1,0,0],[0,1,0],[0,0,1],[0,1,1],[1,0,1],[1,1,0],[1,1,1]])", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "transpose(matrix(list(cind),list(ind1)))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["quant1", "quant2", "qual2", "cind", "qual1", "m", "ch1", "ch2", "ch3", "quant", "ind", "ind1", "qual"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_x", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": true, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "m", "layout": {"type": "all", "expression": ""}, "answers": ["Qualitative", "Quantitative"]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Distributions and moments - Q1", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Tatiana Tyukina", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/341/"}], "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

For the function:

\n

\\[f(x)=\\frac{x}{c}, \\quad  x=1,2,3,4\\]

\n

\n

In parts a,c,d you can enter values as a number rounded to 3 decimal points or as a  fraction.

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"ans_a": {"name": "ans_a", "group": "Ungrouped variables", "definition": "10", "description": "", "templateType": "number", "can_override": false}, "ans_c": {"name": "ans_c", "group": "Ungrouped variables", "definition": "3", "description": "", "templateType": "anything", "can_override": false}, "ans_d": {"name": "ans_d", "group": "Ungrouped variables", "definition": "10", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ans_a", "ans_c", "ans_d"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "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": "

Determine the value of the constant  $c$ so that $f(x)$ satisfies the conditions of being a probability mass function for a random variable $X$

", "answer": "{ans_a}", "showPreview": true, "checkingType": "dp", "checkingAccuracy": 3, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

For the following questions using the value $c$ defined in the pervious part.

\n

Write down the probability distribution function (or cumulative distribution function):

\n\n\n\n\n\n\n\n\n\n\n\n\n
$F(x)= \\begin{cases} \\\\ \\\\ \\\\ \\end{cases} $[[0]],$x=1,2,3,4$
[[1]],otherwise
\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "ans_a", "part": "p0", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x*(1+x)/(2*{ans_a})", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "ans_a", "part": "p0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "0", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the population mean

\n

$\\mu=$[[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "ans_a", "part": "p0", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ans_c}", "showPreview": true, "checkingType": "dp", "checkingAccuracy": 3, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the population variance

\n

$Var(X)=$[[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "ans_a", "part": "p0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ans_d}", "showPreview": true, "checkingType": "dp", "checkingAccuracy": 3, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Distributions and moments - Q8", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Tatiana Tyukina", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/341/"}], "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

For the function:

\n

\\[f(x)=\\frac{x^3}{4}, \\quad 0< x <c\\]

\n

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"ans_a": {"name": "ans_a", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "number", "can_override": false}, "ans_c": {"name": "ans_c", "group": "Ungrouped variables", "definition": "32/20", "description": "", "templateType": "anything", "can_override": false}, "ans_d": {"name": "ans_d", "group": "Ungrouped variables", "definition": "64/(25*24)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ans_a", "ans_c", "ans_d"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Determine  the constant  $c$ in terms of $n$ so that $f(x)$ satisfies the conditions of being a probability density function for a continuous random variable $X$

\n

$c=$[[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ans_a}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Write down the probability distribution function (or cumulative distribution function) for $x$:

\n\n\n\n\n\n\n\n\n\n\n\n\n
$F(x)= \\begin{cases} \\\\ \\\\ \\\\ \\end{cases} $[[0]],$0< x< $[[1]]
0,otherwise
\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x^4/16", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ans_a}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "jme", "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": "

Find the mean of $X$

", "answer": "{ans_c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "jme", "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": "

Find the variance of $X$

", "answer": "{ans_d}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Probability, expectation and variance of exponential distribution ( copy)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "tags": ["checked2015"], "metadata": {"description": "

Question on the exponential distribution involving a time intervals and arrivals application, finding expectation and variance. Also finding the probability that a time interval between arrivals is less than a given period. All parameters and times randomised. 

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

The time,  in {period} between {this} follows an exponential distribution with rate $\\var{ra}$ i.e. 

\n

\\[X \\sim \\operatorname{exp}(\\var{ra})\\]

\n ", "advice": "\n

If $X \\sim \\operatorname{exp}(\\lambda)$ then $\\displaystyle \\operatorname{E}[X] =\\frac{1}{\\lambda}$ and  $\\displaystyle \\operatorname{Var}(X)=\\frac{1}{\\lambda^2}$.

\n

Also $P(X \\lt a)=1-e^{-\\lambda a}$.

\n

a)

\n

If $X \\sim \\operatorname{exp}(\\var{ra})$ then:

\n

$\\displaystyle \\operatorname{E}[X] =\\frac{1}{\\lambda}=\\frac{1}{\\var{ra}}=\\var{ans1}$ to 3 decimal places.

\n

$\\displaystyle \\operatorname{Var}(X) =\\frac{1}{\\lambda^2}=\\frac{1}{\\var{ra}^2}=\\var{ans2}$ to 3 decimal places.

\n

b)

\n

$P(X \\lt \\var{thistime}) = 1 -(e ^ {-\\var{ ra} \\times \\var{thistime}}) = 1 -(e ^ { -\\var{ra * thistime}}) = \\var{ans3}$ to 3 decimal places.

\n ", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"this": {"name": "this", "group": "Ungrouped variables", "definition": "\"customer arrivals at the check-in desk at Airport \"", "description": "", "templateType": "anything", "can_override": false}, "ans2": {"name": "ans2", "group": "Ungrouped variables", "definition": "precround(1/ra^2,3)", "description": "", "templateType": "anything", "can_override": false}, "ans3": {"name": "ans3", "group": "Ungrouped variables", "definition": "precround(tans3,3)", "description": "", "templateType": "anything", "can_override": false}, "ans1": {"name": "ans1", "group": "Ungrouped variables", "definition": "precround(1/ra,3)", "description": "", "templateType": "anything", "can_override": false}, "thistime": {"name": "thistime", "group": "Ungrouped variables", "definition": "random(0.8..1.8#0.1)", "description": "", "templateType": "anything", "can_override": false}, "tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0.001", "description": "", "templateType": "anything", "can_override": false}, "ra": {"name": "ra", "group": "Ungrouped variables", "definition": "random(0.2..1.2#0.1)", "description": "", "templateType": "anything", "can_override": false}, "that": {"name": "that", "group": "Ungrouped variables", "definition": "\"two customers arriving \"", "description": "", "templateType": "anything", "can_override": false}, "tans3": {"name": "tans3", "group": "Ungrouped variables", "definition": "1-exp(-ra*thistime)", "description": "", "templateType": "anything", "can_override": false}, "period": {"name": "period", "group": "Ungrouped variables", "definition": "\"minutes\"", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["that", "this", "ans1", "ans2", "ans3", "period", "ra", "tol", "tans3", "thistime"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\n

Find $\\operatorname{E}[X]$ between {this}:

\n

$\\operatorname{E}[X]=\\;$?[[0]]{period} (enter as a decimal correct to 3 decimal places).

\n

Find $\\operatorname{Var}(X)$:

\n

$\\operatorname{Var}(X)=\\;$?[[1]](enter as a decimal correct to 3 decimal places).

\n ", "gaps": [{"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, "minValue": "ans1-tol", "maxValue": "ans1+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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, "minValue": "ans2-tol", "maxValue": "ans2+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the probability that the time between {that} is less than $\\var{thistime}$ {period}:

\n

 $P(X \\lt \\var{thistime})=\\;$?[[0]](enter as a decimal correct to 3 decimal places)

", "gaps": [{"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, "minValue": "ans3-tol", "maxValue": "ans3+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Formula for the MGF (copy)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Chris Drovandi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9840/"}, {"name": "adam bretherton", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18177/"}, {"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

What is the formula for the MGF of a continuous RV $X$?

", "advice": "

$m_X(s) =\\mbox{E}[e^{sX}] =\\int_x e^{sx}f(x)dx$

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {"mark": {"script": "// Reveal answers, score and advice\nthis.display.revealAnswer();\nthis.display.showScore();\nNumbas.controls.getAdvice();", "order": "before"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["$m_X(s) =\\mbox{E}[e^{sX}] =\\int_x e^{sx}f(x)dx$", "$m_X(s) =\\mbox{E}[es^{X}] =\\int_x es^{x}f(x)dx$", "$m_X(s) =\\mbox{E}[s^{Xe}] =\\int_x s^{xe}f(x)dx$"], "matrix": ["1", 0, 0], "distractors": ["", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "MGF of the standard normal distribution (copy)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Chris Drovandi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9840/"}, {"name": "adam bretherton", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18177/"}, {"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

The MGF of the standard Normal distribution ($\\mu = 0, \\sigma^2 = 1$) is given by $\\frac{s^2}{2}$?

", "advice": "

This is actually the CGF of the standard normal.

\n

The MGF is $\\exp(\\frac{s^2}{2})$

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {"mark": {"script": "// Reveal answers, score and advice\nthis.display.revealAnswer();\nthis.display.showScore();\nNumbas.controls.getAdvice();", "order": "before"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["False", "True"], "matrix": ["1", 0], "distractors": ["", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "InterimTest - Question 1 as 2021", "extensions": ["stats"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

Is each number in the expected answer present in the student's list the correct number of times?

", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "definition": "all(included)"}, {"name": "no_extras", "description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Tatiana Tyukina", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/341/"}], "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

A pharmaceutical company wants to know whether an experimental drug has a stabilising effect on blood pressure.

\n

Twenty randomly selected subjects were given the drug and after sufficient time for the drug to have an impact, their systolic blood pressures were recorded.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
106118118123128
128129130132133
136136137140140
143147152161184
\n

\n

In the questions where you need to enter numeric values, please round your answers to 3 decimal places

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"nobs": {"name": "nobs", "group": "Data", "definition": "20", "description": "

random(15..20)

", "templateType": "anything", "can_override": false}, "sample": {"name": "sample", "group": "Data", "definition": "sort([106, 118, 118, 123, 128, 128, 129, 130, 132, 133, 136, 136, 137, 140, 140, 143, 147, 152, 161, 184])", "description": "

sort(repeat(round(normalsample(MeanPop, StdPop)),Nobs))

", "templateType": "anything", "can_override": false}, "meanpop": {"name": "meanpop", "group": "Data", "definition": "random(50..500)", "description": "", "templateType": "anything", "can_override": false}, "stdpop": {"name": "stdpop", "group": "Data", "definition": "if(MeanPop<200,random(5..20),random(50..100))", "description": "", "templateType": "anything", "can_override": false}, "minSample": {"name": "minSample", "group": "Data", "definition": "min(sample)", "description": "", "templateType": "anything", "can_override": false}, "maxSample": {"name": "maxSample", "group": "Data", "definition": "max(sample)", "description": "", "templateType": "anything", "can_override": false}, "Nbins": {"name": "Nbins", "group": "Frequency distribution", "definition": "9", "description": "

if(U-L<50, (U-L)/5, if((U-L)/10<10, (U-L)/10, if(mod((U-L)/10,6)=0, 6, if(mod((U-L)/10,7)=0, 7, if(mod((U-L)/10,8)=0, 8,10)))))

", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Frequency distribution", "definition": "floor(minSample/10)*10", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "Frequency distribution", "definition": "ceil(MaxSample/10)*10", "description": "", "templateType": "anything", "can_override": false}, "breaks": {"name": "breaks", "group": "Frequency distribution", "definition": "[105, 115, 125, 135, 145, 155, 165, 175]", "description": "

if(U-L<50, iterate(x+(U-L)/5/Nbins*5,x,L+(U-L)/5/Nbins*5,Nbins-1),iterate(x+(U-L)/10/Nbins*10,x,L+(U-L)/10/Nbins*10,Nbins-1))

", "templateType": "anything", "can_override": false}, "FreqIntervals": {"name": "FreqIntervals", "group": "Frequency distribution", "definition": "latex(Intervals2String(Breaks))", "description": "", "templateType": "anything", "can_override": false}, "Freqs": {"name": "Freqs", "group": "Frequency distribution", "definition": "FreqTable(sample,breaks)", "description": "", "templateType": "anything", "can_override": false}, "RelFreqs": {"name": "RelFreqs", "group": "Frequency distribution", "definition": "list(vector(Freqs)/Nobs)", "description": "", "templateType": "anything", "can_override": false}, "midpoints": {"name": "midpoints", "group": "Grouped Statistics", "definition": "midpoints4groups(l,breaks)", "description": "", "templateType": "anything", "can_override": false}, "midpoints_last": {"name": "midpoints_last", "group": "Grouped Statistics", "definition": "midpoints[length(midpoints)-1]", "description": "", "templateType": "anything", "can_override": false}, "samplemean": {"name": "samplemean", "group": "Ungrouped variables", "definition": "mean(sample)", "description": "", "templateType": "anything", "can_override": false}, "groupedMean": {"name": "groupedMean", "group": "Grouped Statistics", "definition": "grMean(midpoints,RelFreqs)", "description": "", "templateType": "anything", "can_override": false}, "samplestd": {"name": "samplestd", "group": "Ungrouped variables", "definition": "stdev(sample,true)", "description": "", "templateType": "anything", "can_override": false}, "groupedVar": {"name": "groupedVar", "group": "Grouped Statistics", "definition": "grVar(midpoints,relfreqs,nobs)", "description": "", "templateType": "anything", "can_override": false}, "groupedStd": {"name": "groupedStd", "group": "Grouped Statistics", "definition": "sqrt(groupedVar)", "description": "", "templateType": "anything", "can_override": false}, "sampleSum": {"name": "sampleSum", "group": "Ungrouped variables", "definition": "sum(vector(sample))", "description": "", "templateType": "anything", "can_override": false}, "sample2Sum": {"name": "sample2Sum", "group": "Ungrouped variables", "definition": "sum(vector(map(x^2,x, sample)))", "description": "", "templateType": "anything", "can_override": false}, "sampleMedian": {"name": "sampleMedian", "group": "Ungrouped variables", "definition": "median(sample)", "description": "", "templateType": "anything", "can_override": false}, "sampleIQR": {"name": "sampleIQR", "group": "Ungrouped variables", "definition": "samplequartiles[2]-samplequartiles[0]", "description": "", "templateType": "anything", "can_override": false}, "sampleQuartiles": {"name": "sampleQuartiles", "group": "Ungrouped variables", "definition": "sample3Quartiles(sample)", "description": "

quartiles(sample)

", "templateType": "anything", "can_override": false}, "midrange": {"name": "midrange", "group": "Ungrouped variables", "definition": "(max(sample)+min(sample))/2", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "CI variables", "definition": "random([90,95,99])", "description": "", "templateType": "anything", "can_override": false}, "marginoferror": {"name": "marginoferror", "group": "CI variables", "definition": "zAlpha2*samplestd/sqrt(nobs)", "description": "", "templateType": "anything", "can_override": false}, "zAlpha2": {"name": "zAlpha2", "group": "CI variables", "definition": "siground(normalinv(1-(1-alpha/100)/2,0,1),4)", "description": "", "templateType": "anything", "can_override": false}, "LeftLimit": {"name": "LeftLimit", "group": "CI variables", "definition": "samplemean-marginoferror", "description": "", "templateType": "anything", "can_override": false}, "RightLimit": {"name": "RightLimit", "group": "CI variables", "definition": "samplemean+marginoferror", "description": "", "templateType": "anything", "can_override": false}, "sampleVar": {"name": "sampleVar", "group": "Ungrouped variables", "definition": "samplestd^2", "description": "", "templateType": "anything", "can_override": false}, "alphatrim": {"name": "alphatrim", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "trimmedmean": {"name": "trimmedmean", "group": "Ungrouped variables", "definition": "mean(sample[1..19])", "description": "", "templateType": "anything", "can_override": false}, "trimmedstd": {"name": "trimmedstd", "group": "Ungrouped variables", "definition": "stdev(sample[1..19],true)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["samplemean", "samplestd", "sampleSum", "sample2Sum", "sampleMedian", "sampleIQR", "sampleQuartiles", "midrange", "sampleVar", "alphatrim", "trimmedmean", "trimmedstd"], "variable_groups": [{"name": "Data", "variables": ["nobs", "sample", "meanpop", "stdpop", "minSample", "maxSample"]}, {"name": "Frequency distribution", "variables": ["Nbins", "breaks", "FreqIntervals", "l", "u", "Freqs", "RelFreqs"]}, {"name": "Grouped Statistics", "variables": ["midpoints_last", "midpoints", "groupedMean", "groupedVar", "groupedStd"]}, {"name": "CI variables", "variables": ["alpha", "marginoferror", "zAlpha2", "LeftLimit", "RightLimit"]}], "functions": {"intervals2String": {"parameters": [["Breaks", "list of number"]], "type": "string", "language": "javascript", "definition": " var out = '';\n out+= '(0,'+Breaks[0].toString()+'],';\n for(i =0; iCalcuate the following descriptive statistics of the sample:

\n

\n

Sample mean:

\n

$\\bar{x}=$[[0]]

\n

Sample variance:

\n

Var$(x)=$[[6]]

\n

Sample standard deviation:

\n

$s_X=$[[1]]

\n

First Quartile:

\n

$Q_1=$[[2]]

\n

Sample median:

\n

$\\textbf{Median}=$[[3]]

\n

Third Quartile:

\n

$Q_3=$[[4]]

\n

Interquartile range:

\n

$\\textbf{IQR}=$[[5]]

\n

\n

\n

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "SampleMean", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleMean", "maxValue": "sampleMean", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "SampleStDev", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "samplestd", "maxValue": "samplestd", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Q1", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleQuartiles[0]", "maxValue": "sampleQuartiles[0]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Median", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleQuartiles[1]", "maxValue": "sampleQuartiles[1]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Q3", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleQuartiles[2]", "maxValue": "sampleQuartiles[2]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "IQR", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleIQR", "maxValue": "sampleIQR", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "SampleVar", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sampleVar-0.005", "maxValue": "sampleVar+0.005", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Part 2. Frequency distribution", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Construct a relative frequency distribution for the data, taking as your grouping intervals the following $\\var{Nbins}$ intervals:

\n

\\[\\var{FreqIntervals}\\]

\n

Write a list of the corresponding frequencies as numbers separated by commas (for example, 1,2,3,2,1)

\n

\n

[[0]]

\n

Write a list of the relative frequencies as fractions separated by commas (for example, 1/9, 2/9, 1/3, 2/9, 1/9)

\n

\n

[[1]]

\n

\n

\n

", "gaps": [{"type": "list-of-numbers", "useCustomName": true, "customName": "Frequencies", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "{Freqs}", "allowFractions": false, "correctAnswerFractions": false, "isSet": false, "show_input_hint": true, "separator": ","}}, {"type": "list-of-numbers", "useCustomName": true, "customName": "Relative Frequencies", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "{RelFreqs}", "allowFractions": true, "correctAnswerFractions": true, "isSet": false, "show_input_hint": true, "separator": ","}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Part 3. Trimmed sample", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the following statistics for the $\\alpha$-trimmed  sample, if $\\alpha=\\var{alphaTrim}$%:

\n

\n

$\\alpha$-trimmed mean:

\n

[[0]]

\n

trimmed sample deviation:

\n

[[1]]

\n

\n

\n

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "TrimmedMean", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "trimmedMean-0.005", "maxValue": "trimmedMean+0.005", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "TrimmedStDev", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "trimmedstd-0.005", "maxValue": "trimmedstd+0.005", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Mean, SD, median and IQR (copy)", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "tags": [], "metadata": {"description": "

Find mean, SD, median and IQR for a sample.

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

Find the mean, SD, median and IQR for the following sample of $\\var{n}$ data values:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{r0[0]}{r0[1]}{r0[2]}{r0[3]}{r0[4]}{r0[5]}{r0[6]}{r0[7]}{r0[8]}{r0[9]}{r0[10]}{r0[11]}
{r0[12]}{r0[13]}{r0[14]}{r0[15]}{r0[16]}{r0[17]}{r0[18]}{r0[19]}{r0[20]}{r0[21]}{r0[22]}{r0[23]}
\n

Find the sample mean to 1 decimal place and the sample standard deviation to 3 significant figures.

", "advice": "

Sample mean: The sample mean is $\\frac{\\var{sum(r0)}}{\\var{len(r0)}} = \\var{precround(mean(r0),1)}$ to 1 decimal place.

\n

Sample standard deviation: The sample standard deviation is $\\var{stdev(r0,true)}=\\var{siground(stdev(r0,true),3)}$ to 3 significant figures.

\n

If you order the data in increasing order you get the following table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$
$\\var{r1[8]}$$\\var{r1[9]}$$\\var{r1[10]}$$\\var{r1[11]}$$\\var{r1[12]}$$\\var{r1[13]}$$\\var{r1[14]}$$\\var{r1[15]}$
$\\var{r1[16]}$$\\var{r1[17]}$$\\var{r1[18]}$$\\var{r1[19]}$$\\var{r1[20]}$$\\var{r1[21]}$$\\var{r1[22]}$$\\var{r1[23]}$
\n

Denote the ordered data by $x_j$, thus $x_{10}=\\var{r1[9]}$ for example.

\n

Median: The median lies between the 12th and 13th entries in the ordered table and is given by:

\n

\\[0.5\\times x_{12}+0.5\\times x_{13} = 0.5\\times\\var{r1[11]}+0.5\\times \\var{r1[12]}=\\var{median}\\]

\n

Interquartile range: As there is an even number of values, the Lower Quartile will lie between two values. Its position is calculated by finding

\n

\\[\\frac{n+1}{4}=\\frac{\\var{n+1}}{4}=6\\frac{1}{4}\\]

\n

Hence the Lower Quartile lies between the 6th and 7th entries in the ordered table.

\n

It is \\[0.75\\times x_6+0.25\\times x_7 = 0.75\\times\\var{r1[5]}+0.25\\times \\var{r1[6]}=\\var{lquartile}\\]

\n

Once again as there is an even number of values, the Upper Quartile will lie between two values and its position is calculated by finding

\n

\\[\\frac{3(n+1)}{4}=\\frac{\\var{3*(n+1)}}{4}=18\\frac{3}{4}\\]

\n

Hence the Upper Quartile lies between the 18th and 19th entries in the ordered table.

\n

We find it is \\[0.25\\times x_{18}+0.75\\times x_{19} = 0.25\\times\\var{r1[17]}+0.75\\times \\var{r1[18]}=\\var{uquartile}\\]

\n

The interquartile range is defined to be

\n

\\[ \\text{Upper Quartile} – \\text{Lower Quartile} \\]

\n

and so in this case we have:

\n

\\[ \\text{Interquartile range} = \\var{uquartile}-\\var{lquartile}=\\var{interq} \\]

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"things": {"name": "things", "group": "Ungrouped variables", "definition": "'tomatoes '", "description": "", "templateType": "anything", "can_override": false}, "interq": {"name": "interq", "group": "Ungrouped variables", "definition": "uquartile-lquartile", "description": "", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Ungrouped variables", "definition": "random(10..19)", "description": "", "templateType": "anything", "can_override": false}, "lquartile": {"name": "lquartile", "group": "Ungrouped variables", "definition": "0.75*r1[5]+0.25*r1[6]", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "'grams'", "description": "", "templateType": "anything", "can_override": false}, "r1": {"name": "r1", "group": "Ungrouped variables", "definition": "sort(r0)", "description": "", "templateType": "anything", "can_override": false}, "description": {"name": "description", "group": "Ungrouped variables", "definition": "' from a new kind of tomato plant.'", "description": "", "templateType": "anything", "can_override": false}, "uquartile": {"name": "uquartile", "group": "Ungrouped variables", "definition": "0.25*r1[17]+0.75*r1[18]", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "24", "description": "", "templateType": "anything", "can_override": false}, "mean": {"name": "mean", "group": "Ungrouped variables", "definition": "mean(r0)", "description": "", "templateType": "anything", "can_override": false}, "median": {"name": "median", "group": "Ungrouped variables", "definition": "0.5*(r1[11]+r1[12])", "description": "", "templateType": "anything", "can_override": false}, "r0": {"name": "r0", "group": "Ungrouped variables", "definition": "repeat(random(l..u),24)", "description": "", "templateType": "anything", "can_override": false}, "whatever": {"name": "whatever", "group": "Ungrouped variables", "definition": "'weights'", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "random(20..60)", "description": "", "templateType": "anything", "can_override": false}, "stdev": {"name": "stdev", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),2)", "description": "", "templateType": "anything", "can_override": false}, "var": {"name": "var", "group": "Ungrouped variables", "definition": "variance(r0,true)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["uquartile", "r0", "description", "things", "median", "interq", "whatever", "l", "var", "lquartile", "u", "mean", "stdev", "units", "n", "r1"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Mean (1 dp)SD (3 sf)Median (exact value)IQR (exact value)
[[0]][[1]][[2]][[3]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0.5, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{precround(mean(r0),1)}", "maxValue": "{precround(mean(r0),1)}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0.5, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{siground(stdev(r0,true),3)}", "maxValue": "{siground(stdev(r0,true),3)}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0.5, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{median}", "maxValue": "{median}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0.5, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{interq}", "maxValue": "{interq}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "allowPrinting": true, "navigation": {"allowregen": false, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showresultspage": "review"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": false, "showactualmarkwhen": "oncompletion", "showtotalmarkwhen": "always", "showanswerstatewhen": "inreview", "showpartfeedbackmessageswhen": "inreview", "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview", "allowrevealanswer": false, "intro": "", "end_message": "", "results_options": {"printquestions": false, "printadvice": false}, "feedbackmessages": [], "reviewshowexpectedanswer": true, "showanswerstate": false, "reviewshowfeedback": true, "showactualmark": false, "showtotalmark": true, "reviewshowscore": true, "reviewshowadvice": true}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Nikon Kurnosov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28343/"}], "extensions": ["stats"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

Is each number in the expected answer present in the student's list the correct number of times?

", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "definition": "all(included)"}, {"name": "no_extras", "description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": []}