// Numbas version: exam_results_page_options {"name": "mathcentre: Probability mass functions", "type": "exam", "duration": 0, "metadata": {"notes": "", "description": "

Use a probability mass function; determine if a given function is a probability mass function; find the probability mass function of a discrete distribution and use it.

", "licence": "Creative Commons Attribution 4.0 International"}, "allQuestions": true, "shuffleQuestions": false, "questions": [], "percentPass": 75, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "pickQuestions": 0, "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "preventleave": false, "browse": true, "showfrontpage": false, "showresultspage": "never"}, "feedback": {"showtotalmark": true, "advicethreshold": 0, "showanswerstate": true, "showactualmark": true, "allowrevealanswer": true}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "IP3.1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "ungrouped_variables": ["strexceed", "idef", "period", "episodes", "rdexp", "u2", "check", "n9", "u1", "u3", "probexceed", "ecom", "d", "p2", "p3", "p0", "p1", "p6", "p7", "p4", "p5", "p8", "t2", "t1", "n8", "thing", "s", "r", "t", "activity", "n1", "n2", "n3", "n4", "n5", "n6", "n7"], "tags": ["PMF", "Probability", "discrete distribution", "expectation", "expected value", "mass function", "pmf", "probability", "probability mass function", "query", "sc", "statistics", "tested1"], "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

The expected number is given by:

\n

\\[\\simplify[]{{p0 / 100} * {n1} + {p1 / 100} * {n2} + {p2 / 100} * {n3} + {p3 / 100} * {n4} + {p4 / 100} * {n5} + {p5 / 100} * {n6} + {p6 / 100} * {n7} + {p7 / 100} * {n8} + {p8 / 100} * {n9} = {ecom}}\\]

\n

b)

\n

We want the probability that the number of {episodes} exceeds $\\var{ecom}$

\n

This is the probability that the number exceeds $\\var{rdexp}$ and is

\n

\\[\\sum_{i=\\var{rdexp+1}}^{i=8}\\left( \\mbox{Probability complaints}=i\\right)=\\simplify[]{{strexceed} }= \\var{probexceed/100}\\]

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "

Find the expected number of {episodes} per {period}.

\n

Answer to $2$ decimal places

\n

Expected number = [[0]]

", "marks": 0, "gaps": [{"allowFractions": false, "marks": 2, "maxValue": "{ecom+0.01}", "minValue": "{ecom-0.01}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

What is the probability that the number of {episodes} will exceed the expected number?

\n

Answer to $2$ decimal places.

\n

Probability = [[0]]

", "marks": 0, "gaps": [{"allowFractions": false, "marks": 2, "maxValue": "{probexceed/100+0.01}", "minValue": "{probexceed/100-0.01}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n

The probabilities that {idef} {thing} will receive {episodes} per {period} about its {activity} are given by the following table:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Complaints012345678
Probability$\\var{p0/100}$$\\var{p1/100}$$\\var{p2/100}$$\\var{p3/100}$$\\var{p4/100}$$\\var{p5/100}$$\\var{p6/100}$$\\var{p7/100}$$\\var{p8/100}$
\n

Answer the following two parts:

\n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"strexceed": {"definition": "if(ecom>3,p4/100+'+'+p5/100+'+'+p6/100+'+'+p7/100+'+'+p8/100,if(ecom>4,p5/100+'+'+p6/100+'+'+p7/100+'+'+p8/100,if(ecom>5,p6/100+'+'+p7/100+'+'+p8/100,p3/100+'+'+p4/100+'+'+p5/100+'+'+p6/100+'+'+p7/100+'+'+p8/100)))", "templateType": "anything", "group": "Ungrouped variables", "name": "strexceed", "description": ""}, "idef": {"definition": "'an'", "templateType": "anything", "group": "Ungrouped variables", "name": "idef", "description": ""}, "period": {"definition": "'day'", "templateType": "anything", "group": "Ungrouped variables", "name": "period", "description": ""}, "episodes": {"definition": "'complaints'", "templateType": "anything", "group": "Ungrouped variables", "name": "episodes", "description": ""}, "rdexp": {"definition": "floor(ecom)", "templateType": "anything", "group": "Ungrouped variables", "name": "rdexp", "description": ""}, "probexceed": {"definition": "if(ecom>3,p4+p5+p6+p7+p8,if(ecom>4,p5+p6+p7+p8,if(ecom>5,p6+p7+p8,100-p0-p1-p2)))", "templateType": "anything", "group": "Ungrouped variables", "name": "probexceed", "description": ""}, "check": {"definition": "p0+p1+p2+p3+p4+p5+p6+p7+p8", "templateType": "anything", "group": "Ungrouped variables", "name": "check", "description": ""}, "thing": {"definition": "'airline'", "templateType": "anything", "group": "Ungrouped variables", "name": "thing", "description": ""}, "u1": {"definition": "round(d*random(70..100)/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "u1", "description": ""}, "u3": {"definition": "u1", "templateType": "anything", "group": "Ungrouped variables", "name": "u3", "description": ""}, "u2": {"definition": "u1", "templateType": "anything", "group": "Ungrouped variables", "name": "u2", "description": ""}, "ecom": {"definition": "(n1*p0+n2*p1+n3*p2+n4*p3+n5*p4+n6*p5+n7*p6+n8*p7+n9*p8)/100", "templateType": "anything", "group": "Ungrouped variables", "name": "ecom", "description": ""}, "p7": {"definition": "p8+u1", "templateType": "anything", "group": "Ungrouped variables", "name": "p7", "description": ""}, "p2": {"definition": "p1+t2", "templateType": "anything", "group": "Ungrouped variables", "name": "p2", "description": ""}, "p3": {"definition": "r-p0-p1-p2", "templateType": "anything", "group": "Ungrouped variables", "name": "p3", "description": ""}, "p0": {"definition": "s", "templateType": "anything", "group": "Ungrouped variables", "name": "p0", "description": ""}, "p1": {"definition": "p0+t1", "templateType": "anything", "group": "Ungrouped variables", "name": "p1", "description": ""}, "p6": {"definition": "p7+u2", "templateType": "anything", "group": "Ungrouped variables", "name": "p6", "description": ""}, "d": {"definition": "round(t/15)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "p4": {"definition": "t-p8-p7-p6-p5", "templateType": "anything", "group": "Ungrouped variables", "name": "p4", "description": ""}, "p5": {"definition": "p6+u3", "templateType": "anything", "group": "Ungrouped variables", "name": "p5", "description": ""}, "p8": {"definition": "d", "templateType": "anything", "group": "Ungrouped variables", "name": "p8", "description": ""}, "t2": {"definition": "t1", "templateType": "anything", "group": "Ungrouped variables", "name": "t2", "description": ""}, "t1": {"definition": "round(s*random(70..100)/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "t1", "description": ""}, "n8": {"definition": "7", "templateType": "anything", "group": "Ungrouped variables", "name": "n8", "description": ""}, "n9": {"definition": "8", "templateType": "anything", "group": "Ungrouped variables", "name": "n9", "description": ""}, "s": {"definition": "round(r/10)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "r": {"definition": "random(45..65)", "templateType": "anything", "group": "Ungrouped variables", "name": "r", "description": ""}, "t": {"definition": "100-r", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "activity": {"definition": "'luggage handling'", "templateType": "anything", "group": "Ungrouped variables", "name": "activity", "description": ""}, "n1": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "n1", "description": ""}, "n2": {"definition": "1", "templateType": "anything", "group": "Ungrouped variables", "name": "n2", "description": ""}, "n3": {"definition": "2", "templateType": "anything", "group": "Ungrouped variables", "name": "n3", "description": ""}, "n4": {"definition": "3", "templateType": "anything", "group": "Ungrouped variables", "name": "n4", "description": ""}, "n5": {"definition": "4", "templateType": "anything", "group": "Ungrouped variables", "name": "n5", "description": ""}, "n6": {"definition": "5", "templateType": "anything", "group": "Ungrouped variables", "name": "n6", "description": ""}, "n7": {"definition": "6", "templateType": "anything", "group": "Ungrouped variables", "name": "n7", "description": ""}}, "metadata": {"notes": "\n \t\t

7/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculation.

\n \t\t

22/07/2012:

\n \t\t

Added description.

\n \t\t

Ticked stats extension box.

\n \t\t

31/07/2012:

\n \t\t

Added tags.

\n \t\t

Question appears to be working correctly.

\n \t\t

20/12/2012:

\n \t\t

Could increase the number of scenarios by using random string variables. Query tag added for that.

\n \t\t

Also very cumbersome use of variables. But no change proposed for now.

\n \t\t

Checked calculation, OK. Added tested1 tag.

\n \t\t

21/12/2012:

\n \t\t

Although asks for solution to 2 dps, there is no rounding as the raw values are to 2 dps. Added sc tag for possible scenarios.

\n \t\t", "description": "

Given a probability mass function $P(X=i)$ with outcomes $i \\in \\{0,1,2,\\ldots 8\\}$, find the expectation $E$ and $P(X \\gt E)$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "IP3.2", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "ungrouped_variables": ["a", "negerror", "c", "b", "error", "flse2", "flse1", "d3", "d4", "u", "t", "correct1", "correct2", "flse", "d2", "correct", "d1"], "tags": ["PMF", "Probability", "discrete distribution", "mass function", "pmf", "probabilities", "probability", "probability mass function", "statistics", "tested1"], "preamble": {"css": "", "js": ""}, "advice": "

A probability mass function $f(x)=P(X=x)$ has to satisfy:

\n

1. $\\sum_{x \\in S} f(x) = 1$

\n

2. $f(x) \\ge 0,\\;\\;\\forall x \\in S$

\n

In this case:

\n

{correct} as

\n

1. {correct1}

\n

2. {correct2}

\n

To verify this we calculate the function as follows:

\n

\\[ \\begin{eqnarray*} P(X = \\var{d1}) &=&\\simplify[std]{({a} * {d1} + {b}) / {c} = {(a * d1 + b)} / {c}}\\\\ P(X = \\var{d2}) &=&\\simplify[std]{({a} * {d2} + {b}) / {c} = {a * d2 + b} / {c}}\\\\ P(X = \\var{d3}) &=&\\simplify[std]{({a} * {d3} + {b}) / {c} = {a * d3 + b} / {c}}\\\\ P(X = \\var{d4}) &=&\\simplify[std]{({a} * {d4} + {b}) / {c} = {a * d4 + b} / {c}} \\end{eqnarray*} \\]
and
\\[\\sum_{x \\in S} f(x) =\\simplify[std]{{c-error}/{c}}\\]

\n

as you can easily check.

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "

Does the following define a valid probability mass function?

\n

\\[P(X=x) = \\simplify{({a}x+{b})/{c}},\\;\\;\\;x \\in S=\\{\\var{d1},\\;\\var{d2},\\;\\var{d3},\\;\\var{d4}\\}\\]

\n

[[0]]

", "marks": 0, "gaps": [{"displayColumns": 2, "matrix": [1, 0], "shuffleChoices": true, "maxMarks": 0, "distractors": ["", ""], "choices": ["

{correct}

", "

{flse}

"], "displayType": "radiogroup", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "minMarks": 0}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

Tick all boxes which describe this function:

\n

[[0]]

\n

Note that if you choose an incorrect option then you will lose 2 marks.

\n

The minimum number of marks you can obtain is 0.

", "marks": 0, "gaps": [{"maxAnswers": 2, "displayColumns": 1, "matrix": [1, 1, -2, -2], "shuffleChoices": true, "maxMarks": 0, "minAnswers": 0, "choices": ["

{correct1}

", "

{correct2}

", "

{flse1}

", "

{flse2}

"], "displayType": "checkbox", "showCorrectAnswer": true, "scripts": {}, "distractors": ["", "", "", ""], "marks": 0, "type": "m_n_2", "minMarks": 0}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n \n \n

Determine whether the following defines a valid probability mass function.

\n \n \n \n

Also choose the options which describe the function.

\n \n \n \n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "negerror": {"definition": "round(-b/a)-random(1,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "negerror", "description": ""}, "c": {"definition": "a*(d1+d2+d3+d4)+4*b + error", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "random(-3..3 except 0)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "correct1": {"definition": "if(t=0,'Probabilities sum to $1$', 'Probabilities do not sum to $1$')", "templateType": "anything", "group": "Ungrouped variables", "name": "correct1", "description": ""}, "flse2": {"definition": "if(u=0, 'There is a negative probability', 'All probabilities are non-negative')", "templateType": "anything", "group": "Ungrouped variables", "name": "flse2", "description": ""}, "flse1": {"definition": "if(t=0,'Probabilities do not sum to $1$', 'Probabilities sum to $1$')", "templateType": "anything", "group": "Ungrouped variables", "name": "flse1", "description": ""}, "correct": {"definition": "if(t=0 ,if(u=0, 'Yes, it is a probability mass function', 'No, it is not a probability mass function'), 'No, it is not a probability mass function')", "templateType": "anything", "group": "Ungrouped variables", "name": "correct", "description": ""}, "flse": {"definition": " if(t=0 ,if(u=0,'No, it is not a probability mass function','Yes, it is a probability mass function'), 'Yes, it is a probability mass function')", "templateType": "anything", "group": "Ungrouped variables", "name": "flse", "description": ""}, "u": {"definition": "random(0,1)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(0,1)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "error": {"definition": "t*random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "error", "description": ""}, "correct2": {"definition": "if(u=0, 'All probabilities are non-negative', 'There is a negative probability')", "templateType": "anything", "group": "Ungrouped variables", "name": "correct2", "description": ""}, "d4": {"definition": "d3+random(3..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "d4", "description": ""}, "d2": {"definition": "d1+random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "d2", "description": ""}, "d3": {"definition": "d2+random(2..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "d3", "description": ""}, "d1": {"definition": "u*negerror+(1-u)*random(3..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "d1", "description": ""}}, "metadata": {"notes": "\n \t\t

7/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked answers.

\n \t\t

22/07/2012:

\n \t\t

Added description.

\n \t\t

Ticked stats extension box.

\n \t\t

Issue with the multiple response question.The feedback on choosing only one correct answer out of the two says that both marks are awarded. This needs to be modified to the correct number of marks awarded and also in practice mode should give the information that there are other correct responses. 

\n \t\t

Another linked issue is that there should be an option for forcing a number of choices for multiple response.

\n \t\t

31/07/2012:

\n \t\t

Added tags.

\n \t\t

20/12/2012:

\n \t\t

The above issue on multiple response has been resolved. Changed the MR so that lose 2 marks if choose an incorrect response (min mark 0).

\n \t\t

Corrected error in setting up negative values for function, but still claiming that it was a PMF.

\n \t\t

Checked calculation, OK. Added tested1 tag.

\n \t\t", "description": "\n \t\t \t\t

Determine if the following describes a probability mass function.

\n \t\t \t\t

$P(X=x) = \\frac{ax+b}{c},\\;\\;x \\in S=\\{n_1,\\;n_2,\\;n_3,\\;n_4\\}\\subset \\mathbb{R}$.

\n \t\t \n \t\t", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "IP3.3", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {"scale": {"definition": "map(b*x+c,x,a)", "type": "list", "language": "jme", "parameters": [["a", "list"], ["b", "number"], ["c", "number"]]}}, "ungrouped_variables": ["a", "b", "d", "p", "pmf", "q", "twice", "x8", "expx", "t", "m2", "x2", "x3", "x0", "x1", "x6", "x7", "x4", "x5"], "tags": ["PMF", "Probability", "choose without replacement", "expectation", "expected value", "mass function", "pmf", "probabilities", "probability", "probability mass function", "random choice", "statistics", "tested1", "udf", "without replacement"], "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

First we find the sums that can occur by simply adding two different numbers together from the given.

\n

Note that these are pairs of different numbers as we choose without replacement.

\n

We get:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$X=x$$\\var{pmf[0]}$$\\var{pmf[1]}$$\\var{pmf[2]}$$\\var{pmf[3]}$$\\var{pmf[4]}$$\\var{pmf[5]}$$\\var{pmf[6]}$$\\var{pmf[7]}$$\\var{pmf[8]}$
\n

We have to find the probabilities that each of these sums occur.

\n

There are $10$ ways of selecting $2$ numbers from the $5$ given, but it may be the case that two different pairs produce the same sum.

\n

In this case we find that there are two ways of producing the sum $\\var{twice}$. All other sums have only one way.

\n

So since each selection of a pair of numbers has probability $0.1$.

\n

The probability of producing the sum $\\var{twice}$ is $0.2$ , and the other sums have probability $0.1$ .

\n

b)

\n

The expectation is given by:

\n

\\[ \\begin{eqnarray*} E[X]&=& \\sum xP(X=x)\\\\ &=&\\simplify[]{ {pmf[0]}*{x0}+{pmf[1]}*{x1}+{pmf[2]}*{x2}+{pmf[3]}*{x3}+{pmf[4]}*{x4}+{pmf[5]}*{x5}+{pmf[6]}*{x6}+{pmf[7]}*{x7}+{pmf[8]}*{x8}}\\\\ &=&\\var{expx} \\end{eqnarray*} \\]

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\n \n \n

Input the possible values of $X$ in the following table.

\n \n \n \n

You have to input these in increasing order.

\n \n \n \n

Also find the probability mass function $P(X=x)$ values and input them into the table.

\n \n \n \n

Input all values as exact values.

\n \n \n \n \n \n \n \n \n \n
$X=x$[[0]][[1]][[2]][[3]][[4]][[5]][[6]][[7]][[8]]
$P(X=x)$[[9]][[10]][[11]][[12]][[13]][[14]][[15]][[16]][[17]]
\n \n \n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[0]}", "minValue": "{pmf[0]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[1]}", "minValue": "{pmf[1]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[2]}", "minValue": "{pmf[2]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[3]}", "minValue": "{pmf[3]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[4]}", "minValue": "{pmf[4]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[5]}", "minValue": "{pmf[5]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[6]}", "minValue": "{pmf[6]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[7]}", "minValue": "{pmf[7]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[8]}", "minValue": "{pmf[8]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x0}", "minValue": "{x0}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x1}", "minValue": "{x1}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x2}", "minValue": "{x2}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x3}", "minValue": "{x3}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x4}", "minValue": "{x4}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x5}", "minValue": "{x5}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x6}", "minValue": "{x6}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x7}", "minValue": "{x7}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x8}", "minValue": "{x8}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n

Find the expectation, $E[X]$ of $X$.

\n

Input as an exact decimal.

\n

$E[X]=\\;\\;$[[0]]

\n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1.2, "maxValue": "{expx}", "minValue": "{expx}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n

Two of the integers $\\var{d[0]},\\;\\var{d[1]}, \\;\\var{d[2]}, \\;\\var{d[3]}, \\;\\var{d[4]} $ are chosen at random, without replacement.

\n

Let $X$ denote the sum of the chosen two values.

\n

Answer the following two parts:

\n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "[[0,1,2,3,7],[0,1,2,4,6],[0,1,3,5,7]]", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "[[1,2,3,4,5,7,8,9,10],[1,2,3,4,5,6,7,8,10],[1,3,4,5,6,7,8,10,12]]", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "d": {"definition": "scale(a[t],p,q)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "twice": {"definition": "switch(t=0,pmf[2],t=1,pmf[5],pmf[6])", "templateType": "anything", "group": "Ungrouped variables", "name": "twice", "description": ""}, "x8": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x8", "description": ""}, "q": {"definition": "random(-9..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "q", "description": ""}, "p": {"definition": "random(1,2,3,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "pmf": {"definition": "scale(b[t],p,2*q)", "templateType": "anything", "group": "Ungrouped variables", "name": "pmf", "description": ""}, "expx": {"definition": "x0*pmf[0]+x1*pmf[1]+x2*pmf[2]+x3*pmf[3]+x4*pmf[4]+x5*pmf[5]+x6*pmf[6]+x7*pmf[7]+x8*pmf[8]", "templateType": "anything", "group": "Ungrouped variables", "name": "expx", "description": ""}, "t": {"definition": "random(0..2)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "m2": {"definition": "if(t=0,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "m2", "description": ""}, "x2": {"definition": "if(t=0,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x2", "description": ""}, "x3": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x3", "description": ""}, "x0": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x0", "description": ""}, "x1": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x1", "description": ""}, "x6": {"definition": "if(t=2,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x6", "description": ""}, "x7": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x7", "description": ""}, "x4": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x4", "description": ""}, "x5": {"definition": "if(t=1,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x5", "description": ""}}, "metadata": {"notes": "\n \t\t

7/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculations.

\n \t\t

22/07/2012:

\n \t\t

Added description.

\n \t\t

Improved display, in particular replaced $E(X)$ by $E[X]$.

\n \t\t

Corrected typo in Advice (\"if\" instead of \"of\").

\n \t\t

Ticked stats extension box.

\n \t\t

31/07/2012:

\n \t\t

Added tags.

\n \t\t

Question appears to be working correctly.

\n \t\t

20/12/2012:

\n \t\t

Improved display of integers in statement.

\n \t\t

Added tag udf for user-defined functions.

\n \t\t

One such:

\n \t\t

scale(a,b,c)=map(b*x+c,x,a), scaling the list a.

\n \t\t

Calculation OK. Added tested1 tag.

\n \t\t", "description": "

Two numbers from a set of $5$ numbers are chosen at random, without replacement. Find the distribution $X$ of their sum and $E[X]$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}