// Numbas version: finer_feedback_settings {"name": "Michael's copy of Catherine's copy of Pearson1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "tags": [], "variables": {"r1": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "darr(n,m,[random(1..20)])", "name": "r1"}, "sxy": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "name": "sxy"}, "tsqovern": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "[t[0]^2/n,t[1]^2/n]", "name": "tsqovern"}, "spcoef": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "precround(6*ssd/(n*(n^2-1)),3)", "name": "spcoef"}, "spxy": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "sxy-t[0]*t[1]/n", "name": "spxy"}, "corrcoef": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "precround(spxy/sqrt(ss[0]*ss[1]),3)", "name": "corrcoef"}, "ssq": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "name": "ssq"}, "vs": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "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])", "name": "vs"}, "ssd": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "sum(map(x^2,x,d))", "name": "ssd"}, "rr2": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "rk(r2)", "name": "rr2"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "[sum(r1),sum(r2)]", "name": "t"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "8", "name": "n"}, "ss": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "name": "ss"}, "obj": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "['A','B','C','D','E','F','G','H']", "name": "obj"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "20", "name": "m"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "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])", "name": "v"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "list(vector(rr1)-vector(rr2))", "name": "d"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "0.01", "name": "tol"}, "rr1": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "rk(r1)", "name": "rr1"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "3", "name": "k"}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "definition": "tesarr(r1,darr(n,m,[random(1..m)]),9,m)", "name": "r2"}}, "ungrouped_variables": ["tsqovern", "obj", "r1", "r2", "ss", "m", "k", "ssq", "n", "spcoef", "corrcoef", "vs", "spxy", "t", "tol", "v", "sxy", "ssd", "rr2", "rr1", "d"], "statement": "

The data presented in the table below shows the annual promotional expenditure (€000s) and corresponding sales figures (000s units) for eight small businesses.

\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
Business$\\var{obj[0]}$$\\var{obj[1]}$$\\var{obj[2]}$$\\var{obj[3]}$$\\var{obj[4]}$$\\var{obj[5]}$$\\var{obj[6]}$$\\var{obj[7]}$
Expenditure $(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]}$
Sales $(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

\\[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}}\\]

", "extensions": ["stats"], "advice": "

The answers to all parts are given on revealing.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"js": "", "css": ""}, "functions": {"pstdev": {"language": "jme", "parameters": [["l", "list"]], "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number"}, "tesarr": {"language": "jme", "parameters": [["a", "list"], ["b", "list"], ["d", "number"], ["m", "number"]], "definition": "if(marr(map(abs(x),x,list(vector(a)-vector(b))))a[i]){s+=1;}\n\t\t\t else\n\t\t\t if(a[j]==a[i]){c+=1;}\n\t\t\t }\n\t\t\t out[j]=(2*s+c+1)/2;\n\t\t\t }\n\t\t\t return out;\n\t\t\t \n\t\t\t", "type": "list"}, "darr": {"language": "jme", "parameters": [["n", "number"], ["m", "number"], ["a", "list"]], "definition": "if(n=1,a,darr(n-1,m,[random(1..m except a)]+a))", "type": "list"}, "marr": {"language": "jme", "parameters": [["a", "list"]], "definition": "if(length(a)=2,max(a[0],a[1]),max(a[0],marr(a[1..length(a)])))", "type": "number"}}, "parts": [{"variableReplacements": [], "gaps": [{"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "t[0]", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "t[0]", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "type": "numberentry"}, {"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "ssq[0]", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "ssq[0]", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "type": "numberentry"}, {"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "t[1]", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "t[1]", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "type": "numberentry"}, {"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "ssq[1]", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "ssq[1]", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "type": "numberentry"}, {"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "sxy", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "sxy", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "type": "numberentry"}, {"allowFractions": false, "correctAnswerStyle": "plain", "scripts": {}, "maxValue": "corrcoef+tol", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "minValue": "corrcoef-tol", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "type": "numberentry"}], "showCorrectAnswer": true, "prompt": "

\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Expenditure $(X)$$\\sum x=\\;$[[0]]$\\sum x^2=\\;$[[1]]
Sales $(Y)$$\\sum y=\\;$[[2]]$\\sum y^2=\\;$[[3]]
\n

Also find $\\sum xy=\\;$[[4]]. 

\n

Hence calculate the correlation coefficient $r$ correct to 3 decimal places:

\n

$r=\\;$[[5]]

\n

 

", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill"}], "name": "Michael's copy of Catherine's copy of Pearson1", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Calculate the Pearson correlation coefficient on paired data and comment on the significance.

\n

rebelmaths

"}, "type": "question", "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}]}]}], "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}]}