// Numbas version: exam_results_page_options {"name": "Independent samples 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": "Independent samples t-test", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

A study is conducted to investigate the effect of caffeine on reaction time. The experiment consists of two different groups which have their reaction times measured. One group is given a placebo and the other is given caffeine. Conduct a two tailed 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 preferred statistical package.

\n", "advice": "

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

\n

This link gives instructions on conducting a t-test in Excel.

\n

This video shows you how to conduct an independent samples t-test in SPSS.

\n

If solving this question by hand (not reccommended!) 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}, "x_bar": {"name": "x_bar", "group": "t score", "definition": "mean(X)", "description": "", "templateType": "anything", "can_override": false}, "y_bar": {"name": "y_bar", "group": "t score", "definition": "mean(Y)", "description": "", "templateType": "anything", "can_override": false}, "var_x": {"name": "var_x", "group": "t score", "definition": "variance(X,true)", "description": "", "templateType": "anything", "can_override": false}, "var_y": {"name": "var_y", "group": "t score", "definition": "variance(Y,true)", "description": "", "templateType": "anything", "can_override": false}, "n_x": {"name": "n_x", "group": "t score", "definition": "len(list(X))", "description": "", "templateType": "anything", "can_override": false}, "n_y": {"name": "n_y", "group": "t score", "definition": "len(list(Y))", "description": "", "templateType": "anything", "can_override": false}, "pooled_sd": {"name": "pooled_sd", "group": "t score", "definition": "sqrt( ( (n_x - 1)*var_x + (n_y - 1)*var_y )/(n_x + n_y - 2) )", "description": "", "templateType": "anything", "can_override": false}, "t_score": {"name": "t_score", "group": "t score", "definition": "precround( ((x_bar - y_bar)/(pooled_sd * sqrt( (1/n_x) + (1/n_y) ) )) ,5)", "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_x+n_y -2),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}, "neg_t_score": {"name": "neg_t_score", "group": "t score", "definition": "-t_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_x", "n_y", "x_bar", "y_bar", "var_x", "var_y", "pooled_sd", "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 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": "", "useAlternativeFeedback": false, "minValue": "{neg_t_score}", "maxValue": "{neg_t_score}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "{t_score}", "maxValue": "{t_score}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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, "displayAnswer": "", "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/"}]}