// Numbas version: finer_feedback_settings {"name": "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": [{"tags": [], "preamble": {"css": "", "js": ""}, "variables": {"ss": {"definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "templateType": "anything", "description": "", "name": "ss", "group": "Ungrouped variables"}, "n": {"definition": "8", "templateType": "anything", "description": "", "name": "n", "group": "Ungrouped variables"}, "r2": {"definition": "tesarr(r1,darr(n,m,[random(1..m)]),9,m)", "templateType": "anything", "description": "", "name": "r2", "group": "Ungrouped variables"}, "corrcoef": {"definition": "precround(spxy/sqrt(ss[0]*ss[1]),3)", "templateType": "anything", "description": "", "name": "corrcoef", "group": "Ungrouped variables"}, "obj": {"definition": "['A','B','C','D','E','F','G','H']", "templateType": "anything", "description": "", "name": "obj", "group": "Ungrouped variables"}, "ssd": {"definition": "sum(map(x^2,x,d))", "templateType": "anything", "description": "", "name": "ssd", "group": "Ungrouped variables"}, "m": {"definition": "20", "templateType": "anything", "description": "", "name": "m", "group": "Ungrouped variables"}, "spcoef": {"definition": "precround(6*ssd/(n*(n^2-1)),3)", "templateType": "anything", "description": "", "name": "spcoef", "group": "Ungrouped variables"}, "rr2": {"definition": "rk(r2)", "templateType": "anything", "description": "", "name": "rr2", "group": "Ungrouped variables"}, "rr1": {"definition": "rk(r1)", "templateType": "anything", "description": "", "name": "rr1", "group": "Ungrouped variables"}, "vs": {"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])", "templateType": "anything", "description": "", "name": "vs", "group": "Ungrouped variables"}, "t": {"definition": "[sum(r1),sum(r2)]", "templateType": "anything", "description": "", "name": "t", "group": "Ungrouped variables"}, "v": {"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])", "templateType": "anything", "description": "", "name": "v", "group": "Ungrouped variables"}, "tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "templateType": "anything", "description": "", "name": "tsqovern", "group": "Ungrouped variables"}, "d": {"definition": "list(vector(rr1)-vector(rr2))", "templateType": "anything", "description": "", "name": "d", "group": "Ungrouped variables"}, "sxy": {"definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "templateType": "anything", "description": "", "name": "sxy", "group": "Ungrouped variables"}, "spxy": {"definition": "sxy-t[0]*t[1]/n", "templateType": "anything", "description": "", "name": "spxy", "group": "Ungrouped variables"}, "k": {"definition": "3", "templateType": "anything", "description": "", "name": "k", "group": "Ungrouped variables"}, "r1": {"definition": "darr(n,m,[random(1..20)])", "templateType": "anything", "description": "", "name": "r1", "group": "Ungrouped variables"}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "templateType": "anything", "description": "", "name": "ssq", "group": "Ungrouped variables"}, "tol": {"definition": "0.01", "templateType": "anything", "description": "", "name": "tol", "group": "Ungrouped variables"}}, "name": "Catherine's copy of Pearson1", "advice": "

The answers to all parts are given on revealing.

", "parts": [{"scripts": {}, "variableReplacements": [], "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

 

", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "gaps": [{"correctAnswerFraction": false, "maxValue": "t[0]", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 0.5, "minValue": "t[0]"}, {"correctAnswerFraction": false, "maxValue": "ssq[0]", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 0.5, "minValue": "ssq[0]"}, {"correctAnswerFraction": false, "maxValue": "t[1]", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 0.5, "minValue": "t[1]"}, {"correctAnswerFraction": false, "maxValue": "ssq[1]", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 0.5, "minValue": "ssq[1]"}, {"correctAnswerFraction": false, "maxValue": "sxy", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 0.5, "minValue": "sxy"}, {"correctAnswerFraction": false, "maxValue": "corrcoef+tol", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "showFeedbackIcon": true, "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "correctAnswerStyle": "plain", "marks": 1, "minValue": "corrcoef-tol"}], "marks": 0, "showFeedbackIcon": true}], "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}}\\]

", "functions": {"tesarr": {"language": "jme", "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", "parameters": [["a", "list"]]}, "marr": {"language": "jme", "definition": "if(length(a)=2,max(a[0],a[1]),max(a[0],marr(a[1..length(a)])))", "type": "number", "parameters": [["a", "list"]]}}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "metadata": {"description": "

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

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "extensions": ["stats"], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "type": "question", "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}]}]}], "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}]}