// Numbas version: finer_feedback_settings {"name": "Maths Support: Linear regression", "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "preventleave": false, "browse": true, "showfrontpage": false, "showresultspage": "never"}, "duration": 0.0, "metadata": {"notes": "", "description": "
Statistics and probability. 2 questions. Both simple regression. First with 8 data points, second with 10. Find $a$ and $b$ such that $Y=a+bX$. Then find the residual value for one of the data points.
", "licence": "Creative Commons Attribution 4.0 International"}, "timing": {"timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "shufflequestions": false, "questions": [], "percentpass": 0.0, "allQuestions": true, "pickQuestions": 0, "type": "exam", "feedback": {"showtotalmark": true, "advicethreshold": 0.0, "showanswerstate": true, "showactualmark": true, "allowrevealanswer": true, "enterreviewmodeimmediately": false, "showexpectedanswerswhen": "never", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Regression1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "language": "jme", "parameters": [["l", "list"]]}}, "tags": ["cr1", "data analysis", "fitted value", "regression", "residual value", "sc", "statistics"], "advice": "", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"stepspenalty": 0.0, "prompt": "\nCalculate the equation of the best fitting regression line:
\n\\[Y = a + b \\times X.\\] Find $a$ and $b$ 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$b=\\;$[[0]], $a=\\;$[[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 $a$ and $b$. You will not lose any marks by doing so.
\n\n ", "gaps": [{"minvalue": "b-tol", "type": "numberentry", "maxvalue": "b+tol", "marks": 1.0, "showPrecisionHint": false}, {"minvalue": "a-tol", "type": "numberentry", "maxvalue": "a+tol", "marks": 1.0, "showPrecisionHint": false}], "steps": [{"prompt": "\n
To find $a$ and $b$ you first find $\\displaystyle b = \\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 a = \\frac{1}{\\var{n}}\\left[\\sum y-b \\sum x\\right]$
\nNow go back and fill in the values for $a$ and $b$.
\n\n ", "type": "information", "marks": 0.0}], "marks": 0.0, "type": "gapfill"}, {"prompt": "\n
What is the predicted Later score for employee $\\var{obj[ch]}$ in the First test?
Use the values of $a$ and $b$ you input above.
\nEnter the predicted Later score here: (to 2 decimal places)
\n ", "minvalue": "ls-0.01", "type": "numberentry", "maxvalue": "ls+0.01", "marks": 1.0, "showPrecisionHint": false}, {"stepspenalty": 0.0, "prompt": "\nUse 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]]
\n ", "gaps": [{"minvalue": "res[ch]-0.01", "type": "numberentry", "maxvalue": "res[ch]+0.01", "marks": 1.0, "showPrecisionHint": false}], "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 \n ", "type": "information", "marks": 0.0}], "marks": 0.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).
\n26/01/2013:
\nNo advice as yet.
\n", "description": "
Find a regression equation.
", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Regression2", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "language": "jme", "parameters": [["l", "list"]]}}, "tags": ["chain rule", "fitted value", "regression", "residual value", "statistics"], "advice": "", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"stepspenalty": 0.0, "prompt": "\nCalculate the equation of the best fitting regression line:
\n\\[Y = a + b \\times X.\\] Find $a$ and $b$ 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$b=\\;$[[0]], $a=\\;$[[1]] (enter 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 $a$ and $b$. You will not lose any marks by doing so.
\n\n ", "gaps": [{"minvalue": "b-tol", "type": "numberentry", "maxvalue": "b+tol", "marks": 1.0, "showPrecisionHint": false}, {"minvalue": "a-tol", "type": "numberentry", "maxvalue": "a+tol", "marks": 1.0, "showPrecisionHint": false}], "steps": [{"prompt": "\n
To find $a$ and $b$ you first find $\\displaystyle b = \\frac{SPXY}{SSX}$ where:
\n$\\displaystyle SPXY=\\sum xy - \\frac{(\\sum x)\\times (\\sum y)}{10}$
\n$\\displaystyle SSX=\\sum x^2 - \\frac{(\\sum x)^2}{10}$
\nThen $\\displaystyle a = \\frac{1}{10}\\left[\\sum y-b \\sum x\\right]$
\nNow go back and fill in the values for $a$ and $b$.
\n ", "type": "information", "marks": 0.0}], "marks": 0.0, "type": "gapfill"}, {"prompt": "\nWhat is the predicted Later score for employee $\\var{obj[ch]}$?
Use the values of $a$ and $b$ you input above.
\nEnter the predicted Later score here: (to 2 decimal places)
\n ", "minvalue": "ls-0.01", "type": "numberentry", "maxvalue": "ls+0.01", "marks": 1.0, "showPrecisionHint": false}, {"stepspenalty": 0.0, "prompt": "\nUse 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]]
\n ", "gaps": [{"minvalue": "res[ch]-0.01", "type": "numberentry", "maxvalue": "res[ch]+0.01", "marks": 1.0, "showPrecisionHint": false}], "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", "marks": 0.0}], "marks": 0.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]}$ | $\\var{obj[8]}$ | $\\var{obj[9]}$ |
---|---|---|---|---|---|---|---|---|---|---|
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$\\var{r1[8]}$ | \n$\\var{r1[9]}$ | \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$\\var{r2[8]}$ | \n$\\var{r2[9]}$ | \n
30/09/2102:
\nIntroduced three functions:
\n1. To produce the ranking of a list of 8 numbers.
\n2. To produce a list of 8 numbers from a scale of 1..20 which are all distinct.
\n3. To produce the maximum of the numbers in a list.
\n4. Given an array such as in 2. to find another such array which has max diff between any two corresponding entries less than a given number. This is to ensure that the two array produced do not differ too much, as the point of the exercise is to show that there is a positive high correlation.
\n26/01/2013:
\n
No advice as yet.
01/11/2013:
\n
Changed definition of the variable a so that it does not use the rounded value of b.
Find a regression equation.
", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}