// Numbas version: finer_feedback_settings {"metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Questions used in a university course titled \"Foundations of probability\""}, "type": "question", "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "pickQuestions": 0, "questions": [{"name": "Calculate expectation and a probability from a frequency table, , , ", "extensions": ["stats"], "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/"}], "variable_groups": [{"variables": ["idef", "thing", "episodes", "period", "activity"], "name": "Strings"}, {"variables": ["p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "probabilities", "values"], "name": "Probabilities"}, {"variables": ["r", "s", "t", "t1", "t2", "u1", "u2", "u3", "d"], "name": "Stuff to generate probabilities"}], "variables": {"p4": {"templateType": "anything", "group": "Probabilities", "definition": "t-p8-p7-p6-p5", "description": "", "name": "p4"}, "expected_number": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x*y,[x,y],zip(probabilities,values)))", "description": "", "name": "expected_number"}, "u2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u2"}, "p1": {"templateType": "anything", "group": "Probabilities", "definition": "p0+t1", "description": "", "name": "p1"}, "p3": {"templateType": "anything", "group": "Probabilities", "definition": "r-p0-p1-p2", "description": "", "name": "p3"}, "t": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "100-r", "description": "", "name": "t"}, "probexceed": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(if(j>expected_number,probabilities[j],0),j,0..8))", "description": "", "name": "probexceed"}, "values": {"templateType": "anything", "group": "Probabilities", "definition": "list(0..8)", "description": "", "name": "values"}, "thing": {"templateType": "string", "group": "Strings", "definition": "\"airline\"", "description": "", "name": "thing"}, "u3": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u3"}, "u1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(d*random(70..100)/100)", "description": "", "name": "u1"}, "expect_int": {"templateType": "anything", "group": "Ungrouped variables", "definition": "floor(expected_number)", "description": "", "name": "expect_int"}, "activity": {"templateType": "string", "group": "Strings", "definition": "\"luggage handling\"", "description": "", "name": "activity"}, "probabilities": {"templateType": "anything", "group": "Probabilities", "definition": "map(x/100,x,[p0,p1,p2,p3,p4,p5,p6,p7,p8])", "description": "
Probability of there being $i$ episodes
", "name": "probabilities"}, "d": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(t/15)", "description": "", "name": "d"}, "episodes": {"templateType": "string", "group": "Strings", "definition": "\"complaints\"", "description": "", "name": "episodes"}, "t2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "t1", "description": "", "name": "t2"}, "p8": {"templateType": "anything", "group": "Probabilities", "definition": "d", "description": "", "name": "p8"}, "p7": {"templateType": "anything", "group": "Probabilities", "definition": "p8+u1", "description": "", "name": "p7"}, "p5": {"templateType": "anything", "group": "Probabilities", "definition": "p6+u3", "description": "", "name": "p5"}, "idef": {"templateType": "string", "group": "Strings", "definition": "\"an\"", "description": "", "name": "idef"}, "p2": {"templateType": "anything", "group": "Probabilities", "definition": "p1+t2", "description": "", "name": "p2"}, "t1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(s*random(70..100)/100)", "description": "", "name": "t1"}, "r": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "random(45..65)", "description": "", "name": "r"}, "s": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(r/10)", "description": "", "name": "s"}, "p0": {"templateType": "anything", "group": "Probabilities", "definition": "s", "description": "", "name": "p0"}, "p6": {"templateType": "anything", "group": "Probabilities", "definition": "p7+u2", "description": "", "name": "p6"}, "period": {"templateType": "string", "group": "Strings", "definition": "\"day\"", "description": "", "name": "period"}}, "ungrouped_variables": ["expected_number", "expect_int", "probexceed"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "expected_number", "maxValue": "expected_number", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "Find the expected number of {episodes} per {period}.
\nExpected number = [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "probexceed", "maxValue": "probexceed", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "What is the probability that the number of {episodes} will exceed the expected number?
\nProbability = [[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "The probabilities that {idef} {thing} will receive {episodes} per {period} about its {activity} are given by the following table:
\nComplaints | {values[0]} | {values[1]} | {values[2]} | {values[3]} | {values[4]} | {values[5]} | {values[6]} | {values[7]} | {values[8]} |
---|---|---|---|---|---|---|---|---|---|
Probability | \n{probabilities[0]} | \n{probabilities[1]} | \n{probabilities[2]} | \n{probabilities[3]} | \n{probabilities[4]} | \n{probabilities[5]} | \n{probabilities[6]} | \n{probabilities[7]} | \n{probabilities[8]} | \n
Answer the following two parts, giving your answers to $2$ decimal places.
", "tags": ["checked2015", "discrete distribution", "expectation", "expected value", "MAS1604", "MAS2304", "MAS8380", "MAS8401", "mass function", "pmf", "PMF", "Probability", "probability", "probability mass function", "query", "sc", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nTicked stats extension box.
\n31/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nCould increase the number of scenarios by using random string variables. Query tag added for that.
\nAlso very cumbersome use of variables. But no change proposed for now.
\nChecked calculation, OK. Added tested1 tag.
\n21/12/2012:
\nAlthough asks for solution to 2 dps, there is no rounding as the raw values are to 2 dps. Added sc tag for possible scenarios.
", "licence": "Creative Commons Attribution 4.0 International", "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)$.
"}, "variablesTest": {"condition": "", "maxRuns": "100"}, "advice": "The expected number of {episodes} is given by:
\n\\[ \\simplify[]{{probabilities[0]}*{values[0]} + {probabilities[1]}*{values[1]} + {probabilities[2]}*{values[2]} + {probabilities[3]}*{values[3]} + {probabilities[4]}*{values[4]} + {probabilities[5]}*{values[5]} + {probabilities[6]}*{values[6]} + {probabilities[7]}*{values[7]} + {probabilities[8]}*{values[8]}} = \\var{expected_number} \\]
\nWe want the probability that the number of {episodes} exceeds $\\var{expected_number}$.
\nSince the number of {episodes} is a whole number, this is the same as the probability that the number is $\\var{expect_int+1}$ or more and is
\n\\[\\sum_{i=\\var{expect_int+1}}^{i=8} \\left( \\text{Probability}(\\var{episodes} = i ) \\right)= \\simplify[zeroTerm]{ {if(expect_int<1,probabilities[1],0)} + {if(expect_int<2,probabilities[2],0)} + {if(expect_int<3,probabilities[3],0)} + {if(expect_int<4,probabilities[4],0)} + {if(expect_int<5,probabilities[5],0)} + {if(expect_int<6,probabilities[6],0)} + {if(expect_int<7,probabilities[7],0)} + {if(expect_int<8,probabilities[8],0)}} = \\var{probexceed}\\]
"}, {"name": "Calculate probabilities using the exponential distribution, ", "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/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.5..0.8#0.01)", "description": "", "name": "r"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..10#0.2)", "description": "", "name": "thismany"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5#0.1)", "description": "", "name": "m"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(e^(-thismany/m1),3)", "description": "", "name": "p1"}, "place": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\n 'London',\n 'Manhattan',\n 'Mexico City',\n 'Beijing',\n 'Los Angeles',\n 'Buenos Aires',\n 'Bangkok'\n )", "description": "", "name": "place"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(e^(-thismany/m),3)", "description": "", "name": "p"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r*m,1)", "description": "", "name": "m1"}, "stuff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\n 'carbon monoxide',\n 'Freon-22',\n 'hydrogen sulphide',\n 'mercury',\n 'polynuclear aromatic hydrocarbon',\n 'crystalline silica')", "description": "", "name": "stuff"}}, "ungrouped_variables": ["p1", "thismany", "m", "p", "stuff", "m1", "tol", "place", "r"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"correctAnswerFraction": false, "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "prompt": "Find the probability that the {stuff} concentration exceeds $\\var{thismany}$ parts per million in a one hour period.
\nInput your answer to 3 decimal places.
", "minValue": "p-tol", "maxValue": "p+tol", "marks": 1, "showPrecisionHint": false}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "prompt": "A control strategy reduced the mean to $\\var{m1}$ parts per million.
\nNow find the probability that a concentration exceeds $\\var{thismany}$ parts per million in a one hour period.
\nInput your answer to 3 decimal places.
", "minValue": "p1-tol", "maxValue": "p1+tol", "marks": 1, "showPrecisionHint": false}], "statement": "One hour {stuff} concentrations in samples of air taken at a location in {place} have an approximate exponential distribution with mean $\\var{m}$ parts per million.
", "tags": ["checked2015", "continuous distributions", "distributions", "exponential distribution", "MAS1604", "MAS2304", "Probability", "statistical distributions", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "29/01/2013:
\n
First draft completed.
Calculating simple probabilities using the exponential distribution.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The random variable $X$ is {stuff} concentration {ppm} and $ \\displaystyle X \\sim \\operatorname{Exp}\\left(\\frac{1}{\\var{m}}\\right )$.
\nHence the probability that $X \\lt x$ is $P(X \\lt x)=1-e^{-x/\\var{m}}$.
\na)
\n$P(X \\gt \\var{thismany})=1-P(X \\lt \\var{thismany})=1-(1-e^{-\\var{thismany}/\\var{m}})=\\var{p}$ to 3 decimal places.
\n\n
b) Changing the mean value gives:
\n$P(X \\gt \\var{thismany})=1-P(X \\lt \\var{thismany})=1-(1-e^{-\\var{thismany}/\\var{m1}})=\\var{p1}$ to 3 decimal places.
\n"}, {"name": "Construct PDF and find CDF, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"valk": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(2/(p*(xu+xl-2*a)),4)", "description": "", "name": "valk"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(xu-xl)", "description": "", "name": "p"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "a"}, "xu": {"templateType": "anything", "group": "Ungrouped variables", "definition": "xl+random(1..5)", "description": "", "name": "xu"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((3*xl+xu-4*a)/(4*(xu+xl)-2*a),2)", "description": "", "name": "pval"}, "xl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "xl"}}, "ungrouped_variables": ["a", "valk", "xl", "p", "pval", "xu"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{2}/{p*(xu+xl)}", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "
input as a fraction and not a decimal.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "std", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "\n \n \n$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\end{array} \\right .$ | \n \n$kx$ | \n \n$\\var{xl} \\leq x \\leq \\var{xu},$ | \n \n
\n \n | \n \n | |
$0,$ | \n \n$\\textrm{otherwise.}$ | \n \n
What value of $k$ makes $f_X(x)$ into the pdf of a distribution?
\n \n \n \nInput your answer here as a fraction and not as a decimal.
\n \n \n \n$k=\\;\\;$[[0]]
\n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "0", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 0.5, "vsetrangepoints": 5}, {"answer": "(((x + ( - {xl})) * (x + {(xl + ( - (2 * a)))})) / {((xu + ( - xl)) * (xu + xl + ( - (2 * a))))})", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "input numbers as fractions or integers and not as decimals
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "std", "marks": 2, "vsetrangepoints": 5}, {"answer": "1", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 0.5, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "Given the value of $k$ found in the first part, determine and input the distribution function $F_X(x)$
\n$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\end{array} \\right .$ | \n[[0]] | \n$x \\lt \\var{xl},$ | \n
\n | \n | |
[[1]] | \n$\\var{xl} \\leq x \\leq \\var{xu},$ | \n|
\n | \n | |
[[2]] | \n$x \\gt \\var{xu}.$ | \n
input as a fraction or integer and not as a decimal
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "std", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "\n \n \nFind and input as a fraction not a decimal:
\n \n \n \n$P\\left(X \\lt \\simplify[std]{{xl+xu}/2}\\right) = \\phantom{{}}$[[0]]
\n \n ", "showCorrectAnswer": true, "marks": 0}], "statement": "A random variable $X$ has a probability density function (PDF) given by:
", "tags": ["CDF", "cdf", "checked2015", "continuous random variables", "cumulative distribution functions", "density function", "distribution function", "distribution functions", "integration", "MAS1604", "MAS2304", "PDF", "pdf", "Probability", "probability density function", "random variables", "statistics"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "8/07/2012:
\nAdded tags.
\nChecked calculations, OK.
\n23/07/2012:
\nAdded description.
\n1/08/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
", "licence": "Creative Commons Attribution 4.0 International", "description": "The random variable $X$ has a PDF which involves a parameter $k$. Find the value of $k$. Find the distribution function $F_X(x)$ and $P(X \\lt a)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\n \n \na)
Note that in order for $f_X(x)$ to be a pdf it must satisfy two important conditions:
1. $f_X(x) \\ge 0$ in the range $\\var{xl} \\le x \\le \\var{xu}$
\n \n \n \n2. The area under the curve given by $f_X(x)$ is $1$ and this implies that:
\\[\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx = 1\\] as the value of the function is $0$ outside this range.
We first check condition 2. and then check that condition 1. is satisfied.
\n \n \n \nNote that \\[\\int kx\\;dx = k\\frac{x^2}{2}\\] on forgetting the constant of integration.
\n \n \n \nHence \\[\\begin{eqnarray*}\n \n \\int_{\\var{xl}}^{\\var{xu}}kx\\;dx &=&\\frac{k}{2}(\\var{xu}^2-\\var{xl}^2)\\\\\n \n &=&\\frac{k}{2}\\times \\var{xu^2-xl^2}\n \n \\end{eqnarray*}\n \n \\]
\n \n \n \nBut we must have this last value equal to $1$ hence:
\\[ \\frac{k}{2}\\times \\var{xu^2-xl^2}=1 \\Rightarrow k = \\simplify[std]{2/{xu^2-xl^2}}\\]
Hence the pdf is:
\\[f_X(x) = \\simplify[std]{2/{xu^2-xl^2}x}\\;\\;\\;\\;\\;\\var{xl} \\le x \\le \\var{xu}\\]
We have to check condition 1. that the function $f_X(x)$ is positive for $\\var{xl} \\le x \\le \\var{xu} $ – but this is clear from
the definition of $f_X(x)$ and the value of $k$.
b)
\n \n \n \nIf $F_X(x)$ is the distribution function of the distribution given by $f_X(x)$ then:
\n \n \n \n$F_X(x) = 0\\;\\;\\;x \\lt \\var{xl},\\;\\;\\;\\;F_X(x)=1\\;\\;\\;x \\ge \\var{xu}$
\n \n \n \nand for $\\var{xl} \\le x \\le \\var{xu}$:
\n \n \n \n\\[\\begin{eqnarray*}\n \n F_X(x)&=&\\int_{-\\infty}^x f_X(x)\\;dx=\\simplify[std]{2/{xu^2-xl^2}}\\int_{\\var{xl}}^x x\\;dx\\\\\n \n &=&\\simplify[std]{2/{xu^2-xl^2}}\\times\\frac{\\left(x^2-\\var{xl}^2\\right)}{2}\\\\\n \n &=&\\frac{x^2-\\var{xl^2}}{\\var{xu^2-xl^2}}\n \n \\end{eqnarray*}\n \n \\]
\n \n \n \nc)
\n \n \n \nWe have
\\[\\begin{eqnarray*}\n \n P\\left(X \\lt \\simplify[std]{{xl+xu}/2}\\right)&=&F_X\\left(\\simplify[std]{{(xl+xu)}/2}\\right)\\\\\n \n &=& \\frac{1}{\\var{xu^2-xl^2}}\\left(\\simplify[std]{({(xl+xu)}/{2})^2-{xl}^2}\\right)\\\\\n \n &=&\\simplify{{3*xl+xu-4*a}/{4*(xu+xl-2*a)}}\n \n \\end{eqnarray*}\n \n \\]
\\[I = \\int_0^{\\var{a}}\\;dx\\;\\int_{\\var{f}}^{\\var{g}}\\simplify[all]{({b}+{c}*x+{d}*y)}\\;dy\\]
\n$I=\\;$[[0]]
\nAnswer must be an integer.
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans2", "minValue": "ans2", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\\[I=\\var{(m+1)(m+n+2)}\\int _0^1\\;dx\\;\\int_x^{\\var{b1}}\\simplify[all]{{n+1}*x^{m}*y^{n}}\\;dy\\]
\n$I=\\;$[[0]]
\nAnswer must be an integer.
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans3", "minValue": "ans3", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\\[I=\\var{con}\\int_{-1}^1\\;dx\\;\\int_0^{\\simplify[all]{{c2}+{d2}*x^{p2}}}\\simplify[all]{{c1}+{d1}*y^{p1}}\\;dy\\]
\n$I=\\;$?[[0]]
\nAnswer must be an integer.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Calculate the following repeated integrals.
", "tags": ["checked2015", "MAS1603", "MAS2304"], "rulesets": {"std": ["all", "!collectnumbers", "!noleadingminus", "fractionNumbers"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "29/01/2013:
\nThe iassess question has a fourth part which I will split off from this question.
\nStill need to do the Advice.
", "licence": "Creative Commons Attribution 4.0 International", "description": "3 Repeated integrals of the form $\\int_a^b\\;dx\\;\\int_c^{f(x)}g(x,y)\\;dy$ where $g(x,y)$ is a polynomial in $x,\\;y$ and $f(x)$ is a degree 0, 1 or 2 polynomial in $x$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\n\\[I = \\int_0^{\\var{a}}\\;dx\\;\\int_{\\var{f}}^{\\var{g}}\\simplify[all]{({b}+{c}*x+{d}*y)}\\;dy\\]
\nCalculating the inner integral we have:
\n\\[\\begin{eqnarray*}\\int_{\\var{f}}^{\\var{g}}\\simplify[all,!noleadingminus,!collectNumbers]{({b}+{c}*x+{d}*y)}\\;dy&=&\\left[\\simplify[all,!noleadingminus,!collectNumbers]{{b}y+{c}*x*y+{d}*y^2/2}\\right]_{\\var{f}}^{\\var{g}}\\\\&=&\\simplify[all,!noleadingminus,!collectNumbers]{{b} * {g} + {c} * {g} * x + {d / 2} * {g ^ 2} + {b} * { -f} + {c} * { -f} * x + {d / 2} * { -(f ^ 2)}}\\\\& =&\\simplify[all,!noleadingminus,!collectNumbers]{ {b * g -(b * f) + (d / 2) * (g ^ 2 -(f ^ 2))} + {c * g -(c * f)} * x}\\end{eqnarray*}\\]
\nThe outer integral gives:
\n\\[\\begin{eqnarray*}I &=& \\simplify[std]{DefInt({b * g -(b * f) + (d / 2) * (g ^ 2 -(f ^ 2))} + {c * g -(c * f)} * x,x,0,{a}) }\\\\&=&\\left[\\simplify[std]{{b * g -(b * f) + (d / 2) * (g ^ 2 -(f ^ 2))} * x + {(c * g -(c * f)) / 2} * x ^ 2}\\right]_0^{\\var{a}}\\\\&=&\\var{ans1}\\end{eqnarray*}\\]
\nb)
\n\\[I=\\var{(m + 1) * (m + n + 2)} \\int_0^1 \\;dx \\int_x^{\\var{b1}}\\simplify[std]{({n + 1} * x ^ {m} * y ^ {n})}dy\\]
\nCalculating the inner integral we have :
\n\\[\\begin{eqnarray*} \\int_x^{\\var{b1}}\\simplify[std]{({n + 1} * x ^ {m} * y ^ {n})}dy&=&\\left[x^{\\var{m}}y^{\\var{n+1}}\\right]_x^{\\var{b1}}\\\\&=&\\simplify{{b1 ^ (n + 1)}* x ^ {m} -(x ^ {m + n + 1})}\\end{eqnarray*}\\]
\nFinally the outer integral gives:
\n\\[\\begin{eqnarray*}I &=&\\var{(m + 1) * (m + n + 2)}\\int_0^1\\simplify[std]{{b1} ^ {n + 1} * x ^ {m} -(x ^ {m + n + 1})}dx\\\\& =&\\simplify[std]{ {(m + 1) * (m + n + 2)} * ({b1 ^ (n + 1)} / {m + 1} -(1 / {m + n + 2})) }\\\\&=&\\var{ans2}\\end{eqnarray*}\\]
\nc)
\n\\[I=\\var{con}\\int_{-1}^1\\;dx\\;\\int_0^{\\simplify[all]{{c2}+{d2}*x^{p2}}}\\simplify[all]{{c1}+{d1}*y^{p1}}\\;dy\\]
\nCalculating the inner integral we have :
\n\\[\\begin{eqnarray*}\\int_0^{\\simplify[all]{{c2}+{d2}*x^{p2}}}\\simplify[all]{{c1}+{d1}*y^{p1}}\\;dy&=&\\left[\\simplify[all]{{c1} * y + {d1 / (p1 + 1)} * y ^ {p1 + 1}}\\right]_0^{\\simplify[all]{{c2}+{d2}*x^{p2}}}\\\\&=&\\simplify[std]{{c1} * ({c2} + {d2} * x ^ {p2}) + {d1 / (p1 + 1)} * ({c2} + {d2} * x ^ {p2}) ^ {p1 + 1}}\\\\& =&\\simplify[std]{ {c1 * c2} + {c1 * d2} * x ^ {p2} + {p1 -1} * {h1} * ({c2 ^ 3} + {3 * c2 ^ 2 * d2} * x ^ {p2} + {3 * c2 * d2 ^ 2} * x ^ {2 * p2} + {d2} ^ 3 * x ^ {3 * p2}) + {2 -p1} * {h1} * ({c2 ^ 2} + {2 * c2 * d2} * x ^ {p2} + {d2 ^ 2} * x ^ {2 * p2})}\\\\&=&\\simplify[std,collectNumbers]{{c1 * c2 + (p1 -1) * h1 * c2 ^ 3 + (2 -p1) * h1 * c2 ^ 2} + {c1 * d2 + (p1 -1) * h1 * 3 * c2 ^ 2 * d2 + (2 -p1) * h1 * 2 * c2 * d2} * x ^ {p2} + {(p1 -1) * h1 * 3 * c2 * d2 ^ 2 + (2 -p1) * h1 * d2 ^ 2} * x ^ {2 * p2} + {(p1 -1) * h1 * d2 ^ 3} * x ^ {3 * p2}}\\end{eqnarray*}\\]
\nFinally the outer integral gives:
\n\\[I = \\simplify[std]{{con} * DefInt({c1 * c2 + (p1 -1) * h1 * c2 ^ 3 + (2 -p1) * h1 * c2 ^ 2} + {c1 * d2 + (p1 -1) * h1 * 3 * c2 ^ 2 * d2 + (2 -p1) * h1 * 2 * c2 * d2} * x ^ {p2} + {(p1 -1) * h1 * 3 * c2 * d2 ^ 2 + (2 -p1) * h1 * d2 ^ 2} * x ^ {2 * p2} + {(p1 -1) * h1 * d2 ^ 3} * x ^ {3 * p2},x, -1,1)} = \\var{ans3}\\]
\n\n
"}, {"name": "Double integral, ", "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/"}], "variable_groups": [], "variables": {"ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(upper-lower,3)", "description": "", "name": "ans"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "description": "", "name": "a"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "m"}, "fun": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=1,'$\\\\sin(x^{\\\\var{m}}+\\\\var{a})$',t=2,'$\\\\cos(x^{\\\\var{m}}+\\\\var{a})$','$\\\\exp(x^{\\\\var{m}}+\\\\var{a})$')", "description": "", "name": "fun"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "name": "t"}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=1,-cos(1+a),t=2,sin(1+a),exp(1+a))", "description": "", "name": "upper"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=1,-cos(a),t=2,sin(a),exp(a))", "description": "", "name": "lower"}}, "ungrouped_variables": ["a", "upper", "lower", "m", "t", "ans", "fun"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans+0.001", "minValue": "ans-0.001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
$\\displaystyle I=\\int_0^1\\;dx\\;\\int_0^{\\simplify[all]{x^{m-1}}}\\var{m}${fun}$dy$
\n$I=\\;$[[0]]
\nInput your answer to 3 decimal places.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Evaluate the following repeated integral:
", "tags": ["checked2015", "MAS1603", "MAS2304"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "01/02/2013:
\nFirst draft completed.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Repeated integral of the form: $\\displaystyle I=\\int_0^1\\;dx\\;\\int_0^{x^{m-1}}mf(x^m+a)dy$
\n"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "
We want to find
\n\n
$\\displaystyle I=\\int_0^1\\;dx\\;\\int_0^{\\simplify[all]{x^{m-1}}}\\var{m}${fun}$dy$
\nThe innermost integral gives:
\n$\\displaystyle \\int_0^{\\simplify[all]{x^{m-1}}}\\var{m}${fun}$dy=\\left[\\var{m}y\\;\\right.${fun}$\\displaystyle \\left. \\right]_0^{\\simplify[all]{x^{m-1}}}=\\simplify[all]{{m}x^{m-1}}${fun}
\nSo we have to find $\\displaystyle I=\\int_0^1\\simplify[all]{{m}x^{m-1}}${fun}$dx$
\nNote that if we use the substitution $u=\\simplify[all]{x^{m}+{a}}$ then it is easy to find this last definite integral and we find that:
\n$I=\\var{ans}$ to 3 decimal places.
\n\n
"}, {"name": "Find mean and standard deviation of differences between samples", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sig1)),5)", "description": "", "name": "r1"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "5", "description": "", "name": "thismany"}, "sig1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1.5..2.5#0.5)", "description": "", "name": "sig1"}, "performing": {"templateType": "anything", "group": "Ungrouped variables", "definition": " 'working at $\\\\var{100}$ watts on an exercise machine' ", "description": "", "name": "performing"}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu2,sig2)),5)", "description": "", "name": "r2"}, "attempt": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'attempt'", "description": "", "name": "attempt"}, "meandiff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(d)", "description": "", "name": "meandiff"}, "objects": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'people'", "description": "", "name": "objects"}, "mu1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(16..20#0.5)", "description": "", "name": "mu1"}, "sig2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sig1+random(-0.5..-0.2#0.1)", "description": "", "name": "sig2"}, "mu2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mu1+random(1..3#0.1)", "description": "", "name": "mu2"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "list(vector(r2)-vector(r1))", "description": "", "name": "d"}, "stdiff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(d,true),3)", "description": "", "name": "stdiff"}, "object": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'person'", "description": "", "name": "object"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Oxygen uptake values (mL/kg.min)'", "description": "", "name": "something"}}, "ungrouped_variables": ["meandiff", "performing", "attempt", "r1", "objects", "mu2", "object", "sig1", "thismany", "stdiff", "sig2", "something", "r2", "mu1", "d"], "functions": {}, "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "
Find the mean and standard deviation of the difference between first and second {attempt}s.
\nCalculate differences for second {attempt} – first {attempt}.
\nMean of difference = [[0]] (input as an exact decimal)
\nStandard deviation of difference = [[1]] (input to 3 decimal places)
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "{meandiff}", "maxValue": "{meandiff}", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "{stdiff}", "maxValue": "{stdiff}", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "mustBeReducedPC": 0}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "{Something} for $\\var{thismany}$ {objects} {performing} were:
\n{capitalise(object)} | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
First {attempt} | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n
Second {attempt} | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n
An experiment is performed twice, each with $5$ outcomes
\n$x_i,\\;y_i,\\;i=1,\\dots 5$ . Find mean and s.d. of their differences $y_i-x_i,\\;i=1,\\dots 5$.
"}, "type": "question", "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The table of differences is given by:
\n{capitalise(object)} | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
First {attempt} | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n
Second {attempt} | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n
Differences | \n$\\var{d[0]}$ | \n$\\var{d[1]}$ | \n$\\var{d[2]}$ | \n$\\var{d[3]}$ | \n$\\var{d[4]}$ | \n
The mean of the differences is $\\var{meandiff}$.
\nThe variance $V$ of the differences is
\n\\begin{align}
V &= \\frac{1}{4}\\left(\\simplify[]{({d[0]}^2+{d[1]}^2+{d[2]}^2+{d[3]}^2+{d[4]}^2)}-5\\times \\var{meandiff}^2\\right) \\\\
&= \\var{variance(d,true)}
\\end{align}
Hence the standard deviation is $\\sqrt{V}=\\var{stdiff}$ to 3 decimal places.
"}, {"name": "Is the given function a probability mass function?, , , ", "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/"}], "variable_groups": [{"variables": ["is_pmf", "has_negative_probability", "probabilities_dont_sum", "explain_decision"], "name": "Descriptions"}], "variables": {"d3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d2+random(2..4)", "description": "", "name": "d3"}, "negerror": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(-b/a)-random(1,2)", "description": "", "name": "negerror"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "b"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a*(d1+d2+d3+d4)+4*b + error", "description": "", "name": "c"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "has_negative_probability*negerror+(1-has_negative_probability)*random(3..5)", "description": "", "name": "d1"}, "explain_decision": {"templateType": "anything", "group": "Descriptions", "definition": "if(has_negative_probability,\n if(probabilities_dont_sum,\n \"the probabilities do not sum to $1$ and there is a negative probability\",\n \"there is a negative probability\"\n ),\n if(probabilities_dont_sum,\n \"the probabilities do not sum to $1$\",\n \"the probabilities sum to $1$ and all probabilities are non-negative\"\n )\n)", "description": "", "name": "explain_decision"}, "d2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d1+random(1..5)", "description": "", "name": "d2"}, "has_negative_probability": {"templateType": "anything", "group": "Descriptions", "definition": "random(0,1)", "description": "", "name": "has_negative_probability"}, "is_pmf": {"templateType": "anything", "group": "Descriptions", "definition": "has_negative_probability=0 and probabilities_dont_sum=0", "description": "", "name": "is_pmf"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "a"}, "probabilities_dont_sum": {"templateType": "anything", "group": "Descriptions", "definition": "random(0,1)", "description": "0 if probabilities sum to 1
", "name": "probabilities_dont_sum"}, "error": {"templateType": "anything", "group": "Ungrouped variables", "definition": "probabilities_dont_sum*random(1..9)", "description": "", "name": "error"}, "d4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d3+random(3..5)", "description": "", "name": "d4"}}, "ungrouped_variables": ["a", "negerror", "c", "b", "error", "d3", "d4", "d2", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["Yes, it is a probability mass function
", "No, it is not a probability mass function
"], "displayColumns": 2, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "if(is_pmf,[1,0],[0,1])", "marks": 0}], "type": "gapfill", "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]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "checkbox", "choices": ["Probabilities sum to $1$
", "Probabilities do not sum to $1$
", "All probabilities are non-negative
", "There is a negative probability
"], "matrix": "if(probabilities_dont_sum=0,[1,-2],[-2,1])+if(has_negative_probability=0,[1,-2],[-2,1])", "distractors": ["", "", "", ""], "type": "m_n_2", "maxAnswers": 2, "shuffleChoices": false, "warningType": "none", "scripts": {}, "minMarks": 0, "minAnswers": 0, "maxMarks": "2", "showCorrectAnswer": true, "displayColumns": 1, "marks": 0}], "type": "gapfill", "prompt": "Tick all boxes which describe this function:
\n[[0]]
\nNote that if you choose an incorrect option then you will lose 2 marks.
\nThe minimum number of marks you can obtain is 0.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Determine whether the following defines a valid probability mass function.
\nAlso choose the options which describe the function.
", "tags": ["checked2015", "discrete distribution", "MAS1604", "MAS2304", "MAS8380", "MAS8401", "mass function", "pmf", "PMF", "Probability", "probability", "probability mass function", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus", "!simplifyFractions"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "25/02/2015: see the editing history for changes from now on.
\n\n
7/07/2012:
\nAdded tags.
\nChecked answers.
\n22/07/2012:
\nAdded description.
\nTicked stats extension box.
\nIssue 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.
\nAnother linked issue is that there should be an option for forcing a number of choices for multiple response.
\n31/07/2012:
\nAdded tags.
\n20/12/2012:
\nThe above issue on multiple response has been resolved. Changed the MR so that lose 2 marks if choose an incorrect response (min mark 0).
\nCorrected error in setting up negative values for function, but still claiming that it was a PMF.
\nChecked calculation, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Determine if the following describes a probability mass function.
\n$P(X=x) = \\frac{ax+b}{c},\\;\\;x \\in S=\\{n_1,\\;n_2,\\;n_3,\\;n_4\\}\\subset \\mathbb{R}$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "A probability mass function $f(x)=P(X=x)$ has to satisfy:
\n1. $f(x) \\ge 0$, $\\forall x \\in S$
\n2. $\\sum_{x \\in S} f(x) = 1$
\nTo verify this we calculate the function as follows:
\n\\begin{align}
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{align}
and
\n\\[ \\sum_{x \\in S} f(x) =\\simplify[std]{ {a*d1+b}/{c} + {a*d2+b}/{c} + {a*d3+b}/{c} + {a*d4+b}/{c}} = \\simplify[fractionNumbers]{{c-error}/{c}} = \\simplify[std,simplifyFractions]{{c-error}/{c}} \\]
\nIn this case, {if(is_pmf,\"this is a probability mass function\",\"this is not a probability mass function\")} as {explain_decision}.
"}, {"name": "Probability of not choosing any from a subset", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"noguilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men-guilty,suspects-guilty)", "description": "", "name": "noguilty"}, "p4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,ns-3)", "description": "", "name": "p4"}, "ns": {"templateType": "anything", "group": "Ungrouped variables", "definition": "men-suspects", "description": "", "name": "ns"}, "is": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(guilty=1,'is','are')", "description": "", "name": "is"}, "overallnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men,suspects)", "description": "", "name": "overallnumber"}, "is2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects-guilty=1,'is','are')", "description": "", "name": "is2"}, "t3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=5,1,0)", "description": "", "name": "t3"}, "nguilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men-suspects,suspects)", "description": "", "name": "nguilty"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(guilty=1,'man','men')", "description": "", "name": "p"}, "q5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<5,1,men-4)", "description": "", "name": "q5"}, "guilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects>2,suspects-random(1,2),suspects-1)", "description": "", "name": "guilty"}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(nguilty/overallnumber,3)", "description": "", "name": "ans3"}, "suspects": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3,4,5)", "description": "", "name": "suspects"}, "q6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<6,1,men-5)", "description": "", "name": "q6"}, "t2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=4,1,0)", "description": "", "name": "t2"}, "t4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=6,1,0)", "description": "", "name": "t4"}, "singpl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects-guilty=1,'man','men')", "description": "", "name": "singpl"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "nguilty/overallnumber", "description": "", "name": "test"}, "t1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,0)", "description": "", "name": "t1"}, "q4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,men-3)", "description": "", "name": "q4"}, "men": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(12..20)", "description": "", "name": "men"}, "p5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<5,1,ns-4)", "description": "", "name": "p5"}, "p6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<6,1,ns-5)", "description": "", "name": "p6"}}, "ungrouped_variables": ["guilty", "is", "ans3", "suspects", "noguilty", "q5", "q4", "q6", "is2", "test", "ns", "men", "singpl", "p6", "p4", "p5", "t4", "nguilty", "t2", "t3", "t1", "p", "overallnumber"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{nguilty}/{overallnumber}", "musthave": {"showStrings": false, "message": "Input your answer as a fraction
", "strings": ["/"], "partialCredit": 0}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "std", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input your answer as a fraction, not a decimal.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 2, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nWhat is the probability that none of the suspects are chosen?
\n \n \n \nProbability = [[0]]?
\n \n \n \nInput your answer as a fraction and not as a decimal.
\n \n ", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "A line-up of $\\var{men}$ men is conducted in order that a witness can identify $\\var{suspects}$ suspects.
\nSuppose that all $\\var{suspects}$ suspects are in the line-up.
\nAlso suppose that the witness does not recognise any of the suspects but simply chooses $\\var{suspects}$ men at random.
", "tags": ["MAS1604", "Probability", "checked2015", "choosing", "combinations", "counting", "cr1", "query", "sample space", "selecting", "selection", "statistics", "tested1", "ways of choosing"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nAdded an alternative solution to this question (Method 2).
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nChecked the stats extension box.
\nPerhaps the answer should be a decimal rather than a fraction - looks clumsy.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nCould have a variant of this question by using 'scenario' string variables. Added sc tag for this. Also query the above point about a decimal solution rather than a fraction.
\nChecked calculation, OK. Added tested1 tag.
\nImproved display of numbers by texifying them.
\n21/12/2012:
\nChecked rounding, OK. Added tag cr1.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given subset $T \\subset S$ of $m$ objects in $n$ find the probability of choosing without replacement $r\\lt n-m$ from $S$ and not choosing any element in $T$.
"}, "advice": "We can work out the probability in two ways:
\nMethod 1.
\nThere are $\\var{men-suspects}$ of the $\\var{men}$ who are not suspects.
\nThe probability of picking the first who is not a suspect is therefore:
\n\\[\\simplify[]{{men-suspects}/{men}}\\]
\nThe second choice of a non-suspect will be from $\\var{men-suspects-1}$ non-suspects in $\\var{men-1}$ with probability:
\n\\[\\simplify[]{{men-suspects-1}/{men-1}}\\]
\nHence the probability of choosing two non-suspects will be .
\n\\[\\simplify[]{{men -suspects} / {men}}\\times \\simplify[]{{men -suspects-1} / {men-1}}\\]
\nContinuing in this way we see that the probability of choosing $\\var{suspects}$ non-suspects is:
\n\\[\\simplify[zeroFactor,unitFactor,zeroTerm]{{t1} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) + {t2} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) + {t3} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) * ({ns -4} / {men -4}) + {t4} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) * ({ns -4} / {men -4}) * ({ns -5} / {men -5})}=\\simplify[std]{{nguilty}/{overallnumber}}\\]
\non reducing the fraction to its lowest form.
\nMethod 2.
\nThere are $\\var{men-suspects}$ of the $\\var{men}$ who are not suspects.
\nHence there are \\[{\\var{men-suspects}\\choose \\var{suspects}}=\\var{comb(men-suspects,suspects)}\\] ways of choosing $\\var{suspects}$ non-suspects.
\nIn total there are \\[{\\var{men}\\choose \\var{suspects}}=\\var{comb(men,suspects)}\\] ways of choosing $\\var{suspects}$ from all present.
\nHence the probability is \\[\\frac{\\var{comb(men-suspects,suspects)}}{\\var{comb(men,suspects)}}= \\simplify[std]{{nguilty}/{overallnumber}} \\]
"}, {"name": "Roll a pair of dice - find probability at least one die shows a given number.", "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/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "tags": ["checked2015", "dice", "Dice", "die", "elementary probability", "events", "independence", "Independence", "independent events", "Probability", "probability", "probability dice", "statistics", "tested1"], "metadata": {"description": "Rolling a pair of dice. Find probability that at least one die shows a given number.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Two fair six-sided dice are rolled.
", "advice": "\n \n \nLet $A$ be the event that first dice shows a $\\var{number}$ $\\Rightarrow P(A)=\\frac{1}{6}$.
\n \n \n \nLet $B$ be the event that second dice shows a $\\var{number}$ $\\Rightarrow P(B)=\\frac{1}{6}$.
\n \n \n \n$A$ and $B$ are independent events so $P(A\\cap B) = P(A)\\times P(B)$.
\n \n \n \nWe want the probability $P(A \\cup B)$ of either $A$ or $B$ showing $\\var{number}$ and
\n \n \n \n\\[\\begin{eqnarray*}\n \n P(A \\cup B) &=& P(A)+P(B)-P(A \\cap B)\\\\\n \n &=& P(A)+P(B)-P(A)P(B)\\\\\n \n &=&\\frac{1}{6}+ \\frac{1}{6}-\\frac{1}{36}\\\\\n \n &=& \\frac{11}{36}\n \n \\end{eqnarray*}\n \n \\]
\n \n \n ", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"number": {"name": "number", "group": "Ungrouped variables", "definition": "random(1..6)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["number"], "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": "What is the probability of at least one die showing a $\\var{number}$?
\nProbability = [[0]]
", "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": "11/36", "maxValue": "11/36", "correctAnswerFraction": true, "allowFractions": true, "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", "type": "question"}, {"name": "Calculate probability, CDF, expected value and variance of binomial distribution, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"w": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..100)", "description": "", "name": "w"}, "x2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,4)", "description": "", "name": "x2"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,3)", "description": "", "name": "ans2"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans1,3)", "description": "", "name": "ans1"}, "v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>3,1,0)", "description": "", "name": "v4"}, "x1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((w+(100-w)*(n-1))/100)", "description": "", "name": "x1"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..20)", "description": "", "name": "n"}, "tans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialPDF(x1,n,p)", "description": "", "name": "tans1"}, "tans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialCDF(x2,n,p)", "description": "", "name": "tans2"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.1)", "description": "", "name": "p"}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>2,1,0)", "description": "", "name": "v3"}}, "ungrouped_variables": ["w", "ans1", "ans2", "n", "p", "v3", "v4", "tol", "x2", "x1", "tans1", "tans2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans1", "maxValue": "ans1", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Compute $\\operatorname{P}(X=\\var{x1}) = $ [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans2", "maxValue": "ans2", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Compute $F_X(\\var{x2}) = \\operatorname{P}(X\\le\\var{x2})=$ [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{n*p}", "minValue": "{n*p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{n*p*(1-p)}", "minValue": "{n*p*(1-p)}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Find:
\nEnter your answers to the following questions to $3$ decimal places.
\nSuppose $X \\sim \\operatorname{Binomial}(\\var{n},\\var{p})$
", "tags": ["binomial distribution", "Binomial distribution", "Binomial Distribution", "CDF", "cdf", "CDF of binomial distribution", "checked2015", "cr1", "cumulative density function", "Discrete random variables.", "distributions", "Expectation of binomial distribution", "MAS1604", "MAS2304", "probability", "Probability", "random variables", "statistics", "tested1", "variance of binomial distribution"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": "Numbas.jme.display.texOps['prob'] = function(thing,texArgs) {\n return '\\\\operatorname{P}\\\\left( '+texArgs.join(', ')+' \\\\right)';\n}"}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nCannot access stats extension at present, so question does not run. Issue posted.
\nSet new tolerance variable tol=0.001 for first two answers.
\nCalculation to be tested under Test Run.
\n22/07/2012:
\nNow runs after stats extension box ticked.
\nAdded description.
\nChecked calculation.
\n31/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nRounding seems to be OK. Added cr1 tag. Replaced sum of pdf values by built in binomialcdf function from jstats.
\nChecked calculation, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$X \\sim \\operatorname{Binomial}(n,p)$. Find $P(X=a)$, $P(X \\leq b)$, $E[X],\\;\\operatorname{Var}(X)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\\[ \\simplify[std,!otherNumbers]{prob(X = {x1}) = {n}! / ({n -x1}! * {x1}!) * {p} ^ {x1} * (1 -{p}) ^ {n -x1}} = \\var{ans1}\\]
\nto 3 decimal places.
\nWe have:
\n\\begin{align}
F_X (\\var{x2}) &= \\operatorname{P}(X \\le \\var{x2}) = \\simplify[std]{ prob(X = 0) + prob(X = 1) + prob(X = 2) + {v3} * prob(X = 3) + {v4} * prob(X = 4)} \\\\
&= \\simplify[unitFactor,zeroTerm,zeroFactor]{(1 -{p}) ^ {n} + {n} * (1 -{p}) ^ {n -1} * {p} + {(n * (n -1)) / 2} * (1 -{p}) ^ {n -2} * {p} ^ 2 + {v3} * {comb(n , 3)} * (1 -{p}) ^ {n -3} * {p} ^ 3 + {v4} * {comb(n , 4)} * (1 -{p}) ^ {n -4} * {p} ^ 4} \\\\
&= \\var{ans2}
\\end{align}
to 3 decimal places.
\nFor the binomial distribution $\\operatorname{Binomial}(n,p)$ we have:
\n\\begin{align}
\\operatorname{E}[X] &= np \\\\
\\operatorname{Var}(X) &= np(1-p)
\\end{align}
Hence in this case:
\n\\begin{align}
\\operatorname{E}[X] &= \\var{n} \\times \\var{p} = \\var{n*p} \\\\
\\operatorname{Var}(X) &= \\var{n} \\times \\var{p} \\times \\var{(1-p)} = \\var{n*p*(1-p)}
\\end{align}
Compute $\\operatorname{P}(W=\\var{y1}) = $ [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans1", "maxValue": "ans1", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Compute $\\operatorname{P}(\\var{y2} \\le W \\le \\var{y3}) =$ [[0]] (enter your answer to 3 decimal places)
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "1/p", "maxValue": "1/p", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}, {"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "(1-p)/p^2", "maxValue": "(1-p)/p^2", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Find:
\n1. $\\operatorname{E}[W] = $ [[0]]
\n2. $\\operatorname{Var}(W)=$ [[1]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "Enter your answers to the following questions to 3 decimal places.
\nSuppose $W\\sim \\operatorname{Geometric}(\\var{p})$
", "tags": ["checked2015", "discrete random variables", "distributions", "expectation of geometric distribution", "geometric distribution", "Geometric Distribution", "MAS1604", "MAS2304", "probability", "Probability", "random variables", "sr", "statistics", "tested1", "udf", "variance of geometric distribution"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nCannot access stats extension at present, so question does not run. Issue posted.
\nSet new tolerance variable tol=0.001 for first two answers.
\nCalculation to be tested under Test Run.
\n22/07/2012:
\nAdded description.
\nCan check calculation now stats extension box ticked.
\nCalculations checked.
\n31/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculations against standard tables, OK.
\nAdded tested1 tag.
\nUser defined function arz picks out values in an array a lying between given values m and n.
\narz(m,n,a)=map(if(x<m or x >n,0,1),x,a). Added udf tag.
\nExtra rounding introduced for variables tans1, tans. Added tag sr.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$W \\sim \\operatorname{Geometric}(p)$. Find $P(W=a)$, $P(b \\le W \\le c)$, $E[W]$, $\\operatorname{Var}(W)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "If $W \\sim \\operatorname{Geometric}(p)$ then
\n\\[\\operatorname{P}(W=w)=p \\times (1-p)^{w-1}\\]
\nHence:
\n\\[ \\operatorname{P}(W= \\var{y1}) = \\simplify[!otherNumbers,zeroPower,unitFactor]{{p}*(1-{p})^{y1-1}} = \\var{tans} \\approx \\var{ans}\\]
\nto 3 decimal places.
\nWe have:
\n\\begin{align}
\\operatorname{P}(\\var{y2} \\le W \\le \\var{y3}) &= \\sum_{w=\\var{y2}}^{w=\\var{y3}}\\var{p}\\times(1-\\var{p})^{w-1} \\\\
&= \\simplify[unitFactor,zeroTerm,zeroFactor]{{v[0]}*{p}+{v[1]}*{p}*{1-p} +{v[2]}*{p}*{1-p}^2 +{v[3]}*{p}*{1-p}^3 +{v[4]}*{p}*{1-p}^4 +{v[5]}*{p}*{1-p}^5+{v[6]}*{p}*{1-p}^6} \\\\
&= \\var{tans1} \\\\
&\\approx \\var{ans1}
\\end{align}
to 3 decimal places.
\nFor the Geometric distribution $\\operatorname{Geometric}(p)$ we have:
\n\\begin{align}
\\operatorname{E}[W] &= \\frac{1}{p} \\\\ \\\\
\\operatorname{Var}(W) &= \\frac{1-p}{p^2}
\\end{align}
Hence in this case:
\n\\begin{align}
\\operatorname{E}[W] &= \\simplify{1/{p}} = \\var{precround(1/p,3)} \\\\[0.5em]
\\operatorname{Var}(W) &= \\simplify[all,!collectNumbers,!otherNumbers]{(1-{p})/({p}^2)} = \\var{precround((1-p)/p^2,3)}
\\end{align}
to 3 decimal places.
"}, {"name": "Calculate probability, expected value and variance of a Poisson distribution, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(y2>3,1,0)", "description": "", "name": "v4"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,3)", "description": "", "name": "ans2"}, "tans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "poissonPDF(y1,p)", "description": "", "name": "tans"}, "y2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,4)", "description": "", "name": "y2"}, "tans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-poissonPDF(0,p)-poissonPDF(1,p)-poissonPDF(2,p)-v3*poissonPDF(3,p)-v4*poissonPDF(4,p)", "description": "", "name": "tans2"}, "la": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..24)", "description": "", "name": "la"}, "y1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(la>15,random(2..6),random(0..5))", "description": "", "name": "y1"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "la/4", "description": "", "name": "p"}, "ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans,3)", "description": "", "name": "ans"}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(y2>2,1,0)", "description": "", "name": "v3"}}, "ungrouped_variables": ["ans", "ans2", "la", "p", "tans", "tans2", "tol", "v3", "v4", "y1", "y2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans", "maxValue": "ans", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Compute $\\operatorname{P}(Y=\\var{y1})= $ [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "{ans2-tol}", "maxValue": "{ans2+tol}", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "Compute $\\operatorname{P}(Y \\gt \\var{y2}) = $ [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{p}", "minValue": "{p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{p}", "minValue": "{p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Find:
\nEnter your answers to the following questions to $3$ decimal places.
\nSuppose $Y \\sim \\operatorname{Poisson}(\\var{p})$.
", "tags": ["checked2015", "cr1", "discrete random variable", "distributions", "expectation of poisson distribution", "MAS1604", "MAS2304", "poisson distribution", "Poisson distribution", "Probability", "probability", "random variables", "statistics", "tested1", "variance of poisson distribution"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": "Numbas.jme.display.texOps['prob'] = function(thing,texArgs) {\n return '\\\\operatorname{P}\\\\left( '+texArgs.join(', ')+' \\\\right)';\n}"}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nCannot access the poisson functions in the stats extension and will not run. Issue posted.
\nSet new tolerance variable tol=0.001 for first two questions.
\nCannot check calculations at present under Test Run.
\n22/07/2012:
\nAdded description.
\nCorrected typo in formula for Poisson Distribution.
\nCan now test as stats extension ticked.
\nChecked calculation.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculations agains standard tables, OK. Rounding, OK. Added cr1 tag. Do not use the jstats poissoncdf function! The poissonpdf is OK.
\nAdded tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$Y \\sim \\operatorname{Poisson}(p)$. Find $P(Y=a)$, $P(Y \\gt b)$, $E[Y],\\;\\operatorname{Var}(Y)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "If $Y \\sim \\operatorname{Poisson}(\\lambda)$ then
\n\\[P(Y=y)=\\frac{\\lambda^y\\;e^{-\\lambda}}{y!}\\]
\nHence
\n\\[ \\operatorname{P}(Y=\\var{y1}) = \\simplify[std,!otherNumbers]{({p}^{y1}*e^{-p}) / {y1}!} = \\var{tans} \\approx \\var{ans} \\]
\nto 3 decimal places.
\n\\begin{align}
\\operatorname{P} (Y \\gt \\var{y2}) &= 1-P(Y \\le \\var{y2}) = \\simplify[std]{ 1-prob(Y = 0) - prob(Y = 1) - prob(Y = 2) - {v3} * prob(Y = 3) - {v4} * prob(Y = 4)} \\\\
&= \\simplify[unitFactor,zeroTerm,zeroFactor]{1 -Exp( -{p}) -({p} * Exp( -{p})) -(({p} ^ 2 * Exp( -{p})) / 2) -{ v3} * (({p} ^ 3 * Exp( -{p})) / 6) -{ v4} * (({p} ^ 4 * Exp( -{p})) / 24)} \\\\
&= \\var{tans2} \\\\
&\\approx \\var{ans2}
\\end{align}
to 3 decimal places.
\nFor the Poisson distribution $\\operatorname{Poisson}(\\lambda)$ we have:
\n\\[ \\operatorname{E}[Y] = \\operatorname{Var}(Y) = \\lambda \\]
\nHence in this case:
\n\\begin{align}
\\operatorname{E}[Y] &= \\var{p} \\\\
\\operatorname{Var}(Y) &= \\var{p}
\\end{align}
A weighted coin with given $P(H),\\;P(T)$ is tossed 3 times. Let $X$ be the random variable which denotes the longest string of consecutive heads that occur during these tosses. Find the Probability Mass Function (PMF), expectation and variance of $X$.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "A coin has two faces, $H$ or $T$. It is weighted so that $P(H)=\\var{h}$ and $P(T)=\\var{t}$ and is tossed $\\var{thismany}$ times.
\nLet $X$ be the random variable which denotes the longest string of consecutive heads that occur during these tosses.
\nCompute the:
\na)
\nEvent | \nHHH | \nHHT | \nHTH | \nHTT | \n
---|---|---|---|---|
Probability | \n$\\var{h}^3=\\var{h^3}$ | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n
$X$ | \n$3$ | \n$2$ | \n$1$ | \n$1$ | \n
Event | \nTHH | \nTHT | \nTTH | \nTTT | \n
---|---|---|---|---|
Probability | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n$\\var{t}^3=\\var{t^3}$ | \n
$X$ | \n$2$ | \n$1$ | \n$1$ | \n$0$ | \n
So we see that:
\n$P(X=0)=\\var{h0},\\;P(X=1)=\\var{h^2*t}+3\\times \\var{h*t^2}=\\var{h1}$
\n$P(X=2)=2\\times \\var{h^2*t}=\\var{h2},\\;P(X=3)=\\var{h3}$
\nb)
\nThe expectation is given by:
\n$\\operatorname{E}[X]=\\sum x \\;P(X=x)=0\\times \\var{h0}+1\\times \\var{h1}+2\\times \\var{h2}+3\\times \\var{h3}=\\var{ex}$ (exactly).
\nc)
\nFor this discrete distribution we use the formula:
\n\\[\\begin{eqnarray*}\\operatorname{Var}(X)&=&\\operatorname{E}[X^2]-\\operatorname{E}(X)^2\\\\&=&0\\times \\var{h0}+1\\times \\var{h1}+4\\times \\var{h2}+9\\times \\var{h3}-\\var{ex}^2\\\\&=&\\var{precround(var,4)}\\end{eqnarray*}\\] to 4 decimal places.
", "rulesets": {}, "variables": {"var": {"name": "var", "group": "Ungrouped variables", "definition": "9*h3+4*h2+h1-ex^2", "description": "", "templateType": "anything"}, "h0": {"name": "h0", "group": "Ungrouped variables", "definition": "t^3", "description": "", "templateType": "anything"}, "h": {"name": "h", "group": "Ungrouped variables", "definition": "random(0.2..0.9#0.05 except 0.5)", "description": "", "templateType": "anything"}, "h3": {"name": "h3", "group": "Ungrouped variables", "definition": "h^3", "description": "", "templateType": "anything"}, "thismany": {"name": "thismany", "group": "Ungrouped variables", "definition": "3", "description": "", "templateType": "anything"}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "1-h", "description": "", "templateType": "anything"}, "h1": {"name": "h1", "group": "Ungrouped variables", "definition": "h^2*t+3*h*t^2", "description": "", "templateType": "anything"}, "h2": {"name": "h2", "group": "Ungrouped variables", "definition": "2*h^2*t", "description": "", "templateType": "anything"}, "ex": {"name": "ex", "group": "Ungrouped variables", "definition": "3*h3+2*h2+h1", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["h2", "h", "h0", "h1", "thismany", "t", "h3", "var", "ex"], "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": "$X$ can take the values $0,\\;1,\\;2$ or $3$.
\nComplete the tables below in order to find the PMF. You must input all numbers as exact decimals - no rounding or approximations.
\nFirst, find the probability of each outcome on tossing the coin.
\nEvent | \nHHH | HHT | HTH | HTT |
---|---|---|---|---|
Probability | \n[[0]] | \n[[1]] | \n[[2]] | \n[[3]] | \n
$X$ | \n$3$ | \n$2$ | \n$1$ | \n$1$ | \n
Event | \nTHH | THT | TTH | TTT |
---|---|---|---|---|
Probability | \n[[4]] | \n[[5]] | \n[[6]] | \n[[7]] | \n
$X$ | \n$2$ | \n$1$ | \n$1$ | \n$0$ | \n
Use the information from the above table to find the PMF for $X$.
\n$X$ | \n$0$ | $1$ | $2$ | $3$ |
---|---|---|---|---|
$P(X=x)$ | \n[[8]] | \n[[9]] | \n[[10]] | \n[[11]] | \n
Find the expectation:
\n$\\operatorname{E}[X]=\\;$[[0]] Input your answer as an exact decimal.
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "expectation", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ex", "maxValue": "ex", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "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 variance:
\n$\\operatorname{Var}(X)=\\;$[[0]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "variance", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "var", "maxValue": "var", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "4", "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}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Sampling with and without replaement - binomial, hypergeometric, and Poisson approximation, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"batch": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'batch'", "description": "", "name": "batch"}, "howmany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "3", "description": "", "name": "howmany"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "t*random(100..160#20)+(1-t)*random(100..170#10)", "description": "", "name": "thismany"}, "tpapprox": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-e^(-m)*(1+m+m^2/2)", "description": "", "name": "tpapprox"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.0001", "description": "", "name": "tol"}, "tbin": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-binomialcdf(2,s,1-p)", "description": "", "name": "tbin"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "name": "t"}, "items": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'items'", "description": "", "name": "items"}, "bin": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tbin,4)", "description": "", "name": "bin"}, "percent": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=0,10,random(5,10))", "description": "", "name": "percent"}, "thyp": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-hypgeomcdf(howmany-1,thismany,round(thismany*percent/100),s)", "description": "", "name": "thyp"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'defectives'", "description": "", "name": "something"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..35#5)", "description": "", "name": "s"}, "hyp": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-hypgeomcdf(howmany-1,thismany,round(thismany*percent/100),s),4)", "description": "", "name": "hyp"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-percent/100", "description": "", "name": "p"}, "papprox": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tpapprox,4)", "description": "", "name": "papprox"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s*percent/100", "description": "", "name": "m"}}, "ungrouped_variables": ["bin", "tpapprox", "howmany", "thismany", "items", "percent", "batch", "hyp", "p", "m", "papprox", "t", "tol", "s", "thyp", "tbin", "something"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "bin+tol", "minValue": "bin-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Compute $P(X \\ge \\var{howmany})$ when sampling is with replacement.
\n$P(X \\ge \\var{howmany})=\\;$[[0]] (to 4 decimal places).
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "hyp+tol", "minValue": "hyp-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Compute $P(X \\ge \\var{howmany})$ when sampling is without replacement.
\n$P(X \\ge \\var{howmany})=\\;$[[0]] (to 4 decimal places).
\n", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "papprox+tol", "minValue": "papprox-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
Repeat Part a) using a suitable approximation:
\n$P(X \\ge \\var{howmany})=\\;$[[0]] (to 4 decimal places).
\n", "showCorrectAnswer": true, "marks": 0}], "statement": "
A {batch} of $\\var{thismany}$ {items} has $\\var{percent}$% {something}.
\nA sample of size $\\var{s}$ is taken.
\n$X$ is the number of {something} in the sample.
\nNote that for the second part of this example we expect you to use R to calculate the probability.
", "tags": ["approximating binomial distribution", "binomial", "Binomial distribution", "binomial distribution", "Binomial Distribution", "checked2015", "discrete distribution", "distribution", "hypergeometric distribution", "MAS1604", "MAS2304", "Poisson distribution", "poisson distribution", "Probability", "R", "replacement", "sample", "sampling", "sc", "statistical distribution", "statistics", "without replacement"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "5/02/2013:
\nFirst draft finished.
\nUses the jstats hypergeometric function hypgeomcdf(m-1,N,k,n)
", "licence": "Creative Commons Attribution 4.0 International", "description": "Three parts. A sample of size $n$ is taken from $N$ where $k$ of the items are known to be defective and the task is to find the probability that more than $m$ defectives are in the sample. First part is sampling with replacement (binomial), second is sampling without replacement, (hypergeometric) and the last part uses the Poisson approximation to the first part.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\nFor sampling with replacement we have $X \\sim \\operatorname{Bin}\\left(\\var{s},\\var{percent/100}\\right)$.
\nHence:
\n$P(X \\ge \\var{howmany}) = 1-P(X \\le \\var{howmany-1})=1-\\var{1-tbin}=\\var{bin}$ to 4 decimal places.
\nb)
\nFor sampling without replacement we have $X \\sim \\operatorname{Hypergeometric}(N=\\var{thismany},\\;n=\\var{s}, p=\\var{percent/100})$.
\nSince $P(X \\ge \\var{howmany})=1-P(X \\le \\var{howmany-1})$ we calculate $P(X \\le \\var{howmany-1})$ using the hypergeometric probability distribution as calculated in R as we are counting the number of ways of selecting $\\var{howmany-1}$ from $\\var{round(thismany*percent/100)}$ defectives and the other $\\var{s+1-howmany}$ in the sample from the $\\var{round(thismany*(1-percent/100))}$ non-defectives.
\nThe R expression we use for the probability is:
$\\operatorname{phyper}(\\var{howmany-1},\\var{round(thismany*percent/100)},\\var{round(thismany*(1-percent/100))},\\var{s})=\\var{1-thyp}$
\nHence the answer for sampling without replacement is $1-\\var{1-thyp}=\\var{hyp}$ t0 4 decimal places.
\nc)
\nWe can approximate the random variable $X$ from part a) which follows a binomial distribution by the Poisson distribution $\\operatorname{Poisson}\\left(\\mu=\\var{s}\\times \\var{percent/100}\\right)=\\operatorname{Poisson}(\\var{m})$.
\nWe have $P(X \\ge \\var{howmany}) = 1-P(X \\le \\var{howmany-1})=1-\\var{1-tpapprox}=\\var{papprox}$ to 4 decimal places.
"}, {"name": "Use piecewise CDF to find probabilities at given points, and the expectation.", "extensions": [], "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/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"x2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "x1+random(0.1..0.3#0.05)", "name": "x2", "description": ""}, "message": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(c4=c1 or c4=c2 or c4=c3,\"Note that we could have read this result directly from the information given above for \", \" \")", "name": "message", "description": ""}, "c5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "c2+random(1..4)", "name": "c5", "description": ""}, "c4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(((100-t)/100+t/100*(c3-1)))", "name": "c4", "description": ""}, "mess": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(c4=c1 or c4=c2 or c4=c3,'$F_X(b)$','$\\\\;$')", "name": "mess", "description": ""}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..100)", "name": "t", "description": ""}, "x3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "x2+random(0.2..0.35#0.05)", "name": "x3", "description": ""}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "name": "c1", "description": ""}, "c2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "c1+random(1..3)", "name": "c2", "description": ""}, "v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(c4$P(X=0)=\\;\\;$[[0]] $P(X=\\var{c1})=\\;\\;$[[1]]
\n$P(X=\\var{c2})=\\;\\;$[[2]] $P(X=\\var{c3})=\\;\\;$[[3]]
", "unitTests": [], "sortAnswers": false, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "x1", "maxValue": "x1", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "x2-x1", "maxValue": "x2-x1", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "x3-x2", "maxValue": "x3-x2", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "1-x3", "maxValue": "1-x3", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "Calculate:
\n$\\displaystyle F_X(\\var{c4})=P(X \\le \\var{c4})=\\;\\;$[[0]] (exact decimal)
", "unitTests": [], "sortAnswers": false, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "val", "maxValue": "val", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 1, "showFeedbackIcon": true}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "Compute $\\operatorname{E}[X]=\\;\\;$[[0]]
", "unitTests": [], "sortAnswers": false, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "ex", "maxValue": "ex", "unitTests": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 1, "showFeedbackIcon": true}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}], "statement": "Suppose that the cumulative distribution function (CDF) of the random variable $X$ is given by
\n$F_X(b) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\end{array} \\right .$ | \n0, | \n$b \\lt 0,$ | \n
\n | \n | |
$\\var{x1}$ | \n$0 \\le b \\lt \\var{c1},$ | \n|
\n | \n | |
$\\var{x2}$ | \n$\\var{c1} \\le b \\lt\\var{c2},$ | \n|
\n | \n | |
$\\var{x3}$ | \n$ \\var{c2} \\le b \\lt \\var{c3},$ | \n|
\n | \n | |
1, | \n$b \\ge \\var{c3}.$ | \n
Answer the following questions:
", "tags": ["CDF", "cdf", "checked2015", "continuous random variable", "cumulative distribution function", "diagram needed", "discontinuous cdf", "distribution", "distribution on the real line", "expectation", "Probability", "probability", "query", "random variable", "statistics"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Given a piecewise CDF $F_X(b)$ which is discontinuous at several points, find the probabilities at those points and also find the value of $F_X(b)$ at a continuous point and the expectation.
\nThis cdf is a step function and is therefore the cdf of a discrete random variable. This should be stated somewhere in the statement or the solution. Apart from this the question is correct.
"}, "advice": "a)
\nFrom lectures we know that jumps in the CDF imply a non zero probability at that point.
\nThus:
\n$P(X=0)=\\var{x1}$,
\n$P(X=\\var{c1})=\\var{x2}-\\var{x1}=\\var{x2-x1}$,
\n$P(X=\\var{c2})=\\var{x3}-\\var{x2}=\\var{x3-x2}$,
\n$P(X=\\var{c3})=1-\\var{x3}=\\var{1-x3}$
\nb)
\n\\[\\begin{eqnarray*} F_X(\\var{c4}) =P(X \\le \\var{c4}) &=&\\simplify[all]{ P(X = 0) + {v2} * P(X = {c1}) + {v3} * P(X = {c2}) + {v4} * P(X = {c3})}\\\\&=& \\simplify[zerofactor,zeroterm,unitfactor]{{x1} + {v2} *({x2-x1}) + {v3} *({x3 -x2}) + {v4} * ({1 -x3}) }\\\\&=& \\var{val}\\end{eqnarray*}\\]
\n{message}{mess}.
\nc)
\n$\\displaystyle \\operatorname{E}[X]=\\sum x P(X=x)=0\\times \\var{x1}+\\var{c1}\\times \\var{x2-x1}+\\var{c2}\\times \\var{x3-x2}+\\var{c3}\\times \\var{1-x3}=\\var{ex}$
\n\n
\n
"}, {"name": "Bivariate continuous distribution - marginals and conditional probability, ", "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/"}], "variable_groups": [], "variables": {"x1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "min(a+random(1..4),a+b-1)", "description": "", "name": "x1"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "b"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "", "name": "c"}, "y1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "min(c+random(1..4),c+d-1)", "description": "", "name": "y1"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "d"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "", "name": "a"}}, "ungrouped_variables": ["a", "c", "b", "d", "y1", "x1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c}", "minValue": "{c}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c+d}", "minValue": "{c+d}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{x1}", "minValue": "{x1}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a+b}", "minValue": "{a+b}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
The probability $P(X \\ge \\var{x1})$ is given by:
\n\\[P(X\\ge \\var{x1})= \\int_a^b \\int_c^d f(x,y)dxdy\\]
\nInput the limits of integration here:
\n$a=\\;$?[[0]] $b=\\;$?[[1]]
\n$c=\\;$?[[2]] $d=\\;$?[[3]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c}", "minValue": "{c}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c+d}", "minValue": "{c+d}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a}", "minValue": "{a}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a+b}", "minValue": "{a+b}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\\[f_X(x)=\\int_p^qf(x,y)dy\\]
\nInput the limits of integration here:
\n$p=\\;$?[[0]] $q=\\;$?[[1]]
\nAlso input the range of values of $x,\\;x_1 \\le x \\le x_2$ on which $f_X(x)$ is defined.
\n$x_1=\\;$?[[2]] $x_2=\\;$?[[3]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a}", "minValue": "{a}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a+b}", "minValue": "{a+b}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c}", "minValue": "{c}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c+d}", "minValue": "{c+d}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "The marginal $f_Y(y$) of $Y$ is calculated as follows: \\[f_Y(y)=\\int_r^s f(x,y)dx\\]
\nInput the limits of integration here:
\n$r=\\;$?[[0]] $s=\\;$?[[1]]
\nAlso input the range of values of $y,\\;y_1 \\le y \\le y_2$ that $f_Y(y)$ is defined on.
\n$y_1=\\;$?[[2]] $y_2=\\;$?[[3]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{c}", "minValue": "{c}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{y1}", "minValue": "{y1}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{x1}", "minValue": "{x1}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{a+b}", "minValue": "{a+b}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "The conditional probability $P(Y \\le \\var{y1}|X \\ge \\var{x1})$ is calculated as follows:
\n\\[P(Y \\le \\var{y1}|X \\ge \\var{x1})=\\frac{\\int_t^u\\int_v^w f(x,y) dx dy}{A}\\]
\nWhere:
\n\\[A = \\int_{\\var{c}}^{\\var{c+d}}\\int_{\\var{x1}}^{\\var{a+b}} f(x,y) dx dy\\]
\nInput the limits of integration here:
\n$t=\\;$?[[0]] $u=\\;$?[[1]]
\n$v=\\;$?[[2]] $w=\\;$?[[3]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "Suppose that a bivariate continuous random variable is defined on the region $R \\subset \\mathbb{R^2}$ given by:
\n\\[\\var{a} \\le x \\le \\var{a+b},\\;\\;\\;\\;\\;\\;\\;\\var{c} \\le y \\le \\var{c+d}\\] with joint PDF given by $f(x,y)$ in $R$ and zero otherwise.
\nIn the following questions, you are asked to supply the limits of integration for the following computations:
", "tags": ["bivariate distributions", "checked2015", "conditional probability", "double integration", "limits of integration", "marginal distributions", "MAS1604", "MAS2304", "pdf", "PDF", "Probability", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "6/02/2013:
\nFinished first draft.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$f(x,y)$ is the PDF of a bivariate distribution $(X,Y)$ on a given rectangular region in $\\mathbb{R}^2$. Write down the limits of the integrations needed to find $P(X \\ge a)$, the marginal distributions $f_X(x),\\;f_Y(y)$ and the conditional probability $P(Y \\le b|X \\ge c)$
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\nThe probability $P(x \\ge \\var{x1})$ is given by:
\n\\[P(x \\ge \\var{x1})=\\int_{\\var{c}}^{\\var{c+d}}\\int_{\\var{x1}}^{\\var{a+b}} f(x,y) dx dy\\]
\nb)
\nThe marginal $f_X(x)$ of $X$ is:
\n\\[f_X(x)=\\int_{\\var{c}}^{\\var{c+d}}f(x,y)dy\\] and the range that $f_X(x)$ is defined on is $\\var{a} \\le x \\le \\var{a+b}$.
\nc)
\nThe marginal $f_Y(y)$ of $Y$ is:
\n\\[f_Y(y)=\\int_{\\var{a}}^{\\var{a+b}}f(x,y)dx\\] and the range that $f_Y(y)$ is defined on is $\\var{c} \\le x \\le \\var{c+d}$.
\nd) The conditional probability $P(Y \\le \\var{y1}|X \\ge \\var{x1})$ is calculated as follows:
\n\\[P(Y \\le \\var{y1}|X \\ge \\var{x1})=\\frac{\\int_{\\var{c}}^{\\var{y1}}\\int_{\\var{x1}}^{\\var{a+b}} f(x,y) dx dy}{A}\\]
\n "}, {"name": "Find CDF of given exponential distribution, and expectation and variance, ", "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/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.0002", "description": "", "name": "tol"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,4)", "description": "", "name": "ans2"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..10#0.5)", "description": "", "name": "b"}, "la": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.5..5#0.5)", "description": "", "name": "la"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(la>=4,random(0.5..1#0.5),if(la>2,random(0.5..3#0.5),random(0.5..5#0.5)))", "description": "", "name": "a"}, "tans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "exp(-a*la)-exp(-b*la)", "description": "", "name": "tans2"}}, "ungrouped_variables": ["a", "b", "la", "ans2", "tol", "tans2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "(1 + ( - (e ^ ({( - la)} * y))))", "showCorrectAnswer": true, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "answersimplification": "basic", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "Find the CDF of $Y$.
\n\n
$F_Y(y)=\\;$?[[0]], $y \\gt 0$.
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans2+tol", "minValue": "ans2-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Calculate:
\n$P(\\var{a} \\leq Y \\leq \\var{b})=\\;$?[[0]] (to 4 decimal places).
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "2/{2*la}", "showCorrectAnswer": true, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "answersimplification": "all, fractionNumbers", "marks": 0.5, "vsetrangepoints": 5}, {"answer": "4/{4*la^2}", "showCorrectAnswer": true, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "answersimplification": "all,fractionNumbers", "marks": 0.5, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "Find $\\operatorname{E}[Y]$ and $\\operatorname{Var}(Y)$.
\n$\\operatorname{E}[Y]=\\;$?[[0]] (Enter as a fraction or an integer, not as a decimal).
\n$\\operatorname{Var}(Y)=\\;$?[[1]] (Enter as a fraction or an integer, not as a decimal).
", "showCorrectAnswer": true, "marks": 0}], "statement": "Suppose $Y \\sim \\operatorname{Exp}(\\var{la})$ with PDF $f_Y(y)=\\var{la}e^{-\\var{la}y},\\;\\;y \\gt 0$
", "tags": ["CDF", "cdf", "checked2015", "continuous distributions", "expectation", "exponential distribution", "MAS1604", "MAS2304", "PDF", "pdf", "Probability", "statistical distributions", "statistics", "variance"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "6/02/2013:
\n
Finished first draft.
Given the PDF for $Y \\sim \\operatorname{Exp}(\\lambda)$ find the CDF, $P(a \\le Y \\le b)$ and $\\operatorname{E}[Y],\\;\\operatorname{Var}(Y)$
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\nWe have \\[\\begin{eqnarray*} F_Y(y)&=&P(Y\\le y)\\\\&=&\\int_0^y\\var{la}e^{-\\var{la}x}dx\\\\&=&\\left[-e^{-\\var{la}x}\\right]_0^y=1-e^{-\\var{la}y}\\end{eqnarray*}\\]
\nb)
\n\\[\\begin{eqnarray*}P(\\var{a} \\leq Y \\leq \\var{b})&=&F_Y(\\var{b})-F_Y(\\var{a})\\\\&=&1-e^{-\\var{la}\\times \\var{b}}-(1-e^{-\\var{la}\\times \\var{a}})\\\\&=&e^{-\\var{la}\\times \\var{a}}-e^{-\\var{la}\\times \\var{b}}\\\\&=&\\var{tans2}=\\var{ans2}\\end{eqnarray*}\\] to 4 decimal places.
\nc)
\nThe properties of the exponential distribution give:
\n$\\displaystyle \\operatorname{E}[Y]=\\simplify[all,fractionNumbers]{1/{la}=2/{2*la}}$
\n$\\displaystyle \\operatorname{Var}(Y)=\\simplify[all,fractionNumbers]{1/{la}^2=4/{4*la^2}}$
\n"}, {"name": "PDF and CDF of continuous uniform random variable, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5)", "name": "a", "description": ""}, "x1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+random(1..4)", "name": "x1", "description": ""}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+random(5..12)", "name": "b", "description": ""}}, "ungrouped_variables": ["a", "x1", "b"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "1/{b-a}", "showCorrectAnswer": true, "vsetrange": [0, 1], "scripts": {}, "checkvariablenames": false, "expectedvariablenames": [], "notallowed": {"message": "
input as a fraction and not a decimal
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "answersimplification": "std", "marks": 0.5, "vsetrangepoints": 5}, {"answer": "0", "vsetrange": [0, 1], "scripts": {}, "checkvariablenames": false, "expectedvariablenames": [], "notallowed": {"message": "Input as a fraction or an integer.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "showCorrectAnswer": true, "marks": 0.5, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n
What is the PDF of $X$? Input all answers as fractions or integers, not as decimals.
\n$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\\\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\end{array} \\right .$ | \n[[0]] | \n$\\var{a} \\leq x \\leq \\var{b},$ | \n
[[1]] | \notherwise | \n
", "marks": 0}, {"scripts": {}, "gaps": [{"answer": "0", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 0.5, "vsetrangepoints": 5}, {"answer": "(x-{a})/({b-a})", "showCorrectAnswer": true, "vsetrange": [0, 1], "scripts": {}, "checkvariablenames": false, "expectedvariablenames": [], "notallowed": {"message": "
input numbers as fractions or integers and not as decimals
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "answersimplification": "std", "marks": 1, "vsetrangepoints": 5}, {"answer": "1", "showCorrectAnswer": true, "vsetrange": [0, 1], "scripts": {}, "checkvariablenames": false, "expectedvariablenames": [], "notallowed": {"message": "input numbers as fractions or integers and not as decimals
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "answersimplification": "std", "marks": 0.5, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "Compute the CDF $F_X(x)$ of $X$.
\n$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\\\ \\phantom{{.}}\\\\ \\phantom{{.}} \\end{array} \\right .$ | \n[[0]] | \n$x \\lt \\var{a},$ | \n
\n | \n | |
[[1]] | \n$\\var{a} \\leq x \\leq \\var{b}$ | \n|
\n | \n | |
[[2]] | \n$ x \\gt \\var{b},$ | \n|
\n | \n |
Input all numbers as fractions or integers in the above formulae.
", "marks": 0}, {"scripts": {}, "gaps": [{"answer": "{b-x1}/{b-a}", "showCorrectAnswer": true, "vsetrange": [0, 1], "scripts": {}, "checkvariablenames": false, "expectedvariablenames": [], "notallowed": {"message": "Input all numbers as fractions or integers.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "checkingaccuracy": 0.001, "type": "jme", "answersimplification": "std", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "Also, using the distribution function above find:
\n$P( X \\ge \\var{x1})=\\;\\;$[[0]]
\n(input your answer as a fraction or integer and not as a decimal).
", "marks": 0}], "statement": "Suppose $X$ is a continuous uniform random variable defined on $[\\var{a},\\;\\var{b}]$.
", "tags": ["CFD", "checked2015", "continuous random variables", "cumulative distribution functions", "density functions", "distribution function", "distribution functions", "MAS1604", "MAS2304", "pdf", "PDF", "Probability", "probability density function", "random variables", "statistics", "uniform random variable"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "05/02/2013:
\nFirst draft finished.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$X$ is a continuous uniform random variable defined on $[a,\\;b]$. Find the PDF and CDF of $X$ and find $P(X \\ge c)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\nThe PDF is given by:
\n\n
$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\\\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\end{array} \\right .$ | \n\\[\\frac{1}{\\var{b}-(\\var{a})}=\\frac{1}{\\var{b-a}}\\] | \n$\\var{a} \\leq x \\leq \\var{b},$ | \n
$0$ | \notherwise | \n
b) The CDF is given by:
\n$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\\\ \\phantom{{.}}\\\\ \\phantom{{.}} \\end{array} \\right .$ | \n$0$ | \n$x \\lt \\var{a},$ | \n
\n | \n | |
\\[\\simplify{(x-{a})/{b-a}}\\] | \n$\\var{a} \\leq x \\leq \\var{b}$ | \n|
\n | \n | |
1 | \n$ x \\gt \\var{b},$ | \n|
\n | \n |
c)
\n\\[P(X \\ge \\var{x1})=1-F_X(\\var{x1})=1-\\simplify[std]{({x1}-{a})/{b-a}={b-x1}/{b-a}}\\]
\n"}, {"name": "Conditional probability in normal distribution, ", "extensions": ["stats"], "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/"}], "variable_groups": [], "variables": {"m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=0,heightm,heightw)", "description": "", "name": "m"}, "z": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-2.0..-0.2#0.1)", "description": "", "name": "z"}, "z2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..2.0#0.1 except [abs(z),z1])", "description": "", "name": "z2"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "name": "t"}, "age": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(20..40)", "description": "", "name": "age"}, "units1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'inches'", "description": "", "name": "units1"}, "w2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-normalcdf(abs(z2),0,1)", "description": "", "name": "w2"}, "heightm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(68..72#0.5)", "description": "", "name": "heightm"}, "lower1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "z1*s+m", "description": "", "name": "lower1"}, "upper1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "z2*s+m", "description": "", "name": "upper1"}, "prop": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(100*(1-normalcdf(abs(z),0,1)),1)", "description": "", "name": "prop"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..7)", "description": "", "name": "s"}, "heightw": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(63..65#0.5)", "description": "", "name": "heightw"}, "mw": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=0,'men','women')", "description": "", "name": "mw"}, "z1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-2.0..-0.2#0.1 except z)", "description": "", "name": "z1"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "z*s+m", "description": "", "name": "lower"}, "prop1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(100*(w2)/(w1),1)", "description": "", "name": "prop1"}, "w1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "normalcdf(abs(z1),0,1)", "description": "", "name": "w1"}}, "ungrouped_variables": ["units1", "lower", "z", "age", "heightw", "m", "lower1", "prop", "heightm", "s", "t", "w1", "prop1", "mw", "upper1", "z1", "z2", "w2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prop+0.1", "minValue": "prop-0.1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
What proportion of such {mw} are less than $\\var{lower}$ {units1} tall?
\nProportion =?[[0]]% (to 1 decimal place)..
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prop1+0.1", "minValue": "prop1-0.1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "What proportion of such {mw} over $\\var{lower1}$ {units1} tall are more than $\\var{upper1}$ {units1} tall?
\nProportion = ?[[0]]% (to one decimal place).
", "showCorrectAnswer": true, "marks": 0}], "statement": "Suppose that the height in {units1}, of $\\\\var{age}$ year old {mw} is a normal distribution with mean $\\var{m}$ and standard deviation $\\var{s}$.
", "tags": ["Baye's Theorem", "checked2015", "conditional probability", "converting to z scores", "MAS1604", "MAS2304", "mean ", "Normal distribution", "normal distribution", "normal tables", "Probability", "standard deviation", "statistics", "z scores"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/02/2013:
\nFinished first draft. Tag sc included.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given a normal distribution $X \\sim N(m,\\sigma^2)$ find $P(X \\lt a),\\; a \\lt m$ and the conditional probability $P(X \\gt b | X \\gt c)$ where $b \\lt m$ and $c \\gt m$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\nConverting to $\\operatorname{N}(0,1)$
\n\\[\\begin{eqnarray*}P(X \\lt \\var{lower})&=&P\\left(Z \\lt \\frac{\\var{lower}-\\var{m}}{\\var{s}}\\right)\\\\&=&P(Z\\lt \\var{z})=1-P(Z \\lt \\var{-z})=1-\\var{normalcdf(-z,0,1)}\\\\&=&\\var{prop/100}\\end{eqnarray*}\\] to 3 decimal places.
\nHence the proportion is $\\var{prop}$% to 1 decimal place.
\nb)
\nThe proportion of such {mw} over $\\var{lower1}$ {units1} tall that are more than $\\var{upper1}$ {units1} tall is given by finding the conditional probability:
\n\\[\\begin{eqnarray*}P(X \\gt \\var{upper1}|X \\gt\\var{lower1})&=&\\frac{P(X \\gt \\var{upper1} \\text{ and } X \\gt \\var{lower1})}{P(X \\gt \\var{lower1})}\\\\&=&\\frac{P(X \\gt \\var{upper1})}{P(X \\gt \\var{lower1})}\\\\&=&\\frac{1-P(X \\le \\var{upper1})}{1-P(X \\le \\var{lower1})}\\\\&=&\\frac{1-\\Phi(\\var{z2})}{1-\\Phi(\\var{z1})}\\\\&=&\\frac{1-\\Phi(\\var{z2})}{\\Phi(\\var{-z1})}=\\frac{\\var{w2}}{\\var{w1}}\\\\&=&\\var{prop1/100}\\end{eqnarray*}\\]
\nto 3 decimal places.
\nhence the proportion is $\\var{prop1}$% to 1 decimal place.
"}, {"name": "Find parameters of normal distributions from bivariate distribution, ", "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/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "description": "", "name": "tol"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,1,-1])", "description": "", "name": "a"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,1,-1])", "description": "", "name": "c"}, "tansr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "muy+rh*sigy*(f-mux)/sigx", "description": "", "name": "tansr"}, "en1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "rh*sigx*sigy", "description": "", "name": "en1"}, "muy": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3,4,5,10,20,50,100)", "description": "", "name": "muy"}, "ansp": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tansp,2)", "description": "", "name": "ansp"}, "tansq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sigx^2*(1-rh^2)", "description": "", "name": "tansq"}, "sigx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3,4,5,10)", "description": "", "name": "sigx"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,1,-1])", "description": "", "name": "b"}, "en2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sigx^2", "description": "", "name": "en2"}, "mux": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3,4,5,10,20,50,100)", "description": "", "name": "mux"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,1,-1])", "description": "", "name": "d"}, "rh": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-0.9..0.9#0.1)", "description": "", "name": "rh"}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "muy+random(-5..5 except 0)", "description": "", "name": "f"}, "tanss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sigy^2*(1-rh^2)", "description": "", "name": "tanss"}, "en3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sigy^2", "description": "", "name": "en3"}, "ansr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tansr,2)", "description": "", "name": "ansr"}, "ansq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tansq,2)", "description": "", "name": "ansq"}, "sigy": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3,4,5,10)", "description": "", "name": "sigy"}, "g": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mux+random(-5..5 except 0)", "description": "", "name": "g"}, "anss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tanss,2)", "description": "", "name": "anss"}, "tansp": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mux+rh*sigx*(g-muy)/sigy", "description": "", "name": "tansp"}}, "ungrouped_variables": ["sigy", "sigx", "tansq", "tansp", "tanss", "tansr", "muy", "mux", "tol", "rh", "ansp", "ansq", "ansr", "anss", "a", "c", "b", "d", "g", "f", "en1", "en2", "en3"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "a*mux", "minValue": "a*mux", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "a^2*sigx^2", "minValue": "a^2*sigx^2", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "$\\var{a}X \\sim \\operatorname{N}(a,b)$ where:
\n$a=\\;$?[[0]] $b=\\;$?[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "b*muy", "minValue": "b*muy", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "b^2*sigy^2", "minValue": "b^2*sigy^2", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "$\\var{b}Y \\sim \\operatorname{N}(c,d)$ where:
\n$c=\\;$?[[0]] $d=\\;$?[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c*mux+d*muy", "minValue": "c*mux+d*muy", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c^2*sigx^2+d^2*sigy^2+2*c*d*rh*sigx*sigy", "minValue": "c^2*sigx^2+d^2*sigy^2+2*c*d*rh*sigx*sigy", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "$\\simplify{{c}X+{d}Y} \\sim \\operatorname{N}(f,g)$ where:
\n$f=\\;$?[[0]] $g=\\;$?[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ansp+tol", "minValue": "ansp-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ansq+tol", "minValue": "ansq-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ansr+tol", "minValue": "ansr-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "anss+tol", "minValue": "anss-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Input all answers in this part of the question to 2 decimal places.
\n$X|(Y=\\var{g}) \\sim \\operatorname{N}(p,q)$ where:
\n$p=\\;$?[[0]] $q=\\;$[[1]]
\n$Y|(X=\\var{f}) \\sim \\operatorname{N}(r,s)$ where:
\n$r=\\;$?[[2]] $s=\\;$[[3]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "Consider the following bivariate normal distribution.
\n\\[\\begin{pmatrix}X\\\\Y\\end{pmatrix} \\sim\\operatorname{N_2}\\left[\\begin{pmatrix}\\var{mux}\\\\ \\var{muy}\\end{pmatrix},\\begin{pmatrix} \\var{en2}&\\var{en1}\\\\ \\var{en1}&\\var{en3}\\end{pmatrix}\\right]\\]
\nYou have to find the distributions of $\\var{a}X,\\;\\var{b}Y,\\;\\simplify{{c}X+{d}Y},\\; Y|(X=\\var{f}),\\;X|(Y=\\var{g})$
", "tags": ["bivariate normal ", "checked2015", "distributions", "linear combinations of normal distributions", "MAS1604", "MAS2304", "normal", "normal distributions", "normal parameters", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/02/2013:
\nFirst draft finished.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given the parameters of a bivariate Normal distribution $(X,Y)$ find the parameters of the Normal Distributions: $aX,\\;bY,\\;cX+dY,\\; Y|(X=f),\\;X|(Y=g)$
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "Look at your notes to see how these parameters for the distributions were obtained.
"}, {"name": "Normal distribution probability and percentiles, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "tags": ["checked2015", "continuous distributions", "distributions", "mean", "Normal distribution", "normal distribution", "normal tables", "percentiles", "probability", "Probability", "sc", "standard deviation", "statistics", "z scores"], "metadata": {"description": "Given normal distribution $\\operatorname{N}(m,\\sigma^2)$ find $P(a \\lt X \\lt b),\\; a \\lt m,\\;b \\gt m$ and also find the value of $X$ corresponding to a given percentile $p$%.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Let $X$ be the {something} which has a normal distribution, mean $\\var{m}$ and standard deviation $\\var{s}$ i.e. $X \\sim \\operatorname{N}(\\var{m},\\var{s^2})$.
", "advice": "Converting to $\\operatorname{N}(0,1)$:
\na)
\n\\[\\begin{eqnarray*}P(\\var{lower1} \\lt X \\lt \\var{upper1})&=&P(X \\lt \\var{upper1})- P(X \\lt \\var{lower1})\\\\&=&P\\left(Z \\lt \\frac{\\var{upper1}-\\var{m}}{\\var{s}}\\right)-P\\left(Z \\lt \\frac{\\var{lower1}-\\var{m}}{\\var{s}}\\right)\\\\&=&P(Z \\lt \\var{zu})-P(Z \\lt \\var{zl})=\\var{u}-\\var{l}\\\\&=&\\var{p}\\end{eqnarray*}\\]
\nto 3 decimal places.
\nb)
\nWe need to find $x$ such that:
\n\\[\\begin{eqnarray*}P(X \\lt x) &\\le& \\var{percentile/100}\\\\ \\Rightarrow P\\left(Z \\le \\frac{x-\\var{m}}{\\var{s}}\\right) &\\le& \\var{percentile/100}\\\\ \\Rightarrow \\frac{x-\\var{m}}{\\var{s}} &\\le& \\Phi^{-1}(\\var{percentile/100})=\\var{normalinv(percentile/100,0,1)}\\\\ \\Rightarrow x &\\le&\\var{normalinv(percentile/100,0,1)}\\times\\var{s}+\\var{m}=\\var{perX}\\end{eqnarray*}\\] to 2 decimal places.
\nHence $X=\\var{perX}$ gives the $\\var{percentile}$% percentile.
\n", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0.001", "description": "", "templateType": "anything", "can_override": false}, "percentile": {"name": "percentile", "group": "Ungrouped variables", "definition": "//perhaps should stick to standard values 90,95,99,99.9\n random(40..99 except 50)", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(270..290#0.2)", "description": "", "templateType": "anything", "can_override": false}, "perx": {"name": "perx", "group": "Ungrouped variables", "definition": "precround(normalinv(percentile/100,m,s),2)", "description": "", "templateType": "anything", "can_override": false}, "this": {"name": "this", "group": "Ungrouped variables", "definition": "'a platelet count'", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "normalcdf(zu,0,1)", "description": "", "templateType": "anything", "can_override": false}, "zu": {"name": "zu", "group": "Ungrouped variables", "definition": "random(0.2..2.0 except abs(zl))", "description": "", "templateType": "anything", "can_override": false}, "athing": {"name": "athing", "group": "Ungrouped variables", "definition": "'an individual'", "description": "", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Ungrouped variables", "definition": "1-normalcdf(abs(zl),0,1)", "description": "", "templateType": "anything", "can_override": false}, "upper1": {"name": "upper1", "group": "Ungrouped variables", "definition": "zu*s+m", "description": "", "templateType": "anything", "can_override": false}, "s": {"name": "s", "group": "Ungrouped variables", "definition": "random(44..46#0.2)", "description": "", "templateType": "anything", "can_override": false}, "zl": {"name": "zl", "group": "Ungrouped variables", "definition": "random(-2.0..-0.2#0.1)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "precround(u-l,3)", "description": "", "templateType": "anything", "can_override": false}, "lower1": {"name": "lower1", "group": "Ungrouped variables", "definition": "zl*s+m", "description": "", "templateType": "anything", "can_override": false}, "something": {"name": "something", "group": "Ungrouped variables", "definition": "'blood platelet count (measured in thousands per cc of blood)'", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["zl", "lower1", "upper1", "this", "m", "athing", "l", "p", "s", "percentile", "u", "something", "tol", "zu", "perx"], "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": "
What is the probability that {athing} has {this} between $\\var{lower1}$ and $\\var{upper1}$?
\nProbability = ? [[0]] (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": "p-tol", "maxValue": "p+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": "What value of $X$ is equivalent to the $\\var{percentile}$% percentile (i.e. $\\var{percentile}$% of all individuals will have a platelet count below this value)?
\n$\\var{percentile}$% percentile = ?[[0]] (input to 2 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": "perX-0.01", "maxValue": "perX+0.01", "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", "type": "question"}]}], "showQuestionGroupNames": false, "name": "Maria's copy of Foundations of probability", "variable_groups": [], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}