// Numbas version: finer_feedback_settings {"name": "Calculating the Spearman rank correlation coefficient and p-value", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

A researcher has developed a questionnaire, which has been completed by 8 married couples (A-H), to find out how interest in sports plays a role in interpersonal attraction. The questions sought to place each partner in the marriage on a 20 point scale in which low scores represent little interest in sports, and high scores represent very interested in sports.

\n

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\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]}$
Partner $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]}$
Partner $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 Spearman's correlation coefficient for this data and test it's significance in order to test the following null hypothesis:

\n

\\[ H_0: \\text{There is no association between the attitudes of wives and husbands.} \\]

", "variables": {"n": {"definition": "8", "templateType": "anything", "group": "Data given in question", "name": "n", "description": ""}, "one": {"definition": "0.881", "templateType": "anything", "group": "Critical values of the spearman correlation coefficient", "name": "one", "description": ""}, "ss": {"definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "name": "ss", "description": ""}, "m": {"definition": "20", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "rr1": {"definition": "rk(r1)", "templateType": "anything", "group": "Ranking the data", "name": "rr1", "description": ""}, "d": {"definition": "list(vector(rr1)-vector(rr2))", "templateType": "anything", "group": "Spearman correlation coeffcient", "name": "d", "description": "

Difference between wife and husband's score.

"}, "r1": {"definition": "darr(n,m,[random(1..20)])", "templateType": "anything", "group": "Data given in question", "name": "r1", "description": "

The wife's data

"}, "vs": {"definition": "switch(aspcoef >=0.952,[1,0,0,0,0],aspcoef>=0.881,[0,1,0,0,0],aspcoef>=0.738,[0,0,1,0,0],aspcoef>=0.643,[0,0,0,1,0],[0,0,0,0,1])", "templateType": "anything", "group": "Spearman correlation coeffcient", "name": "vs", "description": ""}, "r2": {"definition": "tesarr(r1,darr(n,m,[random(1..m)]),10,m)", "templateType": "anything", "group": "Data given in question", "name": "r2", "description": "

Husband's data

"}, "five": {"definition": "0.738", "templateType": "anything", "group": "Critical values of the spearman correlation coefficient", "name": "five", "description": ""}, "spcoef": {"definition": "precround(1-6*ssd/(n*(n^2-1)),3)", "templateType": "anything", "group": "Spearman correlation coeffcient", "name": "spcoef", "description": "

Spearman correlation coefficient

"}, "aspcoef": {"definition": "abs(spcoef)", "templateType": "anything", "group": "Spearman correlation coeffcient", "name": "aspcoef", "description": "

Absolute value of the spearman correlation coefficient

"}, "tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "name": "tsqovern", "description": ""}, "ssd": {"definition": "sum(map(x^2,x,d))", "templateType": "anything", "group": "Spearman correlation coeffcient", "name": "ssd", "description": "

The difference between the wife's and husband's score.

"}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "templateType": "anything", "group": "Ungrouped variables", "name": "ssq", "description": ""}, "ten": {"definition": "0.643", "templateType": "anything", "group": "Critical values of the spearman correlation coefficient", "name": "ten", "description": ""}, "rr2": {"definition": "rk(r2)", "templateType": "anything", "group": "Ranking the data", "name": "rr2", "description": ""}, "t": {"definition": "[sum(r1),sum(r2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "point2": {"definition": "0.952", "templateType": "anything", "group": "Critical values of the spearman correlation coefficient", "name": "point2", "description": ""}, "obj": {"definition": "['A','B','C','D','E','F','G','H']", "templateType": "anything", "group": "Data given in question", "name": "obj", "description": ""}}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "name": "Calculating the Spearman rank correlation coefficient and p-value", "parts": [{"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "sortAnswers": false, "customMarkingAlgorithm": "", "variableReplacements": [], "gaps": [{"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[0]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[0]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[1]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[1]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[2]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[2]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[3]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[3]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[4]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[4]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[5]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[5]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[6]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[6]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr1[7]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr1[7]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[0]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[0]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[1]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[1]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[2]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[2]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[3]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[3]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[4]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[4]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[5]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[5]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[6]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[6]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "rr2[7]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "rr2[7]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[0]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[0]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[1]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[1]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[2]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[2]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[3]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[3]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[4]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[4]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[5]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[5]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[6]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[6]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.125, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "d[7]", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "d[7]", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}], "prompt": "

To find the Spearman correlation coefficient for the original score data, you need to rank the data, the lowest rank has rank $1$ and the highest score has rank $8$.

\n

Also calculate the differences in the ranks, i.e. for each couple calculate

\n

\\[  d_i = (\\text{partner X score}) - (\\text{partner Y score}).\\]

\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\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]}$
Partner $X$[[0]][[1]][[2]][[3]][[4]][[5]][[6]][[7]]
Partner $Y$[[8]][[9]][[10]][[11]][[12]][[13]][[14]][[15]]
Differences $(d_i)$[[16]][[17]][[18]][[19]][[20]][[21]][[22]][[23]]
", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "steps": [{"type": "information", "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "customMarkingAlgorithm": "", "variableReplacements": [], "prompt": "

If there are two sets of ranks $x_1,x_2,\\ldots,x_n$ and  $y_1,y_2,\\ldots,y_n$ where both sets have no ties, and differences are $d_i=x_i-y_i$ then if $\\sum d_i^2=D$ we have:

\n

\\[r_s=1 - \\frac{6 \\times D}{n(n^2-1)}\\]

", "extendBaseMarkingAlgorithm": true}], "sortAnswers": false, "customMarkingAlgorithm": "", "variableReplacements": [], "stepsPenalty": 0, "prompt": "

Hence calculate the Spearman correlation coefficient:

\n

$r_s=\\;$ [[0]]

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "gaps": [{"mustBeReduced": false, "allowFractions": false, "showCorrectAnswer": true, "scripts": {}, "correctAnswerStyle": "plain", "precisionMessage": "You have not given your answer to the correct precision.", "customMarkingAlgorithm": "", "precision": "3", "minValue": "spcoef", "showPrecisionHint": true, "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "extendBaseMarkingAlgorithm": true, "type": "numberentry", "marks": "2", "unitTests": [], "mustBeReducedPC": 0, "precisionType": "dp", "variableReplacements": [], "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "maxValue": "spcoef", "correctAnswerFraction": false}], "extendBaseMarkingAlgorithm": true}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "sortAnswers": false, "customMarkingAlgorithm": "", "variableReplacements": [], "gaps": [{"type": "numberentry", "mustBeReduced": false, "marks": 1, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "n", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "n", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}], "prompt": "

State the degrees of freedom of the significance test.

\n

[[0]]

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true}, {"type": "gapfill", "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "sortAnswers": false, "customMarkingAlgorithm": "", "variableReplacements": [], "gaps": [{"type": "numberentry", "mustBeReduced": false, "marks": 0.25, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "ten", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "ten", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.25, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "five", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "five", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.25, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "one", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "one", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}, {"type": "numberentry", "mustBeReduced": false, "marks": 0.25, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "allowFractions": false, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "minValue": "point2", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "maxValue": "point2", "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "correctAnswerStyle": "plain"}], "prompt": "

Using the rounded value of the Spearman correlation coefficient that you have found, find the the significance level by looking up the critical values in a table. 

\n

Input the table values in the table below:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$10\\%$$5\\%$$1\\%$$0.2\\%$
[[0]][[1]][[2]][[3]]
", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true}, {"type": "1_n_2", "showCellAnswerState": true, "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "minMarks": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "shuffleChoices": false, "displayColumns": "0", "maxMarks": 0, "prompt": "

By comparing the spearman correlation coefficient to the table values found in part (d), choose the option that best describes the outcome of the $p$-value 

", "showFeedbackIcon": true, "choices": ["$p \\leq 0.002$", "$0.002 \\lt p \\leq 0.01$", "$0.01 \\lt p \\leq 0.05$", "$0.05 \\lt p \\leq 0.1$", "$p \\gt 0.1$"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "extendBaseMarkingAlgorithm": true, "matrix": "vs"}, {"type": "1_n_2", "showCellAnswerState": true, "marks": 0, "showCorrectAnswer": true, "scripts": {}, "unitTests": [], "minMarks": 0, "customMarkingAlgorithm": "", "variableReplacements": [], "shuffleChoices": false, "displayColumns": "1", "maxMarks": 0, "prompt": "

What decision can you come to as to the hypothesis that the partners in these married couples have the same interest in sports?

", "showFeedbackIcon": true, "choices": ["Very Strong Evidence of an association between $X$ and $Y$", "Strong evidence of an association between $X$ and $Y$", "Evidence of an association between $X$ and $Y$", "Weak evidence of an association between $X$ and $Y$", "No evidence of an association between $X$ and $Y$"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "extendBaseMarkingAlgorithm": true, "matrix": "vs"}], "tags": [], "functions": {"darr": {"type": "list", "parameters": [["n", "number"], ["m", "number"], ["a", "list"]], "definition": "if(n=1,a,darr(n-1,m,[random(1..m except a)]+a))", "language": "jme"}, "pstdev": {"type": "number", "parameters": [["l", "list"]], "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "language": "jme"}, "rk": {"type": "list", "parameters": [["a", "list"]], "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 ", "language": "javascript"}, "marr": {"type": "number", "parameters": [["a", "list"]], "definition": "if(length(a)=2,max(a[0],a[1]),max(a[0],marr(a[1..length(a)])))", "language": "jme"}, "tesarr": {"type": "list", "parameters": [["a", "list"], ["b", "list"], ["d", "number"], ["m", "number"]], "definition": "if(marr(map(abs(x),x,list(vector(a)-vector(b))))(a)\n

To rank the couples scores, we allocate the lowest numerical score a value of $1$ and repeat this for numbers $1..8$. 

\n

To calculate the differences, we subract the partner $Y$'s rank from partner $X$'s, for each couple.

\n

(b)

\n

To calculate Spearman's correlation coefficient, we use the following the formula:

\n

\\[r_s=1 - \\frac{6 \\times D}{n(n^2-1)}\\]

\n

where $ D = \\sum{d_i}^2.$

\n

Firstly we calculate $D$,

\n

\\begin{align}
D = \\sum{d_i}^2 &= (\\var{d[0]})^2 +(\\var{d[1]})^2+(\\var{d[2]})^2+(\\var{d[3]})^2+(\\var{d[4]})^2+(\\var{d[5]})^2+(\\var{d[6]})^2+(\\var{d[7]})^2\\\\
& = \\var{ssd}.
\\end{align}

\n

\\begin{align}
r_s &= 1 - \\frac{ 6 \\times \\var{ssd}}{\\var{n} \\times (\\var{n}^2-1)}\\\\
& = \\var{spcoef}
\\end{align}

\n

(c)

\n

The sample size is $ n=\\var{n}$, so we look up the critical values with $ n =\\var{n} $ and thus the degrees of freedom are $\\var{n}.$

\n

(d)

\n

Using the statistical table for the critical values for the spearman correlation coefficient in your notes, with $ n = \\var{n}$, we find the following values:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$10\\%$$5\\%$$1\\%$$0.2\\%$
$\\var{ten}$$\\var{five}$$\\var{one}$$\\var{point2}$
\n

(e)

\n

When $r_s < \\var{ten}$, then $p > 0.1 $.

\n

When $\\var{ten}< r_s <\\var{five} $, then $0.05< p < 0.1 $.

\n

When $\\var{five}< r_s <\\var{one} $, then $0.01< p < 0.05$.

\n

When $\\var{one}< r_s <\\var{point2} $, then $0.002< p < 0.01$.

\n

When $r_s > \\var{point2}$, then $p < 0.002 $.

\n

(f)

\n

When $p>0.1$,  we have no evidence of an association between $x$ and $y$

\n

When $0.05< p < 0.1$, we have weak evidence of an association between $x$ and $y$

\n

When $0.01< p < 0.05$, there is evidence of an association between $x$ and $y$

\n

When $0.002<p<0.01$, there is strong evidence of an association between $x$ and $y$

\n

When $p\\le 0.002$, there is very strong evidence of an association between $x$ and $y$

\n

", "variable_groups": [{"variables": ["r1", "r2", "n", "obj"], "name": "Data given in question"}, {"variables": ["spcoef", "aspcoef", "d", "ssd", "vs"], "name": "Spearman correlation coeffcient"}, {"variables": ["ten", "five", "one", "point2"], "name": "Critical values of the spearman correlation coefficient"}, {"variables": ["rr1", "rr2"], "name": "Ranking the data"}], "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"description": "

Spearman rank correlation calculated. 8 paired observations.

", "licence": "Creative Commons Attribution 4.0 International"}, "preamble": {"css": "", "js": ""}, "type": "question", "contributors": [{"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Lauren Frances Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/"}]}]}], "contributors": [{"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Lauren Frances Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/"}]}