// Numbas version: finer_feedback_settings {"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, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"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"], "name": "BES220: Linear regression - find line of best fit given summary statistics, ", "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.)
\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", "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}}$
\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", "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?
Use the values of $\\beta_0$ and $\\beta_1$ you input above.
\nEnter 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]}$.
\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]]
", "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": "\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", "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:
\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
21/12/2012:
\nChecked rounding, OK. Added tag cr1.
\nPossible use of scenarios, so added tag sc.
\nThe 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": []}], "contributors": [{"name": "Elias Jakobus Willemse", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/846/"}]}]}], "contributors": [{"name": "Elias Jakobus Willemse", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/846/"}]}