// Numbas version: exam_results_page_options {"name": "Evan Kurnia's copy of Perform an independent two sample t-test", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"stepsPenalty": 0, "sortAnswers": false, "showFeedbackIcon": true, "variableReplacements": [], "prompt": "

Find the mean and standard deviations of the Q-angles for the males and females:

\n

Sample mean Q-angle for males = [[2]] 

\n

Sample standard deviation of Q-angles for males = [[3]] 

\n

Sample mean Q-angle for females = [[0]] 

\n

Sample standard deviation of Q-angles for females = [[1]] 

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

The two-sample $t$-statistic for two independent sets of data where one set has $n_1$ datapoints and the other set $n_2$ datapoints is calculated as follows:

\n

\\[T=\\frac{\\overline{x}_1-\\overline{x}_2}{s\\times\\sqrt{\\frac{1}{n_1}+\\frac{1}{n_2}}},\\]

\n

where $\\overline{x}_1,\\;\\overline{x}_2$ are the sample means and the pooled standard deviation $s$ is given by the formula 

\n

\\[s=\\sqrt\\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2},\\]

\n

where $s_1,\\;s_2$ are the sample standard deviations.

", "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "variableReplacements": [], "showCorrectAnswer": true, "scripts": {}, "type": "information", "marks": 0}], "unitTests": [], "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "marks": 0}, {"sortAnswers": false, "showFeedbackIcon": true, "variableReplacements": [], "prompt": "

Use your rounded values above to find the test statistic $T$

\n

$T = $ [[0]]

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

Using the test statistic you have found, choose the range for the $p$-value by looking in the $t$-tables:

\n

 

", "scripts": {}, "type": "1_n_2", "minMarks": 0, "choices": ["

$p$ less than $0.1\\%$

", "

$p$ lies between $0.1\\%$ and $1%$

", "

$p$ lies between $1 \\%$ and $5\\%$

", "

$p$ lies between $5 \\%$ and $10\\%$

", "

$p$ is greater than $10\\%$

"], "unitTests": [], "extendBaseMarkingAlgorithm": true, "maxMarks": 0, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "shuffleChoices": false, "showCorrectAnswer": true, "matrix": "v", "marks": 0}, {"showCellAnswerState": true, "displayColumns": 0, "showFeedbackIcon": true, "variableReplacements": [], "prompt": "

Given the $p$-value range you have found, what is the strength of evidence against the null hypothesis that there is no difference in the average Q-angle for males and females?

", "scripts": {}, "type": "1_n_2", "minMarks": 0, "choices": ["

Very Strong Evidence

", "

Strong Evidence

", "

Evidence

", "

Weak Evidence

", "

No Evidence

"], "unitTests": [], "extendBaseMarkingAlgorithm": true, "maxMarks": 0, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "shuffleChoices": false, "showCorrectAnswer": true, "matrix": "v", "marks": 0}, {"showCellAnswerState": true, "displayColumns": 0, "showFeedbackIcon": true, "variableReplacements": [], "prompt": "

Hence, what is your decision based on the above analysis?

", "scripts": {}, "type": "1_n_2", "minMarks": 0, "choices": ["

We reject the null hypothesis at the $0.1\\%$ level

", "

We reject the null hypothesis at the $1\\%$ level.

", "

We reject the null hypothesis at the $5\\%$ level.

", "

We do not reject the null hypothesis but consider further investigation.

", "

We do not reject the null hypothesis.

"], "unitTests": [], "extendBaseMarkingAlgorithm": true, "maxMarks": 0, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "shuffleChoices": false, "showCorrectAnswer": true, "matrix": "v", "marks": 0}], "extensions": ["stats"], "preamble": {"css": "", "js": ""}, "variables": {"cmsg1": {"description": "", "group": "Ungrouped variables", "name": "cmsg1", "templateType": "anything", "definition": "['very strong','strong','some','no','no']"}, "t99": {"description": "", "group": "Ungrouped variables", "name": "t99", "templateType": "anything", "definition": "2.878"}, "t90": {"description": "", "group": "Ungrouped variables", "name": "t90", "templateType": "anything", "definition": "1.734"}, "t": {"description": "", "group": "Ungrouped variables", "name": "t", "templateType": "anything", "definition": "switch(v[0]=1,0,v[1]=1,1,v[2]=1,2,v[3]=1,3,4)"}, "cmsg": {"description": "", "group": "Ungrouped variables", "name": "cmsg", "templateType": "anything", "definition": "['do reject','do reject','do reject','do not reject','do not reject']"}, "t999": {"description": "", "group": "Ungrouped variables", "name": "t999", "templateType": "anything", "definition": "3.922"}, "pmsg": {"description": "", "group": "Ungrouped variables", "name": "pmsg", "templateType": "anything", "definition": "[' is less than $0.001$',' lies between $0.001$ and $0.01$',' lies between $0.01$ and $0.05$',' lies between $0.05$ and $0.10$',' is greater than $0.10$']"}, "m1": {"description": "", "group": "Ungrouped variables", "name": "m1", "templateType": "anything", "definition": "mean(r1)"}, "sig2": {"description": "", "group": "Ungrouped variables", "name": "sig2", "templateType": "anything", "definition": "random(2.5..3.5#0.01)"}, "tol": {"description": "", "group": "Ungrouped variables", "name": "tol", "templateType": "anything", "definition": "0.001"}, "msg": {"description": "", "group": "Ungrouped variables", "name": "msg", "templateType": "anything", "definition": "['is greater than $\\\\var{t999}$','lies between $\\\\var{t99}$ and $\\\\var{t999}$','lies between $\\\\var{t95}$ and $\\\\var{t99}$','lies between $\\\\var{t90}$ and $\\\\var{t95}$','is less than $\\\\var{t90}$']"}, "s": {"description": "", "group": "Ungrouped variables", "name": "s", "templateType": "anything", "definition": "precround(sqrt(((n1-1)*sd1^2+(n2-1)*sd2^2)/(n1+n2-2)),3)"}, "r2": {"description": "", "group": "Ungrouped variables", "name": "r2", "templateType": "anything", "definition": "repeat(round(normalsample(mu2,sig2)),10)"}, "t95": {"description": "", "group": "Ungrouped variables", "name": "t95", "templateType": "anything", "definition": "2.101"}, "n2": {"description": "", "group": "Ungrouped variables", "name": "n2", "templateType": "anything", "definition": "10"}, "atvalue": {"description": "", "group": "Ungrouped variables", "name": "atvalue", "templateType": "anything", "definition": "abs(tvalue)"}, "tvalue": {"description": "", "group": "Ungrouped variables", "name": "tvalue", "templateType": "anything", "definition": "(precround(m1,3)-precround(m2,3))*sqrt(n1*n2)/(precround(s,3)*sqrt(n1+n2))"}, "m2": {"description": "", "group": "Ungrouped variables", "name": "m2", "templateType": "anything", "definition": "mean(r2)"}, "sd1": {"description": "", "group": "Ungrouped variables", "name": "sd1", "templateType": "anything", "definition": "precround(pstdev(r1),3)"}, "sig1": {"description": "", "group": "Ungrouped variables", "name": "sig1", "templateType": "anything", "definition": "random(4..5#0.01)"}, "r1": {"description": "", "group": "Ungrouped variables", "name": "r1", "templateType": "anything", "definition": "repeat(round(normalsample(mu1,sig1)),10)"}, "pvalue": {"description": "", "group": "Ungrouped variables", "name": "pvalue", "templateType": "anything", "definition": "ttest(atvalue,19,2)"}, "mu1": {"description": "", "group": "Ungrouped variables", "name": "mu1", "templateType": "anything", "definition": "random(15..16#0.01)"}, "sd2": {"description": "", "group": "Ungrouped variables", "name": "sd2", "templateType": "anything", "definition": "precround(pstdev(r2),3)"}, "n1": {"description": "", "group": "Ungrouped variables", "name": "n1", "templateType": "anything", "definition": "10"}, "mu2": {"description": "", "group": "Ungrouped variables", "name": "mu2", "templateType": "anything", "definition": "random(11..12#0.01)"}, "v": {"description": "", "group": "Ungrouped variables", "name": "v", "templateType": "anything", "definition": "if(atvalue>=t999,[1,0,0,0,0],if(atvalue>=t99,[0,1,0,0,0],if(atvalue>=t95,[0,0,1,0,0],if(atvalue>=t90,[0,0,0,1,0],[0,0,0,0,1]))))"}}, "ungrouped_variables": ["sd1", "sd2", "m1", "tol", "m2", "msg", "cmsg1", "t999", "atvalue", "sig1", "tvalue", "sig2", "t99", "t95", "t90", "cmsg", "mu1", "r1", "r2", "mu2", "pmsg", "s", "t", "v", "n1", "n2", "pvalue"], "variable_groups": [], "statement": "

The quadriceps angle, or Q angle, is the angle formed by the encounter of two lines, one that starts at the anterior iliac spine (AIS) and goes to the center of the patella, and another that goes from the tibial tuberosity to the center of the patella. The following table shows the Q-angles, in degrees, for a random sample of 10 males and 10 females.

\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
Females$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$$\\var{r1[8]}$$\\var{r1[9]}$
Males$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$$\\var{r2[8]}$$\\var{r2[9]}$
\n

Carry out by hand (or by entering the data and using SPSS) a two-sample $t$-test to test if there is evidence of a difference in the average Q-angle between males and females.

\n

Let $\\mu_1$ be the mean Q angle for females.

\n

Let $\\mu_2$ be the mean Q angle for males.

\n

Null hypothesis: $H_0$: $\\mu_1 = \\mu_2$

\n

Alternative hypothesis: $H_1$: $\\mu_1 \\ne \\mu_2$

", "name": "Evan Kurnia's copy of Perform an independent two sample t-test", "advice": "

We test the null hypothesis

\n

$H_0:\\; \\mu_1=\\mu_2$ (there is no significant difference in the Q-angles of males and females)

\n

against the alternative hypothesis

\n

 $H_1:\\; \\mu_1 \\neq \\mu_2$ (there is a significant difference in the Q-angles of males and females).

\n

We find that the mean Q-angle of the females is $\\overline{x}_1=\\var{m1}$ with standard deviation $s_1=\\var{sd1}$ and the mean Q-angle of the males is $\\overline{x}_2=\\var{m2}$ with standard deviation $s_2=\\var{sd2}$.

\n

We also have that $n_1=n_2=10$ and so we can calculate the pooled standard deviation $s$:

\n

\\[s=\\sqrt\\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}= \\sqrt\\frac{\\var{n1-1}\\times \\var{sd1}^2+\\var{n2-1}\\times \\var{sd2}^2}{\\var{n1+n2-2}}=\\var{s}.\\] 

\n

We can now calculate the test statistic:

\n

\\[\\begin{eqnarray*}T&=& \\frac{(\\overline{x}_1-\\overline{x}_2)-(\\mu_1-\\mu_2)}{s\\sqrt{\\frac{1}{n_1}+\\frac{1}{n_2}}}\\\\&=&\\frac{(\\var{m1}-\\var{m2})-(0)}{\\var{s}\\sqrt{\\frac{1}{\\var{n1}}+\\frac{1}{\\var{n2}}}}\\\\&=&\\var{tvalue}\\end{eqnarray*}\\].

\n

Remeber that we want the absolute value of this result - that is, we always take it to be positive.

\n

We then look up $n_1+n_2-2=18$ degrees of freedom in the tables and see where our test statistic lies.

\n

\\[\\begin{array}{r|rrrrr}&0.20&0.10&0.05&0.01&0.001\\\\\\hline18&1.330&1.734&2.101&2.878&3.922\\end{array}\\]

\n

We see that the test statistic {msg[t]} and the table tells us that the $p$ value {pmsg[t]}.

\n

Hence we conclude that we {cmsg[t]} the null hypothesis. There is {cmsg1[t]} evidence of a difference between the average Q-angle in females and males.

\n

 

", "functions": {"pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "language": "jme", "type": "number", "parameters": [["l", "list"]]}}, "metadata": {"description": "

Two sample t-test to see if there is a difference between scores on questions between two groups when the questions are asked in a different order.

", "licence": "Creative Commons Attribution 4.0 International"}, "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/"}, {"name": "Evan Kurnia Alim", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2991/"}]}]}], "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/"}, {"name": "Evan Kurnia Alim", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2991/"}]}