// Numbas version: exam_results_page_options {"name": "test-test", "timing": {"allowPause": true, "timedwarning": {"action": "none", "message": ""}, "timeout": {"action": "none", "message": ""}}, "duration": 0, "question_groups": [{"pickingStrategy": "all-ordered", "name": "Group", "pickQuestions": 1, "questions": [{"name": "BES220: Linear regression - find line of best fit given summary statistics, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Elias Jakobus Willemse", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/846/"}], "functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "language": "jme", "parameters": [["l", "list"]]}}, "ungrouped_variables": ["tsqovern", "a", "b", "obj", "r1", "r2", "ss", "res", "ssq", "ls", "n", "a1", "ch", "spxy", "t", "tol", "sc", "sxy", "b1"], "tags": ["ACE2013", "checked2015", "cr1", "data analysis", "fitted value", "PSY2010", "regression", "residual value", "sc", "statistics"], "preamble": {"css": "", "js": ""}, "advice": "", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"stepsPenalty": 0, "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.)

\n

You are given the following information:

\n\n\n\n\n\n\n\n\n\n\n\n
First Test$(X)$ Later Score$(Y)$ $\\sum x=\\;\\var{t[0]}$ $\\sum x^2=\\;\\var{ssq[0]}$ $\\sum y=\\;\\var{t[1]}$ $\\sum y^2=\\;\\var{ssq[1]}$
\n

Also you are given $\\sum xy = \\var{sxy}$.

\n

Click 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

", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1, "maxValue": "b+tol", "minValue": "b-tol", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "showPrecisionHint": false, "type": "numberentry"}, {"allowFractions": false, "marks": 1, "maxValue": "a+tol", "minValue": "a-tol", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "showPrecisionHint": false, "type": "numberentry"}], "showCorrectAnswer": true, "scripts": {}, "steps": [{"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}}$

\n

Then $\\displaystyle \\beta_0= \\frac{1}{\\var{n}}\\left[\\sum y-\\beta_1 \\sum x\\right]$

\n

Now go back and fill in the values for $\\beta_0$ and $\\beta_1$.

\n

", "type": "information", "scripts": {}, "showCorrectAnswer": true, "marks": 0}], "type": "gapfill"}, {"prompt": "

What is the predicted Later score for employee $\\var{obj[ch]}$ in the First test?

\n

Use the values of $\\beta_0$ and $\\beta_1$ you input above.

\n

Enter the predicted Later score here: (to 2 decimal places)

", "allowFractions": false, "marks": 1, "maxValue": "ls+0.01", "minValue": "ls-0.01", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "showPrecisionHint": false, "type": "numberentry"}, {"stepsPenalty": 0, "prompt": "

Use the result above to calculate the residual value for employee $\\var{obj[ch]}$.

\n

Click 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.

\n

Residual value =  (to 2 decimal places).[[0]]

", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1, "maxValue": "res[ch]+0.01", "minValue": "res[ch]-0.01", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "showPrecisionHint": false, "type": "numberentry"}], "showCorrectAnswer": true, "scripts": {}, "steps": [{"prompt": "\n

The residual value is given by:

\n

RESIDUAL = OBSERVED - FITTED.

\n

In 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", "type": "information", "scripts": {}, "showCorrectAnswer": true, "marks": 0}], "type": "gapfill"}], "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:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Employee$\\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)$$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]} Later Score (Y)$$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$
\n\n", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "variables": {"tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "name": "tsqovern", "description": ""}, "a": {"definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "precround(spxy/ss[0],3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "obj": {"definition": "['A','B','C','D','E','F','G','H']", "templateType": "anything", "group": "Ungrouped variables", "name": "obj", "description": ""}, "r1": {"definition": "repeat(round(normalsample(67,8)),n)", "templateType": "anything", "group": "Ungrouped variables", "name": "r1", "description": ""}, "r2": {"definition": "map(round(a1+b1*x+random(-9..9)),x,r1)", "templateType": "anything", "group": "Ungrouped variables", "name": "r2", "description": ""}, "ss": {"definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "name": "ss", "description": ""}, "res": {"definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "res", "description": ""}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "templateType": "anything", "group": "Ungrouped variables", "name": "ssq", "description": ""}, "n": {"definition": "8", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "a1": {"definition": "random(10..20)", "templateType": "anything", "group": "Ungrouped variables", "name": "a1", "description": ""}, "ch": {"definition": "random(0..7)", "templateType": "anything", "group": "Ungrouped variables", "name": "ch", "description": ""}, "spxy": {"definition": "sxy-t[0]*t[1]/n", "templateType": "anything", "group": "Ungrouped variables", "name": "spxy", "description": ""}, "ls": {"definition": "precround(a+b*sc,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "ls", "description": ""}, "tol": {"definition": "0.001", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "sc": {"definition": "r1[ch]", "templateType": "anything", "group": "Ungrouped variables", "name": "sc", "description": ""}, "sxy": {"definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "templateType": "anything", "group": "Ungrouped variables", "name": "sxy", "description": ""}, "b1": {"definition": "random(0.25..0.45#0.05)", "templateType": "anything", "group": "Ungrouped variables", "name": "b1", "description": ""}, "t": {"definition": "[sum(r1),sum(r2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}}, "metadata": {"notes": "

21/12/2012:

\n

Checked rounding, OK. Added tag cr1.

\n

Possible use of scenarios, so added tag sc.

\n

The array r2 generates the regression data which has an inbuilt noise via r1[x]+random(-9..9).

\n

", "description": "

Find a regression equation.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "showstudentname": true, "metadata": {"licence": "None specified", "description": ""}, "showQuestionGroupNames": false, "navigation": {"showresultspage": "oncompletion", "reverse": true, "browse": true, "allowregen": true, "showfrontpage": true, "onleave": {"action": "warnifunattempted", "message": "

Warning - question not attempted.

"}, "preventleave": true}, "feedback": {"feedbackmessages": [], "advicethreshold": 0, "showtotalmark": true, "allowrevealanswer": true, "showactualmark": true, "showanswerstate": true, "intro": ""}, "percentPass": 0, "type": "exam", "contributors": [{"name": "Matthew James Funnell", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2500/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}