// Numbas version: exam_results_page_options {"name": "Regression 1", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Regression 1", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

A manufacturing plant produces plastic pellets. To improve the efficiency of approximate stock checks, the manager wants to be able to estimate how many pellets are left in partially full containers. A random sample of 12 partially full containers is taken and each container is weighed and the corresponding number of pellets counted. The results are shown in the table below:

\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\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\n\n\n\n\n\n
Weight of container and pellets ($x$) gNumber of counted pellets ($y$)
1580
20100
20110
25130
25140
25160
30170
35200
35210
40210
40230
40240
", "advice": "

Part (a)

\n

To calculate the regression line $y=a+bx$ we need to calculate $a$ and $b$, where

\n

\\[ b = \\frac{\\frac{\\sum{xy}}{n}-\\frac{\\sum{x}}{n}\\frac{\\sum{y}}{n}}{\\frac{\\sum{x^2}}{n}-\\left(\\frac{\\sum{x}}{n}\\right)^2} \\quad \\text{and} \\quad a = \\bar{y}-b \\bar{x}. \\]

\n

From the table, we find

\n

\\[ \\sum{x} = \\var{sumx}, \\quad \\sum{y} = \\var{sumy}, \\quad \\sum{x^2}=\\var{sumx2}, \\quad \\sum{xy} = \\var{sumxy}.\\]

\n

Plugging these values into the formulae for $a$ and $b$, we find that $a=\\var{a}$ and $b=\\var{b}$. Therefore, the least squares regression line is \\[ y = \\simplify{{b}x+{a}}.\\]

\n

\n

Part (b)

\n

Using the result from Part (a), the predicted number of pellets are

\n

\\[ \\begin{split} \\text{(i)}\\,\\,y_{\\var{num1}} &\\,= \\var{b} \\times \\var{num1} - \\var{-a} = \\var{sol1}; \\\\ \\text{(ii)}\\,\\, y_{\\var{num2}} &\\,= \\var{b} \\times \\var{num2} - \\var{-a} = \\var{sol2}; \\\\ \\text{(iii)}\\,\\, y_{\\var{num3}} &\\,= \\var{b} \\times \\var{num3} - \\var{-a} = \\var{sol3}. \\end{split} \\]

\n

\n

Note: For the final result, we have assumed that a linear relationship continues beyond the range of values taken.

", "rulesets": {}, "extensions": [], "variables": {"sumx": {"name": "sumx", "group": "Ungrouped variables", "definition": "350", "description": "", "templateType": "anything"}, "sumx2": {"name": "sumx2", "group": "Ungrouped variables", "definition": "11050", "description": "", "templateType": "anything"}, "sumy": {"name": "sumy", "group": "Ungrouped variables", "definition": "1980", "description": "", "templateType": "anything"}, "sumxy": {"name": "sumxy", "group": "Ungrouped variables", "definition": "62800", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "(sumxy/12-(sumx/12)*(sumy/12))/(sumx2/12-(sumx/12)^2)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "sumy/12-b*sumx/12", "description": "", "templateType": "anything"}, "num1": {"name": "num1", "group": "Ungrouped variables", "definition": "random(17..22 except 20)", "description": "", "templateType": "anything"}, "num2": {"name": "num2", "group": "Ungrouped variables", "definition": "random(27..38 except [30,35])", "description": "", "templateType": "anything"}, "num3": {"name": "num3", "group": "Ungrouped variables", "definition": "random(43..50)", "description": "", "templateType": "anything"}, "sol1": {"name": "sol1", "group": "Ungrouped variables", "definition": "b*num1+a", "description": "", "templateType": "anything"}, "sol2": {"name": "sol2", "group": "Ungrouped variables", "definition": "b*num2+a", "description": "", "templateType": "anything"}, "sol3": {"name": "sol3", "group": "Ungrouped variables", "definition": "b*num3+a", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["sumx", "sumx2", "sumy", "sumxy", "b", "a", "num1", "num2", "num3", "sol1", "sol2", "sol3"], "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": "

Find the least-squares regression line in the form $y = mx+c$.

\n

\n

$y=$[[0]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{b}x+{a}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "x", "value": ""}]}], "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": "

Use your answer from Part (a) to predict the number of pellets left in containers whose weights are 

\n

(i) $\\var{num1}g\\quad$ (ii) $\\var{num2}g \\quad$ (iii) $\\var{num3}g$.

\n

\\[\\]

\n

(i)[[0]]    (ii)[[1]]    (iii)[[2]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{sol1}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{sol2}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{sol3}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}