// Numbas version: finer_feedback_settings {"name": "Exam vesrion of Pearson1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "tags": [], "variable_groups": [], "name": "Exam vesrion of Pearson1", "variables": {"corrcoef": {"definition": "precround(spxy/sqrt(ss[0]*ss[1]),3)", "name": "corrcoef", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "rr2": {"definition": "rk(r2)", "name": "rr2", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "tol": {"definition": "0.01", "name": "tol", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "name": "ssq", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "spxy": {"definition": "sxy-t[0]*t[1]/n", "name": "spxy", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "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])", "name": "vs", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "obj": {"definition": "['A','B','C','D','E','F','G','H']", "name": "obj", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "name": "tsqovern", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "t": {"definition": "[sum(r1),sum(r2)]", "name": "t", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "r2": {"definition": "tesarr(r1,darr(n,m,[random(1..m)]),9,m)", "name": "r2", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "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])", "name": "v", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "rr1": {"definition": "rk(r1)", "name": "rr1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "d": {"definition": "list(vector(rr1)-vector(rr2))", "name": "d", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "m": {"definition": "20", "name": "m", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "ssd": {"definition": "sum(map(x^2,x,d))", "name": "ssd", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "spcoef": {"definition": "precround(6*ssd/(n*(n^2-1)),3)", "name": "spcoef", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "ss": {"definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "name": "ss", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "n": {"definition": "8", "name": "n", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "sxy": {"definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "name": "sxy", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "k": {"definition": "3", "name": "k", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "r1": {"definition": "darr(n,m,[random(1..20)])", "name": "r1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "extensions": ["stats"], "functions": {"darr": {"definition": "if(n=1,a,darr(n-1,m,[random(1..m except a)]+a))", "parameters": [["n", "number"], ["m", "number"], ["a", "list"]], "type": "list", "language": "jme"}, "pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "parameters": [["l", "list"]], "type": "number", "language": "jme"}, "marr": {"definition": "if(length(a)=2,max(a[0],a[1]),max(a[0],marr(a[1..length(a)])))", "parameters": [["a", "list"]], "type": "number", "language": "jme"}, "rk": {"definition": "\n\t\t\t /*This gives the ranking of the entries in a, c counts the ties */\n\t\t\t var out = [];\n\t\t\t for(var j=0;ja[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", "parameters": [["a", "list"]], "type": "list", "language": "javascript"}, "tesarr": {"definition": "if(marr(map(abs(x),x,list(vector(a)-vector(b))))The answers to all parts are given on revealing.

", "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:

\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
Couple$\\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)$$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$
Husband $(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

", "parts": [{"marks": 0, "steps": [{"marks": 0, "showCorrectAnswer": true, "scripts": {}, "showFeedbackIcon": true, "variableReplacements": [], "type": "information", "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}}\\]

\n

Note that $n$ is the number of data points. 

", "variableReplacementStrategy": "originalfirst"}], "showCorrectAnswer": true, "scripts": {}, "showFeedbackIcon": true, "variableReplacements": [], "type": "gapfill", "prompt": "\n\n\n\n\n\n\n\n\n\n\n
Wife $(X)$$\\sum x=\\;$[[0]]$\\sum x^2=\\;$[[1]]
Husband $(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

 

", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "t[0]", "minValue": "t[0]", "marks": "1", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "ssq[0]", "minValue": "ssq[0]", "marks": "1", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "t[1]", "minValue": "t[1]", "marks": "1", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "ssq[1]", "minValue": "ssq[1]", "marks": "1", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "sxy", "minValue": "sxy", "marks": "1", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "maxValue": "corrcoef+tol", "minValue": "corrcoef-tol", "marks": "2", "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst"}], "variableReplacementStrategy": "originalfirst", "stepsPenalty": 0}], "preamble": {"js": "", "css": ""}, "metadata": {"description": "

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

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}