// Numbas version: exam_results_page_options {"name": "paired t-test", "extensions": ["stats", "download-text-file"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "paired t-test", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

A study is conducted to investigate the effect of sugar on reaction time. The participants have their reaction times measured twice; once having been given a placebo, and, another time after sugar. Conduct a paired t-test to test the hypothesis at the 5% level of significance. You many assume that these data are normally distributed and the two groups have equal variance.

\n

{table_of_data}

\n

{download_link(\"two_tailed_t-test.csv\",csv)} to perform the calculations in your prefered statistical pacakage.

\n", "advice": "

It is recommended that you use a statistical package to solve this question.

\n

Here are instructions on how to conduct this test using Excel.

\n

If solving this question by hand you would use the following equation to workout the t score:

\n

\\[ T = \\frac{(\\bar{X}_1 - \\bar{X}_1) - (\\mu_1 - \\mu_2)}{S_c \\sqrt{1/n_1 + 1/n_2}}  \\]

\n

Where \\(S_c\\) is the pooled standard deviation calculated by:

\n

\\[S_c^2 = \\frac{(n_1-1)S_1^2 +(n_2-1)S_2^2}{n_1 + n_2 -2} \\]

", "rulesets": {}, "extensions": ["download-text-file", "stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"X": {"name": "X", "group": "Ungrouped variables", "definition": "precround(vector(repeat(normalsample(0,1)+10,15)),3)", "description": "", "templateType": "anything", "can_override": false}, "mu_Y": {"name": "mu_Y", "group": "Ungrouped variables", "definition": "random(-1,-0.5,0,0.5,1)", "description": "", "templateType": "anything", "can_override": false}, "Y": {"name": "Y", "group": "Ungrouped variables", "definition": "precround(vector(repeat(normalsample(mu_y,1)+10,15)),3)", "description": "", "templateType": "anything", "can_override": false}, "d_bar": {"name": "d_bar", "group": "t score", "definition": "mean(difference)", "description": "", "templateType": "anything", "can_override": false}, "var_d": {"name": "var_d", "group": "t score", "definition": "variance(difference,true)", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "t score", "definition": "len(list(X))", "description": "", "templateType": "anything", "can_override": false}, "t_score": {"name": "t_score", "group": "t score", "definition": "((d_bar)/(sqrt( (var_d/n) ) ))", "description": "", "templateType": "anything", "can_override": false}, "table_of_data": {"name": "table_of_data", "group": "Ungrouped variables", "definition": "table(zip(X,Y),[\"Group X\",\"Group Y\"])", "description": "", "templateType": "anything", "can_override": false}, "csv": {"name": "csv", "group": "Ungrouped variables", "definition": "csv(zip(X,Y),[\"X\",\"Y\"])", "description": "", "templateType": "anything", "can_override": false}, "p_value": {"name": "p_value", "group": "t score", "definition": "precround(ttest(t_score,(n -1),2),3)", "description": "

ttest return p value from t_score, degree of fredom and tails

", "templateType": "anything", "can_override": false}, "conclusion": {"name": "conclusion", "group": "Ungrouped variables", "definition": "if(p_value<0.05,\"reject\",\"not reject\")", "description": "

This in terms of the alternative hypothesis

", "templateType": "anything", "can_override": false}, "difference": {"name": "difference", "group": "t score", "definition": "X-Y", "description": "", "templateType": "anything", "can_override": false}, "neg_t_score": {"name": "neg_t_score", "group": "t score", "definition": "-1t_score", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "100"}, "ungrouped_variables": ["X", "mu_Y", "Y", "table_of_data", "csv", "conclusion"], "variable_groups": [{"name": "t score", "variables": ["t_score", "p_value", "n", "d_bar", "var_d", "difference", "neg_t_score"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the absoulte value of the t score associated with the above hypothesis test.

\n

\\(|t|=\\) [[0]]

\n

Calculate the p value associated with the above hypothesis test.

\n

p = [[1]]

\n

Base on the above, there is evidence to [[2]] the null hypothesis. (Please enter reject or not reject)

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "t score", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "numberentry", "useCustomName": true, "customName": "negative version", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

correct

", "useAlternativeFeedback": false, "minValue": "{neg_t_score}", "maxValue": "{neg_t_score}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "abs({t_score})", "maxValue": "abs({t_score})", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "p value", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{p_value}", "maxValue": "{p_value}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "patternmatch", "useCustomName": true, "customName": "conclusion", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{conclusion}", "displayAnswer": "{conclusion}", "matchMode": "exact"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ed Southwood", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2415/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ed Southwood", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2415/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}