// Numbas version: finer_feedback_settings {"name": "Michael's copy of Matthew James's copy of BES220: Linear regression - find line of best fit given summary statistics,", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"ungrouped_variables": ["tsqovern", "a", "b", "obj", "r1", "r2", "ss", "res", "ssq", "ls", "n", "a1", "ch", "spxy", "t", "tol", "sc", "sxy", "b1"], "variables": {"t": {"name": "t", "definition": "[sum(r1),sum(r2)]", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "tol": {"name": "tol", "definition": "0.001", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "a": {"name": "a", "definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "sc": {"name": "sc", "definition": "r1[ch]", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "sxy": {"name": "sxy", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "r1": {"name": "r1", "definition": "repeat(round(normalsample(67,8)),n)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "n": {"name": "n", "definition": "8", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "b1": {"name": "b1", "definition": "random(0.25..0.45#0.05)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "ssq": {"name": "ssq", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "a1": {"name": "a1", "definition": "random(10..20)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "ss": {"name": "ss", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "ch": {"name": "ch", "definition": "random(0..7)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "tsqovern": {"name": "tsqovern", "definition": "[t[0]^2/n,t[1]^2/n]", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "r2": {"name": "r2", "definition": "map(round(a1+b1*x+random(-9..9)),x,r1)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "obj": {"name": "obj", "definition": "['A','B','C','D','E','F','G','H']", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "res": {"name": "res", "definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "b": {"name": "b", "definition": "precround(spxy/ss[0],3)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "ls": {"name": "ls", "definition": "precround(a+b*sc,2)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "spxy": {"name": "spxy", "definition": "sxy-t[0]*t[1]/n", "description": "", "group": "Ungrouped variables", "templateType": "anything"}}, "functions": {"pstdev": {"parameters": [["l", "list"]], "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "language": "jme", "type": "number"}}, "name": "Michael's copy of Matthew James's copy of BES220: Linear regression - find line of best fit given summary statistics,", "statement": "\n
To monitor its staff appraisal methods, a personnel department compares the results of the tests carried out on employees at their first appraisal with an assessment score of the same individuals two years later. The resulting data are as follows:
\nEmployee | $\\var{obj[0]}$ | $\\var{obj[1]}$ | $\\var{obj[2]}$ | $\\var{obj[3]}$ | $\\var{obj[4]}$ | $\\var{obj[5]}$ | $\\var{obj[6]}$ | $\\var{obj[7]}$ |
---|---|---|---|---|---|---|---|---|
First Test $(X)$ | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n$\\var{r1[6]}$ | \n$\\var{r1[7]}$ | \n
Later Score $(Y)$ | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n$\\var{r2[5]}$ | \n$\\var{r2[6]}$ | \n$\\var{r2[7]}$ | \n
Find a regression equation.
"}, "advice": "", "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"gaps": [{"correctAnswerStyle": "plain", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "marks": 1, "mustBeReducedPC": 0, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "maxValue": "b+tol", "customMarkingAlgorithm": "", "minValue": "b-tol", "mustBeReduced": false, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFraction": false}, {"correctAnswerStyle": "plain", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "marks": 1, "mustBeReducedPC": 0, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "maxValue": "a+tol", "customMarkingAlgorithm": "", "minValue": "a-tol", "mustBeReduced": false, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFraction": false}], "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "marks": 0, "steps": [{"marks": 0, "unitTests": [], "variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "prompt": "To find $\\beta_0$ and $\\beta_1$ you first find $\\displaystyle \\beta_1 = \\frac{SPXY}{SSX}$ where:
\n$\\displaystyle SPXY=\\sum xy - \\frac{(\\sum x)\\times (\\sum y)}{\\var{n}}$
\n$\\displaystyle SSX=\\sum x^2 - \\frac{(\\sum x)^2}{\\var{n}}$
\nThen $\\displaystyle \\beta_0= \\frac{1}{\\var{n}}\\left[\\sum y-\\beta_1 \\sum x\\right]$
\nNow go back and fill in the values for $\\beta_0$ and $\\beta_1$.
\n", "scripts": {}, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "type": "information"}], "stepsPenalty": 0, "customMarkingAlgorithm": "", "prompt": "
Calculate the equation of the best fitting regression line:
\n\\[Y = \\beta_0 + \\beta_1 X.\\] Find $\\beta_0$ and $\\beta_1$ to 5 decimal places, then input them below to 3 decimal places. You will use these approximate values in the rest of the question.
\n$\\beta_1=\\;$[[0]], $\\beta_0=\\;$[[1]] (both to 3 decimal places.)
\nYou are given the following information:
\nFirst Test$(X)$ | \n$\\sum x=\\;\\var{t[0]}$ | \n$\\sum x^2=\\;\\var{ssq[0]}$ | \n
---|---|---|
Later Score$(Y)$ | \n$\\sum y=\\;\\var{t[1]}$ | \n$\\sum y^2=\\;\\var{ssq[1]}$ | \n
Also you are given $\\sum xy = \\var{sxy}$.
\nClick on Show steps if you want more information on calculating $\\beta_0$ and $\\beta_1$. You will not lose any marks by doing so.
\n", "variableReplacements": [], "extendBaseMarkingAlgorithm": true}, {"correctAnswerStyle": "plain", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showFeedbackIcon": true, "prompt": "
What is the predicted Later score for employee $\\var{obj[ch]}$ in the First test?
Use the values of $\\beta_0$ and $\\beta_1$ you input above.
\nEnter the predicted Later score here: (to 2 decimal places)
", "variableReplacementStrategy": "originalfirst", "type": "numberentry", "marks": 1, "mustBeReducedPC": 0, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "maxValue": "ls+0.01", "customMarkingAlgorithm": "", "minValue": "ls-0.01", "mustBeReduced": false, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFraction": false}, {"gaps": [{"correctAnswerStyle": "plain", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "marks": 1, "mustBeReducedPC": 0, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "maxValue": "res[ch]+0.01", "customMarkingAlgorithm": "", "minValue": "res[ch]-0.01", "mustBeReduced": false, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFraction": false}], "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "marks": 0, "steps": [{"marks": 0, "unitTests": [], "variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "prompt": "\nThe residual value is given by:
\nRESIDUAL = OBSERVED - FITTED.
\nIn this case the observed value for $\\var{obj[ch]}$ is $\\var{r2[ch]}$ and you get the fitted value by feeding the First test value $\\var{r1[ch]}$ into the regression equation.
\n\n", "scripts": {}, "variableReplacements": [], "showFeedbackIcon": true, "showCorrectAnswer": true, "type": "information"}], "stepsPenalty": 0, "customMarkingAlgorithm": "", "prompt": "
Use the result above to calculate the residual value for employee $\\var{obj[ch]}$.
\nClick on Show steps to see what is meant by the residual value if you have forgotten. You will not lose any marks by doing so.
\nResidual value = (to 2 decimal places).[[0]]
", "variableReplacements": [], "extendBaseMarkingAlgorithm": true}], "type": "question", "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Matthew James Funnell", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2500/"}]}]}], "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Matthew James Funnell", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2500/"}]}