// Numbas version: exam_results_page_options {"shuffleQuestions": false, "questions": [], "type": "exam", "name": "Regression for psychology", "feedback": {"showtotalmark": true, "showanswerstate": true, "advicethreshold": 0, "allowrevealanswer": true, "showactualmark": true}, "metadata": {"notes": "", "description": ""}, "percentPass": 0, "allQuestions": true, "pickQuestions": 0, "showQuestionGroupNames": false, "duration": 0, "question_groups": [{"name": "", "pickQuestions": 0, "questions": [{"name": "Stephanie's copy of Pearson1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "functions": {"darr": {"definition": "if(n=1,a,darr(n-1,m,[random(1..m except a)]+a))", "type": "list", "language": "jme", "parameters": [["n", "number"], ["m", "number"], ["a", "list"]]}, "rk": {"definition": "\n /*This gives the ranking of the entries in a, c counts the ties */\n var out = [];\n for(var j=0;ja[i]){s+=1;}\n else\n if(a[j]==a[i]){c+=1;}\n }\n out[j]=(2*s+c+1)/2;\n }\n return out;\n ", "type": "list", "language": "javascript", "parameters": [["a", "list"]]}, "pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "language": "jme", "parameters": [["l", "list"]]}, "marr": {"definition": "if(length(a)=2,max(a[0],a[1]),max(a[0],marr(a[1..length(a)])))", "type": "number", "language": "jme", "parameters": [["a", "list"]]}, "tesarr": {"definition": "if(marr(map(abs(x),x,list(vector(a)-vector(b))))The answers to all parts are given on revealing.

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"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]] and then:

\n

$\\displaystyle \\sum(x_i-\\bar{x})^2 = \\;$[[5]]

\n

$\\displaystyle \\sum(y_i-\\bar{y})^2= \\;$[[6]]

\n

$\\displaystyle \\sum(x_iy_i -n\\bar{x}\\bar{y})= \\;$[[7]]

\n

Hence calculate the correlation coefficient $r$:

\n

$r=\\;$[[8]]

\n

 

", "marks": 0, "gaps": [{"marks": 0.5, "maxValue": "t[0]", "minValue": "t[0]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "ssq[0]", "minValue": "ssq[0]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "t[1]", "minValue": "t[1]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "ssq[1]", "minValue": "ssq[1]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "sxy", "minValue": "sxy", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "ss[0]", "minValue": "ss[0]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "ss[1]", "minValue": "ss[1]", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 0.5, "maxValue": "spxy", "minValue": "spxy", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": 1, "maxValue": "corrcoef+tol", "minValue": "corrcoef-tol", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n

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

In this exercise you will find the Pearson correlation coefficent for the above paired data and comment on the significance of the calculated correlation.

\n

The null hypothesis you are testing is:

\n

$H_0$: There is no association between the attitudes of wives and husbands.

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

30/09/2102:

\n

Introduced three functions:

\n

1. To produce the ranking of a list of 8 numbers.

\n

2. To produce a list of 8 numbers from a scale of 1..20 which are all distinct.

\n

3. To produce the maximum of the numbers in a list.

\n

4. Given an array such as in 2. to find another such array which has max diff between any two corresponding entries less than a given number. This is to ensure that the two array produced do not differ too much, as the point of the exercise is to show that there is a positive high correlation.

\n

 26/01/2013:

\n

No advice as yet.

", "description": "

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

"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}], "pickingStrategy": "all-ordered"}], "navigation": {"browse": true, "showfrontpage": true, "preventleave": true, "onleave": {"message": "", "action": "none"}, "reverse": true, "allowregen": true, "showresultspage": "never"}, "timing": {"timedwarning": {"message": "", "action": "none"}, "timeout": {"message": "", "action": "none"}, "allowPause": true}, "contributors": [{"name": "Stephanie Greaves", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/340/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}