// Numbas version: exam_results_page_options {"name": "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": [{"variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "name": "tol", "description": ""}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sig1)),10)", "name": "r1", "description": ""}, "v": {"templateType": "anything", "group": "Ungrouped variables", "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]))))", "name": "v", "description": ""}, "pmsg": {"templateType": "anything", "group": "Ungrouped variables", "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$']", "name": "pmsg", "description": ""}, "sig1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(8..10#0.2)", "name": "sig1", "description": ""}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "10", "name": "n1", "description": ""}, "pvalue": {"templateType": "anything", "group": "Ungrouped variables", "definition": "ttest(atvalue,19,2)", "name": "pvalue", "description": ""}, "t90": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1.734", "name": "t90", "description": ""}, "atvalue": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(tvalue)", "name": "atvalue", "description": ""}, "cmsg": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['do reject','do reject','do not reject','do not reject','do not reject']", "name": "cmsg", "description": ""}, "t99": {"templateType": "anything", "group": "Ungrouped variables", "definition": "2.878", "name": "t99", "description": ""}, "mu1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(55..75#0.5)", "name": "mu1", "description": ""}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(v[0]=1,0,v[1]=1,1,v[2]=1,2,v[3]=1,3,4)", "name": "t", "description": ""}, "sig2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(8..10#0.2)", "name": "sig2", "description": ""}, "n2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "10", "name": "n2", "description": ""}, "t999": {"templateType": "anything", "group": "Ungrouped variables", "definition": "3.922", "name": "t999", "description": ""}, "cmsg1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['very strong','strong','slight','no','no']", "name": "cmsg1", "description": ""}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r1)", "name": "m1", "description": ""}, "t95": {"templateType": "anything", "group": "Ungrouped variables", "definition": "2.101", "name": "t95", "description": ""}, "m2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r2)", "name": "m2", "description": ""}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(((n1-1)*sd1^2+(n2-1)*sd2^2)/(n1+n2-2)),3)", "name": "s", "description": ""}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu2,sig2)),10)", "name": "r2", "description": ""}, "sd1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pstdev(r1),3)", "name": "sd1", "description": ""}, "mu2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(65..75#0.5)", "name": "mu2", "description": ""}, "tvalue": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((m1-m2)*sqrt(n1*n2)/(s*sqrt(n1+n2)),3)", "name": "tvalue", "description": ""}, "msg": {"templateType": "anything", "group": "Ungrouped variables", "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}$']", "name": "msg", "description": ""}, "sd2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pstdev(r2),3)", "name": "sd2", "description": ""}}, "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"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Perform an independent two sample t-test", "functions": {"pstdev": {"type": "number", "language": "jme", "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "parameters": [["l", "list"]]}}, "showQuestionGroupNames": false, "parts": [{"marks": 0, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{m1}", "maxValue": "{m1}", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{sd1}", "maxValue": "{sd1}", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{m2}", "maxValue": "{m2}", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{sd2}", "maxValue": "{sd2}", "marks": 0.5}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{abs(tvalue)-tol}", "maxValue": "{abs(tvalue)+tol}", "marks": 1}], "type": "gapfill", "showCorrectAnswer": true, "steps": [{"type": "information", "showCorrectAnswer": 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)-(\\mu_1-\\mu_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 

\n

\\[s^2=\\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.

\n

Use the values you calculated to 3 decimal places in order to find $T$.

", "marks": 0, "scripts": {}}], "prompt": "

Find the mean and standard deviations of the scores of the two groups:

\n

Mean scores of Group 1= [[0]] (input to 3 decimal places)

\n

Standard deviation of scores for Group 1 = [[1]] (input to 3 decimal places)

\n

Mean scores of Group 2= [[2]] (input to 3 decimal places)

\n

Standard deviation of scores for Group 2 = [[3]] (input to 3 decimal places)

\n

Now find the two sample t-test statistic $T$ using the values you have just calculated to 3 decimal places and input $|T|$ here: [[4]] (3 decimal places)

", "stepsPenalty": 0}, {"displayType": "radiogroup", "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\\%$

"], "displayColumns": 0, "prompt": "

Give the value $|T|$ of the t-statistic you have found, choose the range for the $p$ value by looking up the t tables:

\n

 

", "distractors": ["", "", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "v", "marks": 0}, {"displayType": "radiogroup", "choices": ["

Very Strong Evidence

", "

Strong Evidence

", "

Evidence

", "

Weak Evidence

", "

No Evidence

"], "displayColumns": 0, "prompt": "

Given the $p$-value and the range you have found, what is the strength of evidence against the null hypothesis that there is no difference in the average times for the left and right hands?

", "distractors": ["", "", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "v", "marks": 0}, {"displayType": "radiogroup", "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.

"], "displayColumns": 0, "prompt": "

Hence what is your decision based on the above analysis?

", "distractors": ["", "", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "v", "marks": 0}], "statement": "

An educational psychologist claimed that the order in which questions were asked affected the student’s ability to answer them correctly and hence their total score. In order to test this, $20$ students were randomly divided into two groups of $10$. The first group were given questions in increasing order of difficulty and the second group in decreasing order of difficulty. The ordered test scores obtained 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
Group 1$\\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]}$
Group 2$\\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 a two-sample t-test to test if there is evidence of a difference in the average test scores for the two sets of students.

", "tags": ["average", "checked2015", "data analysis", "differences", "elementary statistics", "hypothesis testing", "mean", "mean ", "PSY2010", "standard deviation", "statistics", "stats", "t-test", "two sample t-test", "variance"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t \t\t

11/07/2012:

\n \t\t \t\t


Added tags.

\n \t\t \t\t

Calculation not yet tested.

\n \t\t \t\t

23/07/2012:

\n \t\t \t\t

Added description.

\n \t\t \t\t

Checked calculation.

\n \t\t \t\t

Changed display slightly in Advice.

\n \t\t \t\t

3/08/2012:

\n \t\t \t\t

Added tags.

\n \t\t \t\t

Question appears to be working correctly.

\n \t\t \n \t\t", "licence": "Creative Commons Attribution 4.0 International", "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.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

We test the following hypothesis,

\n

$H_0:\\; \\mu_1=\\mu_2$ versus $H_1:\\; \\mu_1 \\neq \\mu_2$

\n

We find that the mean score of Group 1 is $\\overline{x}_1=\\var{m1}$ with standard deviation $s_1=\\var{sd1}$ and the mean score of Group 2 is $\\overline{x}_2=\\var{m2}$ with standard deviation $s_2=\\var{sd2}$.

\n

All calculated to 3 decimal places.

\n

Using the formula for the two-sample t-statistic as  shown above with $n_1=n_2=10$:

\n

The estimate of the pooled variance is calculated to be:

\n

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

\n

Hence $s= \\sqrt{\\var{s^2}}=\\var{s}$ to 3 decimal places.

\n

We find that the t-statistic has value:

\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*}\\] to 3 decimal places.

\n

Our test statistic is $|T|=\\var{abs(tvalue)}$.

\n

Given that we have $n_1+n_2-2=18$ degrees of freedom, we look up this value on the T-distribution table for $t_{18}$

\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 t-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 scores of the two groups.

\n

 

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}