// Numbas version: finer_feedback_settings {"name": "Regression & Correlation ", "feedback": {"allowrevealanswer": true, "showtotalmark": true, "advicethreshold": 0, "intro": "", "feedbackmessages": [], "showanswerstate": true, "showactualmark": true, "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "timing": {"allowPause": true, "timeout": {"action": "warn", "message": "
Your time is up.
"}, "timedwarning": {"action": "warn", "message": "You have 5 minutes left.
"}}, "allQuestions": true, "shuffleQuestions": false, "percentPass": "40", "duration": 0, "pickQuestions": 0, "navigation": {"onleave": {"action": "none", "message": "Please attempt question
"}, "reverse": true, "allowregen": true, "showresultspage": "oncompletion", "preventleave": true, "browse": true, "showfrontpage": true}, "metadata": {"description": "Regression and Correlation. Linear. line of best fit
\nrebel
\nrebelmaths
", "licence": "None specified"}, "type": "exam", "questions": [], "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Summation notation 3", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}], "tags": ["rebel", "Rebel", "REBEL", "rebelmaths", "summation"], "metadata": {"description": "Practice use of summation notation for regression question.
\nrebelmaths
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "The following table lists five pairs of $x$ and $y$ values.
\n$\\mathbf{x}$ | {x1} | {x2} | {x3} | {x4} | {x5} |
---|---|---|---|---|---|
$\\mathbf{y} $ | \n{f1} | \n{f2} | \n{f3} | \n{f4} | \n{f5} | \n
$\\sum x = $ [[0]]
\n$\\sum y = $ [[1]]
\n$\\sum xy = $ [[2]]
\n$\\sum x^2 =$ [[3]]
\n$\\sum y^2 =$[[4]]
", "stepsPenalty": 0, "steps": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "$\\Sigma$ just means 'sum of' or total.
\nFor example:
\n$\\Sigma x$ means add up the $x$ values
\n$\\Sigma y^2 $ means square each of the $y$ values, then add up all the answers.
"}], "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{x1}+{x2}+{x3}+{x4}+{x5}", "maxValue": "{x1}+{x2}+{x3}+{x4}+{x5}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{f1}+{f2}+{f3}+{f4}+{f5}", "maxValue": "{f1}+{f2}+{f3}+{f4}+{f5}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{f1}*{x1}+{f2}*{x2}+{f3}*{x3}+{f4}*{x4}+{f5}*{x5}", "maxValue": "{f1}*{x1}+{f2}*{x2}+{f3}*{x3}+{f4}*{x4}+{f5}*{x5}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{x1}^2+{x2}^2+{x3}^2+{x4}^2+{x5}^2", "maxValue": "{x1}^2+{x2}^2+{x3}^2+{x4}^2+{x5}^2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{f1}^2+{f2}^2+{f3}^2+{f4}^2+{f5}^2", "maxValue": "{f1}^2+{f2}^2+{f3}^2+{f4}^2+{f5}^2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "type": "question"}, {"name": "Regression1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "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": ["cr1", "data analysis", "fitted value", "Rebel", "REBEL", "rebel", "rebelmaths", "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 = a + b 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$a=\\;$[[1]], $b=\\;$[[0]] (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", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "steps": [{"prompt": "
To find $a$ and $b$ you first find $\\displaystyle b = \\frac{n\\Sigma xy-\\Sigma x \\Sigma y}{n\\Sigma x^2 -(\\Sigma x)^2}$
\nThen $\\displaystyle a = \\frac{\\Sigma y - b \\Sigma x}{n}$
\nNow go back and fill in the values for $a$ and $b$.
\nNote that $n$ is the number of data points. In this case $\\var{n}$
\n", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "b+tol", "minValue": "b-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "a+tol", "minValue": "a-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n\t\t\t
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.
\n\t\t\tEnter the predicted Later score here: (to 2 decimal places)
\n\t\t\t \n\t\t\t \n\t\t\t", "allowFractions": false, "variableReplacements": [], "maxValue": "ls+0.01", "minValue": "ls-0.01", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "statement": "\n\tTo 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\tEmployee | $\\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\t$\\var{r1[0]}$ | \n\t$\\var{r1[1]}$ | \n\t$\\var{r1[2]}$ | \n\t$\\var{r1[3]}$ | \n\t$\\var{r1[4]}$ | \n\t$\\var{r1[5]}$ | \n\t$\\var{r1[6]}$ | \n\t$\\var{r1[7]}$ | \n\t
Later Score $(Y)$ | \n\t$\\var{r2[0]}$ | \n\t$\\var{r2[1]}$ | \n\t$\\var{r2[2]}$ | \n\t$\\var{r2[3]}$ | \n\t$\\var{r2[4]}$ | \n\t$\\var{r2[5]}$ | \n\t$\\var{r2[6]}$ | \n\t$\\var{r2[7]}$ | \n\t
Find a regression equation.
\nrebelmaths
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Pearson1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": ["correlation coefficient", "data analysis", "hypothesis testing", "Pearson correlation coefficient", "rebel", "REBEL", "Rebel", "rebelmaths", "statistics"], "metadata": {"description": "Calculate the Pearson correlation coefficient on paired data and comment on the significance.
\nrebelmaths
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "It is well known that similarity in attitudes, beliefs and interests plays an important role in interpersonal attraction. A researcher developed a questionnaire which was completed by 8 married couples. One question sought to place each individual on a 20 point scale in which low scores represent liberal attitudes and high scores represent conservative attitudes. The data were:
\nCouple | $\\var{obj[0]}$ | $\\var{obj[1]}$ | $\\var{obj[2]}$ | $\\var{obj[3]}$ | $\\var{obj[4]}$ | $\\var{obj[5]}$ | $\\var{obj[6]}$ | $\\var{obj[7]}$ |
---|---|---|---|---|---|---|---|---|
Wife $(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
Husband $(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
The answers to all parts are given on revealing.
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variables": {"tsqovern": {"name": "tsqovern", "group": "Ungrouped variables", "definition": "[t[0]^2/n,t[1]^2/n]", "description": "", "templateType": "anything"}, "obj": {"name": "obj", "group": "Ungrouped variables", "definition": "['A','B','C','D','E','F','G','H']", "description": "", "templateType": "anything"}, "r1": {"name": "r1", "group": "Ungrouped variables", "definition": "darr(n,m,[random(1..20)])", "description": "", "templateType": "anything"}, "r2": {"name": "r2", "group": "Ungrouped variables", "definition": "tesarr(r1,darr(n,m,[random(1..m)]),9,m)", "description": "", "templateType": "anything"}, "ss": {"name": "ss", "group": "Ungrouped variables", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "description": "", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "20", "description": "", "templateType": "anything"}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "3", "description": "", "templateType": "anything"}, "ssq": {"name": "ssq", "group": "Ungrouped variables", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "8", "description": "", "templateType": "anything"}, "spcoef": {"name": "spcoef", "group": "Ungrouped variables", "definition": "precround(6*ssd/(n*(n^2-1)),3)", "description": "", "templateType": "anything"}, "corrcoef": {"name": "corrcoef", "group": "Ungrouped variables", "definition": "precround(spxy/sqrt(ss[0]*ss[1]),3)", "description": "", "templateType": "anything"}, "vs": {"name": "vs", "group": "Ungrouped variables", "definition": "switch(spcoef >=0.952,[1,0,0,0,0],spcoef>=0.881,[0,1,0,0,0],spcoef>=0.738,[0,0,1,0,0],spcoef>=0.643,[0,0,0,1,0],[0,0,0,0,1])", "description": "", "templateType": "anything"}, "spxy": {"name": "spxy", "group": "Ungrouped variables", "definition": "sxy-t[0]*t[1]/n", "description": "", "templateType": "anything"}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "[sum(r1),sum(r2)]", "description": "", "templateType": "anything"}, "tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0.01", "description": "", "templateType": "anything"}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "switch(corrcoef >=0.905,[1,0,0,0,0],corrcoef>=0.834,[0,1,0,0,0],corrcoef>=0.707,[0,0,1,0,0],corrcoef>=0.621,[0,0,0,1,0],[0,0,0,0,1])", "description": "", "templateType": "anything"}, "sxy": {"name": "sxy", "group": "Ungrouped variables", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "description": "", "templateType": "anything"}, "ssd": {"name": "ssd", "group": "Ungrouped variables", "definition": "sum(map(x^2,x,d))", "description": "", "templateType": "anything"}, "rr2": {"name": "rr2", "group": "Ungrouped variables", "definition": "rk(r2)", "description": "", "templateType": "anything"}, "rr1": {"name": "rr1", "group": "Ungrouped variables", "definition": "rk(r1)", "description": "", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "list(vector(rr1)-vector(rr2))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["tsqovern", "obj", "r1", "r2", "ss", "m", "k", "ssq", "n", "spcoef", "corrcoef", "vs", "spxy", "t", "tol", "v", "sxy", "ssd", "rr2", "rr1", "d"], "variable_groups": [], "functions": {"darr": {"parameters": [["n", "number"], ["m", "number"], ["a", "list"]], "type": "list", "language": "jme", "definition": "if(n=1,a,darr(n-1,m,[random(1..m except a)]+a))"}, "tesarr": {"parameters": [["a", "list"], ["b", "list"], ["d", "number"], ["m", "number"]], "type": "list", "language": "jme", "definition": "if(marr(map(abs(x),x,list(vector(a)-vector(b))))Wife $(X)$ | \n$\\sum x=\\;$[[0]] | \n$\\sum x^2=\\;$[[1]] | \n
---|---|---|
Husband $(Y)$ | \n$\\sum y=\\;$[[2]] | \n$\\sum y^2=\\;$[[3]] | \n
Also find $\\sum xy=\\;$[[4]].
\nHence calculate the correlation coefficient $r$ correct to 3 decimal places:
\n$r=\\;$[[5]]
\n", "stepsPenalty": 0, "steps": [{"type": "information", "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": "
\\[r=\\frac{n\\Sigma xy -\\Sigma x \\Sigma y}{\\sqrt{n\\Sigma x^2-(\\Sigma x)^2}\\sqrt{n\\Sigma y^2-(\\Sigma y)^2}}\\]
\nNote that $n$ is the number of data points. In this case $\\var{n}$
"}], "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "t[0]", "maxValue": "t[0]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ssq[0]", "maxValue": "ssq[0]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "t[1]", "maxValue": "t[1]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ssq[1]", "maxValue": "ssq[1]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "sxy", "maxValue": "sxy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "corrcoef-tol", "maxValue": "corrcoef+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "SLR and Correlation", "extensions": ["stats", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {"regfun2": {"definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n{boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:false,\n });\n var board = div.board; \n //var n=length(r1);\n //var names = 'ABCDEFGHIJKLMNOP';\nfor (j=0;jAs you alter your line the values for $a$ and $b$ in the equation $Y = a + bX$ will be shown in red below.
\n\nValue of $a$ for interactive line:
\nValue of $b$ for interactive line:
\nThe Sum of the Squares of the Errors (SSE) for the interactive line is :
\nRemember you are trying to make the SSE as small as possible.
\n{regressline(r1,r2,min(r1)-10,max(r1)+10,min(r2)-10,max(r2)+10,n)}
\n\nClick on Show steps if you want to see the minimum value for SSE and the best fitting straight line. There are no marks awarded for this part of the question and you will not lose any marks in subsequent parts by clicking on Show steps.
\n", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "steps": [{"prompt": "\n
The minimum value of the SSE is: {sumr}
\n\n
{regfun3(r1,r2,max(r1)+10,max(r2)+10,rsquared,sumr,n)}</p>
Calculate the equation of the best fitting regression line, $Y = a + bX.$
\nDetermine $a$ and $b$ to 5 decimal places and input them below to 3 decimal places.
\n$a=\\;$[[0]], $b=\\;$[[1]] (both to 3 decimal places.)
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "steps": [{"prompt": "To find $a$ and $b$ you first find $\\displaystyle b = \\frac{n\\Sigma xy-\\Sigma x \\Sigma y}{n\\Sigma x^2 -(\\Sigma x)^2}$
\nThen $\\displaystyle a = \\frac{\\Sigma y - b \\Sigma x}{n}$
\nNote that $n$ is the number of data points. In this case $\\var{n}$
\nNow go back and fill in the values for $a$ and $b$.
\n", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "a+tol", "minValue": "a-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "b+tol", "minValue": "b-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"stepsPenalty": 0, "prompt": "
Calculate the correlation coefficient $r$ to 5 decimal places, then input below to 3 decimal places.
\n
$r=\\;$[[0]], (to 3 decimal places)
\\[r=\\frac{n\\Sigma xy -\\Sigma x \\Sigma y}{\\sqrt{n\\Sigma x^2-(\\Sigma x)^2}\\sqrt{n\\Sigma y^2-(\\Sigma y)^2}}\\]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "corr+tol", "minValue": "corr-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "There are $\\var{n}$ observations of datapoints $(X,Y)$ given in the table below.
\n$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
---|---|---|---|---|---|---|---|---|---|---|
$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
The scatterplot for this data is shown below.
\n\n{regfun2(r1,r2,max(r1)+10,max(r2)+10,rsquared,sumr,n)}
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"ch": {"definition": "random(0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "ch", "description": ""}, "pos": {"definition": "1+ch", "templateType": "anything", "group": "Ungrouped variables", "name": "pos", "description": ""}, "b1": {"definition": "random(-0.45..0.45#0.05)", "templateType": "anything", "group": "Ungrouped variables", "name": "b1", "description": ""}, "sxy": {"definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "templateType": "anything", "group": "Ungrouped variables", "name": "sxy", "description": ""}, "fit": {"definition": "map(precround((a+b*r1[x]),2),x,0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "fit", "description": ""}, "res": {"definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "res", "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.0005", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "a": {"definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "templateType": "anything", "group": "Ungrouped variables", "name": "ssq", "description": ""}, "sumr": {"definition": "precround(sum(map(res[x]^2,x,0..n-1)),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "sumr", "description": ""}, "a1": {"definition": "random(10..20)", "templateType": "anything", "group": "Ungrouped variables", "name": "a1", "description": ""}, "corr": {"definition": "precround(spxy/(sqr(ss[0]*ss[1])),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "corr", "description": ""}, "tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "name": "tsqovern", "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(25,6)),n)", "templateType": "anything", "group": "Ungrouped variables", "name": "r1", "description": ""}, "r2": {"definition": "map(round(a1+b1*x+random(-3..3)),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": ""}, "n": {"definition": "10", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "t": {"definition": "[sum(r1),sum(r2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "sc": {"definition": "r1[ch]", "templateType": "anything", "group": "Ungrouped variables", "name": "sc", "description": ""}, "rsquared": {"definition": "precround(spxy^2/(ss[0]*ss[1]),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "rsquared", "description": ""}}, "metadata": {"description": "For a given set of data points:
\nUse an interactive scatterplot to add best fit line and compare to true regression line via scatterplot solution and given minimum SSE.
\nDetermine values for intercept and slope of least squares regression line.
\nDetermine correlation and r squared value.
\nDetermine prediction and residual at a given X value.
\nrebelmaths
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Regression 3", "extensions": ["jsxgraph", "stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}], "tags": ["correlation", "data analysis", "experiment", "fitted value", "graphical", "interactive", "linear regression", "Rebel", "REBEL", "rebel", "rebelmaths", "regression", "statistics"], "metadata": {"description": "Find a regression equation given 12 months data on temperature and sales of a drink. Includes an interactive diagram for experimenting with fitting a regression line.
\nrebelmaths
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "{owner} owns the {pub}. {owner} believes that sales of {beverage} in the pub are linked to the average monthly temperature, with higher sales being recorded in months with higher temperatures. To investigate, {owner} records the average monthly temperature in the local town over a period of one year ($X$ degrees Celsius), along with total monthly sales of {beverage} ($Y$ hundred euros). The results are shown in the table below:
\nMonth | $\\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]}$ | $\\var{obj[10]}$ | $\\var{obj[11]}$ |
---|---|---|---|---|---|---|---|---|---|---|---|---|
$X$ (temperature) | \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$\\var{r1[10]}$ | \n$\\var{r1[11]}$ | \n
$Y$ (sales, €100s) | \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$\\var{r2[10]}$ | \n$\\var{r2[11]}$ | \n
You are given the following information:
\n$X$ | \n$\\sum x=\\;\\var{t[0]}$ | \n$\\sum x^2=\\;\\var{ssq[0]}$ | \n
---|---|---|
$Y$ | \n$\\sum y=\\;\\var{t[1]}$ | \n$\\sum y^2=\\;\\var{ssq[1]}$ | \n
Also you are given $\\sum xy = \\var{sxy}$.
", "advice": "{regfun(r1,r2,max(r1)+10,max(r2)+10,rsquared,sumr)}
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"ch": {"name": "ch", "group": "Ungrouped variables", "definition": "random(0..11)", "description": "", "templateType": "anything", "can_override": false}, "prediction": {"name": "prediction", "group": "Ungrouped variables", "definition": "round(a+b*thisval)", "description": "", "templateType": "anything", "can_override": false}, "b1": {"name": "b1", "group": "Ungrouped variables", "definition": "random(0.25..0.45#0.05)", "description": "", "templateType": "anything", "can_override": false}, "owner": {"name": "owner", "group": "Ungrouped variables", "definition": "random(\"Kevin\",\"Mary\",\"Bill\",\"Doreen\",\"Peter\",\"Helen\",\"Michael\",\"Samantha\")", "description": "", "templateType": "anything", "can_override": false}, "sxy": {"name": "sxy", "group": "Ungrouped variables", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "description": "", "templateType": "anything", "can_override": false}, "res": {"name": "res", "group": "Ungrouped variables", "definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "description": "", "templateType": "anything", "can_override": false}, "spxy": {"name": "spxy", "group": "Ungrouped variables", "definition": "sxy-t[0]*t[1]/n", "description": "", "templateType": "anything", "can_override": false}, "ls": {"name": "ls", "group": "Ungrouped variables", "definition": "precround(a+b*sc,2)", "description": "", "templateType": "anything", "can_override": false}, "tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0.1", "description": "", "templateType": "anything", "can_override": false}, "tcorr": {"name": "tcorr", "group": "Ungrouped variables", "definition": "spxy/sqrt(ss[0]*ss[1])", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "description": "", "templateType": "anything", "can_override": false}, "ssq": {"name": "ssq", "group": "Ungrouped variables", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "description": "", "templateType": "anything", "can_override": false}, "sumr": {"name": "sumr", "group": "Ungrouped variables", "definition": "precround(sum(map(res[x]^2,x,0..n-1)),3)", "description": "", "templateType": "anything", "can_override": false}, "pub": {"name": "pub", "group": "Ungrouped variables", "definition": "random(\"Black Bull Inn\",\"County Inn\",\"Dog and Duck Pub\",\"Slug and Lettuce Pub\", \"Cross Keys Pub\",\"Newcastle Arms Pub\",\"Red Lion Pub\")", "description": "", "templateType": "anything", "can_override": false}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "random(10..20)", "description": "", "templateType": "anything", "can_override": false}, "thisval": {"name": "thisval", "group": "Ungrouped variables", "definition": "random(15..22)", "description": "", "templateType": "anything", "can_override": false}, "corr": {"name": "corr", "group": "Ungrouped variables", "definition": "precround(tcorr,2)", "description": "", "templateType": "anything", "can_override": false}, "ja": {"name": "ja", "group": "Ungrouped variables", "definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "description": "", "templateType": "anything", "can_override": false}, "jb": {"name": "jb", "group": "Ungrouped variables", "definition": "precround(spxy/ss[0],3)", "description": "", "templateType": "anything", "can_override": false}, "tsqovern": {"name": "tsqovern", "group": "Ungrouped variables", "definition": "[t[0]^2/n,t[1]^2/n]", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "precround(spxy/ss[0],3)", "description": "", "templateType": "anything", "can_override": false}, "obj": {"name": "obj", "group": "Ungrouped variables", "definition": "['Jan','Feb','March','April','May','June','July','August','Sept','Oct','Nov','Dec']", "description": "", "templateType": "anything", "can_override": false}, "r1": {"name": "r1", "group": "Ungrouped variables", "definition": "[random(0..6),random(1..7),random(4..10),random(7..13),random(12..18),random(4..20),random(16..22),random(19..25),random(17..23),random(13..19),random(8..14),random(3..9)]", "description": "", "templateType": "anything", "can_override": false}, "r2": {"name": "r2", "group": "Ungrouped variables", "definition": "map(round(a1+b1*x+random(-9..9)),x,r1)", "description": "", "templateType": "anything", "can_override": false}, "ss": {"name": "ss", "group": "Ungrouped variables", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "description": "", "templateType": "anything", "can_override": false}, "tol2": {"name": "tol2", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything", "can_override": false}, "tol1": {"name": "tol1", "group": "Ungrouped variables", "definition": "0.01", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "12", "description": "", "templateType": "anything", "can_override": false}, "beverage": {"name": "beverage", "group": "Ungrouped variables", "definition": "random(\"home-brewed beer\",\"home-brewed lager\",\"specially-brewed beer\",\"super-strength lager\",\"cold-filtered lager\",\"ice-filtered cider\",\"cherry cider\")", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "[sum(r1),sum(r2)]", "description": "", "templateType": "anything", "can_override": false}, "sc": {"name": "sc", "group": "Ungrouped variables", "definition": "r1[ch]", "description": "", "templateType": "anything", "can_override": false}, "rsquared": {"name": "rsquared", "group": "Ungrouped variables", "definition": "precround(spxy^2/(ss[0]*ss[1]),3)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ch", "prediction", "b1", "owner", "sxy", "res", "spxy", "ls", "tol", "tcorr", "tsqovern", "ssq", "sumr", "thisval", "a1", "pub", "corr", "a", "b", "obj", "r1", "r2", "ss", "tol1", "n", "beverage", "t", "sc", "rsquared", "ja", "jb", "tol2"], "variable_groups": [], "functions": {"regfun": {"parameters": [["r1", "list"], ["r2", "list"], ["maxx", "number"], ["maxy", "number"], ["rsquared", "number"], ["sumr", "number"]], "type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n{boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:true});\n var board = div.board; \nvar l1=board.create('text',[maxx/2,-2,'Temperature']);\nvar l2=board.create('text',[-2,maxy/2,'Sales']);\n var names = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\n for (j=0;j<12;j++){ board.create('point',[r1[j],r2[j]],{fixed:true, style:3, strokecolor:\"#0000a0\", name:'\\['+names[j]+'\\]'})};\nvar regressionPolynomial = JXG.Math.Numerics.regressionPolynomial(1, r1, r2);\nvar reg = board.create('functiongraph',[regressionPolynomial],{strokeColor:'blue',name:'Regression Line.',withLabel:true}); \n //for(var i=0;i<12;i++){board.create(\"segment\",[[r1[i],r2[i]],[r1[i],regressionPolynomial(r1[i])]])};\n\nvar regExpression = regressionPolynomial.getTerm();\nvar regTeX = Numbas.jme.display.exprToLaTeX(regExpression,[],scope);\n\nvar t = board.create('text',[1,5,\nfunction(){ return \"\\\\[r(Y) = \" + regExpression +'\\\\]';}\n],\n{strokeColor:'black',fontSize:18}); \nvar t1 = board.create('text',[5,maxy,\nfunction(){ return \"\\\\[SSE = \" + sumr +'\\\\]';}\n],\n{strokeColor:'black',fontSize:18}); \nvar t2 = board.create('text',[20,maxy,\nfunction(){ return \"\\\\[R^2 = \" + rsquared +'\\\\]';}\n],\n{strokeColor:'black',fontSize:18}); \nreturn div;\n \n"}, "regressline": {"parameters": [["r1", "list"], ["r2", "list"], ["minx", "number"], ["maxx", "number"], ["miny", "number"], ["maxy", "number"]], "type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n{boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:false});\n var board = div.board; \nvar l1=board.create('text',[maxx/2,-2,'Temperature']);\nvar l2=board.create('text',[-2,maxy/2,'Sales']);\nvar names = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\nfor (j=0;j<12;j++){ board.create('point',[r1[j],r2[j]],{fixed:true, style:3,name:'\\['+names[j]+'\\]'})};\nvar a1 = board.create('point',[minx+5,miny+5],{color:'blue'});\nvar b1 = board.create('point',[minx+7,miny+5],{color:'blue'});\nfunction updr(a,b){\n var s=0;\n for(var i=0;i<12;i++){\ns=s+Math.pow(r2[i]-a*r1[i]-b,2);}\nvar html = $(question.display.html);\ns=Numbas.math.niceNumber(Numbas.math.precround(s,2));\nhtml.find('#rsquared').text(s);}\n var li=board.create('line',[a1,b1], {straightFirst:false, straightLast:false});\n var a=0;\n var b=0;\n function dr(p){\n p.on('drag',function(){\n a = Numbas.math.niceNumber((b1.Y()-a1.Y())/(b1.X()-a1.X()));\n b = Numbas.math.niceNumber((a1.Y()*b1.X()-a1.X()*b1.Y())/(b1.X()-a1.X()));\n Numbas.exam.currentQuestion.parts[1].gaps[0].display.studentAnswer(a);\n Numbas.exam.currentQuestion.parts[1].gaps[1].display.studentAnswer(b);\n updr(a,b);\n })};\n dr(a1);\n dr(b1);\n \nreturn div;\n\n \n"}}, "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": "\\[Y = a + b x.\\] Using the least squares method to 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$a=\\;$[[0]] $b=\\;$[[1]], (enter both to 3 decimal places).
", "stepsPenalty": 0, "steps": [{"type": "information", "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": "To find $a$ and $b$ you first find $\\displaystyle b = \\frac{n\\Sigma xy-\\Sigma x \\Sigma y}{n\\Sigma x^2 -(\\Sigma x)^2}$
\nThen $\\displaystyle a = \\frac{\\Sigma y - b \\Sigma x}{n}$
\nNote that $n$ is the number of data points. In this case $\\var{n}$
\nNow go back and fill in the values for $a$ and $b$.
\n"}], "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ja-tol", "maxValue": "ja+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "jb-tol1", "maxValue": "jb+tol1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "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": "
A scatter diagram for the data is plotted below.
\nUsing the equation of the least squares regression line that you found in part (a) plot the line on the diagram below. Find two points on line from the equation and then drag the points A and B to these points.
\n\\[Y = a + b x.\\]
\nThe equation of the line you ploted is
\n$Y=$[[1]]$+$[[0]]$x$
\n\n{regressline(r1,r2,min(r1)-10,max(r1)+10,min(r2)-10,max(r2)+10)}
\nSSE=
\nSSE for fitted regression line: {sumr}
\nThe SSE is displayed which gives an indication of the fit. The nearer the SSE for fitted regression line is the SSE the better.
\n", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "b-tol2", "maxValue": "b+tol2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "a-tol", "maxValue": "a+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "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": "Calculate the coefficient of correlation $r$ for these data:
\n$r=\\;$[[0]] (enter to 2 decimal places).
", "stepsPenalty": 0, "steps": [{"type": "information", "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": "\\[r=\\frac{n\\Sigma xy -\\Sigma x \\Sigma y}{\\sqrt{n\\Sigma x^2-(\\Sigma x)^2}\\sqrt{n\\Sigma y^2-(\\Sigma y)^2}}\\]
"}], "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "corr-tol1", "maxValue": "corr+tol1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "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": "Next month, the average temperature in {owner}'s town is forecast to be {thisval} Celsius. Use the regression equation $Y = a + b x$, with the values of $a$ and $b$ that you calculated in part (a), to predict sales of the {beverage} in that month.
\nWhat is the predicted value of sales (in hundreds of euros) ?
\nUse the values of $a$ and $b$ you input above to 3 decinal places.
\nEnter the predicted sales here: [[0]] (hundreds of euros to the nearest whole number).
\n", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "prediction-1", "maxValue": "prediction+1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}]}], "contributors": [{"name": "Deirdre Casey", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/681/"}], "extensions": ["jsxgraph", "stats"], "custom_part_types": [], "resources": []}