// Numbas version: finer_feedback_settings {"variable_groups": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Calculate relative percentage frequencies from table of data", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"daysopen": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(norm1)", "description": "", "name": "daysopen"}, "freqdays2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "revsort(repeat(random(2..m-1),n1-1))", "description": "", "name": "freqdays2"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Sales'", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(freqdays1)", "description": "", "name": "m"}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "4", "description": "", "name": "n1"}, "forwhat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'for a large retailer in '+random(2010,2011,2012)", "description": "", "name": "forwhat"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'in thousands of pounds'", "description": "", "name": "units"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..5)", "description": "", "name": "r"}, "what": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'daily sales'", "description": "", "name": "what"}, "freqdays": {"templateType": "anything", "group": "Ungrouped variables", "definition": "freqdays1+freqdays2", "description": "", "name": "freqdays"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..15#5)", "description": "", "name": "s"}, "num": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Number of days'", "description": "", "name": "num"}, "norm1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(round(x),x,list((y/sum(freqdays))*vector(freqdays)))", "description": "", "name": "norm1"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(s*x,x,0..7)", "description": "", "name": "a"}, "rel": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(precround(100*norm1[x]/daysopen,1),x,0..2*n1-2)", "description": "", "name": "rel"}, "y": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(300..320)", "description": "", "name": "y"}, "freqdays1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sort(repeat(random(2..50),n1))", "description": "", "name": "freqdays1"}}, "ungrouped_variables": ["a", "what", "freqdays", "daysopen", "things", "m", "forwhat", "y", "s", "num", "rel", "freqdays1", "units", "n1", "freqdays2", "r", "norm1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"revsort": {"type": "list", "language": "jme", "definition": "list(-1*vector(sort(list(-1*vector(a)))))", "parameters": [["a", "list"]]}}, "variable_groups": [], "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[0]", "minValue": "rel[0]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[1]", "minValue": "rel[1]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[2]", "minValue": "rel[2]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[3]", "minValue": "rel[3]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[4]", "minValue": "rel[4]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[5]", "minValue": "rel[5]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "rel[6]", "minValue": "rel[6]", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": " \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
{things} {num} Relative Percentages
$\\var{a[0]}\\le X \\lt \\var{a[1]}$$\\var{norm1[0]}$[[0]]
$\\var{a[1]}\\le X \\lt \\var{a[2]}$$\\var{norm1[1]}$[[1]]
$\\var{a[2]}\\le X \\lt \\var{a[3]}$$\\var{norm1[2]}$[[2]]
$\\var{a[3]}\\le X \\lt \\var{a[4]}$$\\var{norm1[3]}$[[3]]
$\\var{a[4]}\\le X \\lt \\var{a[5]}$$\\var{norm1[4]}$[[4]]
$\\var{a[5]}\\le X \\lt \\var{a[6]}$$\\var{norm1[5]}$[[5]]
$\\var{a[6]}\\le X \\lt \\var{a[7]}$$\\var{norm1[6]}$[[6]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "

The following table shows {what}, $X$, {units} {forwhat}.

\n

Calculate the relative percentage frequencies (to one decimal place for all).

", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given a table of the number of days in which sales were between £x1000 and £(x+1)1000 find the relative percentage frequencies of these volume of sales.

"}, "advice": "

We show how to calculate the relative percentage frequency for one range of values for  $\\var{a[r]} \\le X \\lt \\var{a[r+1]}$    - you can then check the rest.

\n

Note that there were $\\var{daysopen}$ days  in the year when sales took place. 

\n

There were $\\var{norm1[r]}$ days out of the  $\\var{daysopen}$ when there were between $\\var{a[r]}$ and $\\var{a[r+1]}$ thousand pounds worth of sales (including  $\\var{a[r]}$ thousand but not $\\var{a[r+1]}$ thousand) .

\n

Hence the relative frequency percentage for such sales is given by \\[100 \\times \\frac{\\var{norm1[r]}}{\\var{daysopen}}\\%=\\var{rel[r]}\\%\\] to one decimal place.

\n

 

"}, {"name": "Classify described random variables as qualitative or quantitative, , ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"qual1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"Types of PC used by small businesses in the north-east\",\"Marital status of questionnaire respondents\",\"Month of the year in which small shops record their highest sales\",\"Type of tenure for those in the licensed trade business\",\"Subjects studied at A level by students in this class\"]", "description": "", "name": "qual1"}, "ind1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "2*vector(ind)-vector(1,1,1)", "description": "", "name": "ind1"}, "ch1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(ind[0]=0,random(qual),random(quant))", "description": "", "name": "ch1"}, "ch2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(ind[1]=0,random(qual except ch1),random(quant except ch1))", "description": "", "name": "ch2"}, "qual": {"templateType": "anything", "group": "Ungrouped variables", "definition": "qual1+qual2", "description": "", "name": "qual"}, "quant2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"The number of people requiring a special in-flight meal\",\"The average volume of bottles of wine imported from South America\",\"Salaries of Newcastle University graduates six months after graduation\",\"The distance travelled by taxis for a particular cab firm every day\",\"Total annual sales for a large American departmental store\",\"The total cost of a student's text books for this semester\"]", "description": "", "name": "quant2"}, "ch3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(ind[2]=0,random(qual except [ch1,ch2]),random(quant except [ch1,ch2]))", "description": "", "name": "ch3"}, "qual2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"Ice cream flavour preferred by children\",\"Brand of sportswear preferred by athletes\",\"Favourite type of film by UK cinema-goers\",\"Mobile phone price-plan\",\"Shape of swimming pools in local authority-run leisure centres\"]", "description": "", "name": "qual2"}, "quant1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"The number of orders received by a catering company\",\"The height of students taking Statistics courses at Newcastle this year\", \"Your quarterly gas bill\", \"The time spent on hold at a credit call centre\",\"The average shipping time for orders placed with a TV shopping channel\",\"The annual electricity bill for a large UK Supermarket\"]", "description": "", "name": "quant1"}, "quant": {"templateType": "anything", "group": "Ungrouped variables", "definition": "quant1+quant2", "description": "", "name": "quant"}, "cind": {"templateType": "anything", "group": "Ungrouped variables", "definition": "-1*ind1", "description": "", "name": "cind"}, "ind": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random([[0,0,0],[1,0,0],[0,1,0],[0,0,1],[0,1,1],[1,0,1],[1,1,0],[1,1,1]])", "description": "", "name": "ind"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "transpose(matrix(list(cind),list(ind1)))", "description": "", "name": "m"}}, "ungrouped_variables": ["quant1", "quant2", "qual2", "cind", "qual1", "m", "ch1", "ch2", "ch3", "quant", "ind", "ind1", "qual"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "functions": {}, "parts": [{"displayType": "radiogroup", "layout": {"type": "all", "expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "m", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": true, "answers": ["Qualitative", "Quantitative"], "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": true, "showCorrectAnswer": true, "marks": 0, "warningType": "none"}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

State whether the following variables are Qualitative or Quantitative. 

\n

Note that you will be deducted one mark for every wrong choice. However the minimum mark is 0.

", "tags": ["ACE2013", "checked2015", "MAS1403", "MAS1604"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

01/02/2013:

\n

Finished first draft.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Choosing whether given random variables are qualitative or quantitative.

"}, "advice": ""}, {"name": "Classify sampling methods", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"w": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1,-1],chlist[x]=1,[-1,1,-1,-1],chlist[x]=2,[-1,-1,1,-1],[-1,-1,-1,1]),x,0..2)", "name": "w", "description": ""}, "ch3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[2]=0,random(a except [ch1,ch2]),chlist[2]=1,random(b except [ch1,ch2]),chlist[2]=2,random(c except [ch1,ch2]),random(d except [ch1,ch2]))", "name": "ch3", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1],chlist[x]=1,[1,-1,-1],chlist[x]=2,[-1,1,-1],[-1,-1,1]),x,0..2)", "name": "v", "description": ""}, "b": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A local bus company is planning a new route to serve four housing estates. Random samples of households are taken from each estate and sample members are asked to rate on a scale of 1 (strongly opposed) to 5 (strongly in favour) their reaction to the proposed service.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"This form of sampling reflects the major groupings within a population.\"]", "name": "b", "description": ""}, "c": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"The first item to be checked for faults on a production line is chosen at random, thereafter, every 100th item is checked.\",\"A credit card company wants to investigate the spending habits if its customers. From its lists, the first customer is selected at random; thereafter, every 25th customer is selected.\",\"In an inquiry on heating costs, we decide to sample every 4th house on the street.\",\"To sample 1% of its target population, consisting of 5000 members, a market research company chooses the first member at random; after that, every 100th member is also selected.\",\"This form of sampling could produce an unrepresentative sample because of patterns in the sampling frame.\"]", "name": "c", "description": ""}, "ch2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[1]=0,random(a except ch1),chlist[1]=1,random(b except ch1),chlist[1]=2,random(c except ch1),random(d except ch1))", "name": "ch2", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"One hundred small businesses in Newcastle are placed in alphabetical order and then numbered 1-100. The random number generator is then used to select twenty of these businesses.\",\"Under this form of sampling, if there are five hundred elements in the population, each element has a one-in-five hundred chance of being selected. \",\"One advantage of this form of sampling is that every element in the population has an equal chance of being selected.\",\"We are interested in the employment status of 25-40 year olds in South Tyneside. The names of all such people are obtained from the electoral roll and put into a hat; one hundred of these are then selected without replacement.\",\"One of six branches of a large retail outlet is to be selected for an audit. Each outlet is assigned a number from one to six, and then a fair, six-sided die is rolled to select the branch which will be audited.\"]", "name": "a", "description": ""}, "d": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A company director believes she knows what characteristics make up the target population for a new product her company intends to launch. The company's team of market researchers check the viability of this new product by eliciting the opinions of the target population as specified by the director.\",\"Specific members of a population are sampled because of their known honesty and integrity.\",\"This form of sampling can provide a coherent and focussed sample by asking people with experience and relevant knowledge to provide their opinions.\",\"With this form of sampling, the researcher decides what he or she constitutes a representative sample.\"]", "name": "d", "description": ""}, "ch1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[0]=0,random(a),chlist[0]=1,random(b),chlist[0]=2,random(c),random(d))", "name": "ch1", "description": ""}, "chlist": {"group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(0,1,2,3),3)", "name": "chlist", "description": ""}}, "ungrouped_variables": ["a", "c", "b", "d", "chlist", "ch1", "ch2", "ch3", "w", "v"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {}, "parts": [{"displayType": "radiogroup", "layout": {"type": "all", "expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "w", "prompt": "

Identify each of the following scenarios as one of the following:

\n\n

Note that you will lose 1 mark for every incorrect answer, however the minimum mark for this part of the question is 0.

\n

 

", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "answers": ["Simple Random Sampling", "Stratified Sampling", "Systematic Sampling", "Judgemental Sampling"], "warningType": "none"}, {"layout": {"expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "v", "prompt": "

For each choice, state whether the form of the sampling described is random, quasi-random or non-random.

\n

As before, you will lose 1 mark for every incorrect answer, however the minimum mark for this part of the question is 0.

", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": true, "showCorrectAnswer": true, "answers": ["Random", "Quasi-Random", "Non-random"]}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Answer the following questions on the sampling methods used in these situations.

\n

 

", "tags": ["checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Deciding whether or not  three sampling methods are simple random sampling, stratified sampling, systematic or judgemental sampling. Also whether or not the method of selection is random, quasi-random or non-random.

"}, "advice": ""}, {"name": "Construct stem and leaf plot", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "//number of integers in categories\n shuffle([random(1..4),random(4..5),random(3..5),random(3..5),random(2..4)])", "description": "", "name": "r"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..4)", "description": "", "name": "v"}, "arr1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "//strips away the leading digit of each number\n map(map(arr[y][p]-10*(y+v),p,0..r[y]-1),y,0..4)", "description": "", "name": "arr1"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "//one array of numbers which gets shuffled using ss\n flattenint(arr)", "description": "", "name": "s"}, "arr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "//gives the numbers in each category in increasing order\n map(sort(repeat(10*y+random(0..9),r[y-v])),y,v..v+4)", "description": "", "name": "arr"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(map(if(p\n \n STEMLEAF\n $\\var{v}$\n [[0]]\n [[1]]\n [[2]]\n [[3]]\n [[4]]\n \n $\\var{v+1}$\n [[5]]\n [[6]]\n [[7]]\n [[8]]\n [[9]]\n \n $\\var{v+2}$\n [[10]]\n [[11]]\n [[12]]\n [[13]]\n [[14]]\n \n $\\var{v+3}$\n [[15]]\n [[16]]\n [[17]]\n [[18]]\n [[19]]\n \n $\\var{v+4}$\n [[20]]\n [[21]]\n [[22]]\n [[23]]\n [[24]]\n \n \n ", "showCorrectAnswer": true, "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Construct a stem-and-leaf plot for the following data. Input all numbers into the fields below.

\n

{table([ss],[])}

\n

 NOTE: All 25 fields have to be filled in. Input -1 if there is no number in a field.

\n

 

\n

 

", "tags": ["checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given random set of data (between 13 and 23 numbers all less than 100), find their stem-and-leaf plot.

"}, "advice": "

Ordering the data gives:

\n

{table([s],[])}

\n

Splitting into the groups of 10s gives

\n

{table(arr,[])}

\n

Then putting this into stem-and-leaf plot gives

\n

{table(darr1,['STEM'])}

"}, {"name": "Find mean, standard deviation, median and interquartile range of sample, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"av": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(mean(r),2)", "description": "", "name": "av"}, "sig": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4#0.2)", "description": "", "name": "sig"}, "std": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r,true),2)", "description": "", "name": "std"}, "these": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'specialist camera equipment'", "description": "", "name": "these"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(n=2,12,random(7,5))", "description": "", "name": "m"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'an online warehouse' ", "description": "", "name": "this"}, "med": {"templateType": "anything", "group": "Ungrouped variables", "definition": "median(r)", "description": "", "name": "med"}, "tble1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(repeat(max(round(normalsample(me,sig)),random(4..6)),m),n)", "description": "", "name": "tble1"}, "whatever": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'number of orders per ' + period", "description": "", "name": "whatever"}, "interq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(uquartile(r)-lquartile(r),2)", "description": "", "name": "interq"}, "shortform": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'orders'", "description": "", "name": "shortform"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "flattenint(tble1)", "description": "", "name": "r"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3)", "description": "", "name": "n"}, "tble": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(n=2,map(['Year '+x+':']+tble1[x-1],x,1..2),map(['Week '+ x+':']+tble1[x-1],x,1..3))", "description": "", "name": "tble"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'over a '+ n + ' '+p+ ' period,'", "description": "", "name": "units"}, "note": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(mean(r)=av,' ','Note that we used the more accurate value $(\\\\var{mean(r)})^2$ for $\\\\bar{x}^2$.')", "description": "", "name": "note"}, "me": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(7..12)", "description": "", "name": "me"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=12,'year','week')", "description": "", "name": "p"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=12,[' ','J','F','M','A','M','J','J','A','S','O','N','D'],m=5,[' ','M','T','W','T','F'],[' ','M','T','W','T','F','S','S'])", "description": "", "name": "t"}, "period": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=7,'day',m=12,'month',m=5,'weekday')", "description": "", "name": "period"}}, "ungrouped_variables": ["me", "tble1", "tble", "p", "shortform", "med", "this", "m", "interq", "whatever", "n", "note", "these", "std", "r", "sig", "t", "av", "units", "period"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"flattenint": {"type": "list", "language": "javascript", "definition": "/*only for integer arrays*/ \n array.toString().split(',').forEach( function (item, i) \n {array[i] = parseInt(item);\n }\n ); \n return array;", "parameters": [["array", "list"]]}, "uquartile": {"type": "number", "language": "jme", "definition": "interpolate(a,3*(length(a)+1)/4)", "parameters": [["a", "list"]]}, "interpolate": {"type": "number", "language": "jme", "definition": "(1-fract(r))*sort(a)[floor(r)-1]+fract(r)*sort(a)[ceil(r)-1]", "parameters": [["a", "list"], ["r", "number"]]}, "lquartile": {"type": "number", "language": "jme", "definition": "interpolate(a,(length(a)+1)/4)", "parameters": [["a", "list"]]}}, "showQuestionGroupNames": false, "parts": [{"prompt": "

Sample mean = [[0]]{shortform}. Give your answer to  $2$ decimal places (include trailing zeros if required).

\n

Sample Standard Deviation = [[1]] {shortform}. Give your answer to $2$ decimal places (include trailing zeros if required).

\n

Sample Median = [[2]] (Input as an exact decimal).

\n

The interquartile range= [[3]] (Input as an exact decimal).

", "scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "av-0.01", "maxValue": "av+0.01", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "std-0.01", "maxValue": "std+0.01", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "med", "minValue": "med", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "showPrecisionHint": false}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "interq", "minValue": "interq", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "statement": "

The following data are the {whatever} for {these}, {units} taken by {this}

\n

{table(tble,t)}

\n

Answer the following questions:

\n

 

\n

 

", "tags": ["ACE2013", "checked2015", "interquartile range", "lower quartile", "MAS1403", "mean", "mean ", "median", "quartiles", "sample data", "sample mean", "sample standard deviation", "standard deviation", "statistics", "upper quartile"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

Note that the uquartile and lquartile are calculated as given by the functions below these may change!

\n

 21/12/2012:

\n

Three user defined functions. Added tag udf.

\n

flattenint, takes an array of arrays with integers leaves and converts to an integer array by flattening the array. Other two functions, uquartile and lquartile find the lower and upper quartiles.

\n

Scenarios possible, added sc.

\n

22/10/2013:

\n


Redefined functions uquartile and lquartile to fit new definitions. Added helper udf interpolate.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given sample data find mean, standard deviation, median, interquartile range,

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

As we have to find the median and the interquartile range it is a good idea to order the data and also to total up the data (for the mean) and find the total of the squares of the data (for the variance).

\n

{table([['Data']+sort(r),['Squared data']+map(x^2,x,sort(r)),['Index']+map(x,x,1..m*n)],[])}

\n

Note that from the above table:

\n

$n=\\var{m*n}$.

\n

$\\displaystyle  \\sum x_i = \\var{sum(r)}$ and 

\n

$\\displaystyle  \\sum x^2_i = \\var{sum(map(x^2,x,r))}$ .

\n

The sample mean is $\\bar{x}=\\displaystyle \\frac{ \\sum x_i}{n}=\\frac{\\var{sum(r)}}{\\var{m*n}}=\\var{mean(r)}=\\var{av}$ to 2 decimal places.

\n

The sample deviation is the square root of the sample variance.

\n

Sample variance:\\[\\begin{eqnarray*}\\frac{1}{ n -1}\\left(\\sum x_i ^ 2 - n \\bar{x} ^ 2\\right)&=& \\frac{1}{\\var{m*n-1}}\\left(\\var{sum(map(x^2,x,r))}-\\var{m*n}\\times\\var{mean(r)^2}\\right)\\\\&=&\\var{variance(r,true)}\\end{eqnarray*}\\] {Note} 

\n

So the sample standard deviation = $\\sqrt{\\var{variance(r,true)}}=\\var{std}$ to 2 decimal places.

\n

The median is $\\var{median(r)} $.

\n

The lower quartile is : $\\var{lquartile(r)}$.

\n

The upper quartile is : $\\var{uquartile(r)}$.

\n

The interquartile range is the difference between these quartiles =$\\var{uquartile(r)}-\\var{lquartile(r)}=\\var{uquartile(r)-lquartile(r)}$

\n

 

\n

 

"}, {"name": "Calculate probabilities from frequency table", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"a0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1000..4000#1000)", "name": "a0", "description": ""}, "q": {"group": "Ungrouped variables", "templateType": "anything", "definition": "2", "name": "q", "description": ""}, "ans2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround((thismany-sum(n[0..v+1]))/thismany,2)", "name": "ans2", "description": ""}, "ans3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround((n[1]+n[2])/thismany,2)", "name": "ans3", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[a0,a0+b0,a0+2*b0]", "name": "a", "description": ""}, "n1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(3,6))", "name": "n1", "description": ""}, "sc": {"group": "Ungrouped variables", "templateType": "anything", "definition": "['A bank made '+{thismany}+' car loans last year. The amounts were as follows (\u00a3):']", "name": "sc", "description": ""}, "b0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1000..3000#1000)", "name": "b0", "description": ""}, "n0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(15,25))", "name": "n0", "description": ""}, "t": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(a)-1)", "name": "t", "description": ""}, "ans1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround(sum(n[0..t+1])/thismany,2)", "name": "ans1", "description": ""}, "n3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(11,14))", "name": "n3", "description": ""}, "k": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(sc)-1)", "name": "k", "description": ""}, "u1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "a[t]", "name": "u1", "description": ""}, "data": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\n [[0,a[0]-1,n[0]],\n [a[0],a[1]-1,n[1]],\n [a[1],a[2]-1,n[2]],\n [a[2],'plus',n[3]]]\n \n ", "name": "data", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(a)-1 except t)", "name": "v", "description": ""}, "o1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "a[v]", "name": "o1", "description": ""}, "thismany": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(300..1000#100)", "name": "thismany", "description": ""}, "p": {"group": "Ungrouped variables", "templateType": "anything", "definition": "0", "name": "p", "description": ""}, "n": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[n0,n1,thismany-n0-n1-n3,n3]", "name": "n", "description": ""}}, "ungrouped_variables": ["a", "sc", "p", "ans1", "k", "ans3", "u1", "thismany", "n", "q", "a0", "b0", "t", "v", "n0", "n1", "n3", "data", "ans2", "o1"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {"accumdisp": {"type": "string", "language": "jme", "definition": "if(k=0,'$\\\\var{a[0]}$','$\\\\var{a[0]}$ + '+accumdisp(a[1..abs(a)],k-1))", "parameters": [["a", "list"], ["k", "number"]]}}, "parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"showCorrectAnswer": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans1", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans1"}, {"showCorrectAnswer": true, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans2", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans2"}, {"showCorrectAnswer": true, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans3", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans3"}], "type": "gapfill", "prompt": "

One of these loans is sampled randomly for review by the bank. What is the probability that it is :

\n

a) Under £$\\var{u1}$?   Probability = ? [[0]]  (answer to 2 decimal places).

\n

b) Over £$\\var{o1-1}$?     Probability = ? [[1]]  (answer to 2 decimal places).

\n

c) Between £$\\var{a[p]}$ and £$\\var{a[q]-1}$?    Probability = ? [[2]] (answer to 2 decimal places).

\n

 

\n

 

", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

{sc[k]}

\n

{table(data,['  From','  To', '  Loans Made'])}

\n

 

\n ", "tags": ["checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

28/12/2012:

\n

Using the inbuilt table function for now. This needs to be changed - either to direct input of an html table or improving the table function e.g. adding borders etc.

\n

The udf accumdisp(a,t) outputs a string of the form a[0]+a[1]+..a[t-1]  - useful to show in the solution the elements of the list we are summing over.

\n

There is a scenario variable sk, which is intended to be the beginning of a list of possible randomised scenarios. Probably best if this included other text based string variables (e.g. car loans could be the value of such a variable).

\n

Easy to make this have a variable number of ranges of loans. Only need to pay some attention to the creation of the list n giving the number of loans in each range - need to make that sensible.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Simple probability question. Counting number of occurences of an event in a sample space with given size and finding the probability of the event.

"}, "advice": "\n

a) The number of loans less than £$\\var{u1}$ is $\\var{accumdisp(n,t)}=\\var{sum(n[0..t+1])}$

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[0..t+1])}}{\\var{thismany}}=\\var{ans1}$ to 2 decimal places.

\n

b) The number of loans greater than £$\\var{o1}$ is $\\var{accumdisp(n[v+1..abs(n)],abs(n)-v-2)}=\\var{sum(n[v+1..abs(n)])}$.

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[v+1..abs(n)])}}{\\var{thismany}}=\\var{ans2}$ to 2 decimal places.

\n

c) There are $\\var{accumdisp(n[p+1..q+1],q-p-1)}=\\var{sum(n[p+1..q+1])}$ loans between  £$\\var{a[p]}$ and £$\\var{a[q]-1}$.

\n

Hence the probability of selecting one of these loans in this range for review is $\\displaystyle \\frac{\\var{sum(n[p+1..q+1])}}{\\var{thismany}}=\\var{ans3}$ to 2 decimal places.

\n "}, {"name": "Calculate probability of either of two events occurring", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"dothisandthat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on both domestic and European routes\"", "description": "", "name": "dothisandthat"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob1,2)", "description": "", "name": "ans2"}, "desc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"are in training\"", "description": "", "name": "desc2"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'stewardesses'", "description": "", "name": "things"}, "dothat1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on European routes\"", "description": "", "name": "dothat1"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-random(85..95)", "description": "", "name": "p3"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((p-p3)/100,2)", "description": "", "name": "prob1"}, "therest": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The remainder\"", "description": "", "name": "therest"}, "desc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"with a small UK-based airline\"", "description": "", "name": "desc1"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-p1", "description": "", "name": "p2"}, "thing": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"stewardess\"", "description": "", "name": "thing"}, "dothis1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on domestic routes\"", "description": "", "name": "dothis1"}, "desc4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"is in training\"", "description": "", "name": "desc4"}, "dothat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on European routes\"", "description": "", "name": "dothat"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on domestic routes\"", "description": "", "name": "dothis"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(40..70)", "description": "", "name": "p1"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(105..125)", "description": "", "name": "p"}, "desc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"working with this airline\"", "description": "", "name": "desc3"}}, "ungrouped_variables": ["dothisandthat", "desc4", "p1", "desc1", "dothat", "desc3", "things", "ans2", "p3", "p", "p2", "dothat1", "dothis", "therest", "desc2", "thing", "dothis1", "prob1"], "functions": {}, "variable_groups": [], "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "\n

Find the probabilities that a randomly chosen {thing} {desc3}: 

\n

a) {dothis1} or {dothat1}.

\n

Probability = [[0]]

\n

b) {desc4}.

\n

Probability = [[1]]

\n

Enter both probabilities to 2 decimal places.

\n ", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "prob1", "maxValue": "prob1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ans2", "maxValue": "ans2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "\n

$\\var{p1}$% of {things} {desc1} {dothis}, $\\var{p2}$% {dothat} and $\\var{p3}$% {dothisandthat}. 

\n

{therest} {desc2}

\n ", "tags": ["checked2015"], "rulesets": {}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Example showing how to calculate the probability of A or B using the law $p(A \\;\\textrm{or}\\; B)=p(A)+p(B)-p(A\\;\\textrm{and}\\;B)$. 

\n

Also converting percentages to probabilities.

\n

Easily adapted to other applications.

"}, "advice": "

a) There are $\\var{p1}+\\var{p2}-\\var{p3}=\\var{p-p3}$ % of stewardesses working on one of the routes. The probability that a random stewardess is working on one of these routes is therefore $\\displaystyle \\frac{\\var{p-p3}}{100}=\\var{prob1}$.

\n

b) The rest are in training and the probability that a randomly selected stewardess is in training is $1-\\var{prob1}=\\var{1-prob1}$.

"}, {"name": "Decide whether pairs of events are independent, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[[m1,-m1],[m2,-m2],[m3,-m3]]", "description": "", "name": "mm"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except [t,u])", "description": "", "name": "v"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "name": "thismany"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except t)", "description": "", "name": "u"}, "m3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(v < k,1,-1)", "description": "", "name": "m3"}, "abbe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"above\",\"below\")", "description": "", "name": "abbe"}, "sc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[v]", "description": "", "name": "sc3"}, "pc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3..20)", "description": "", "name": "pc"}, "pe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pe"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pe*pf,2)", "description": "", "name": "pm"}, "indep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E \\\\;\\\\textrm{and}\\\\; F) = P(E) \\\\times P(F)$.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= \\\\var{pe}$, $P(F)= \\\\var{pf}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)=\\\\var{pm}$\",\n \"H: A new laundry detergent will capture $\\\\var{pc} of the market next year, K: Rover will produce a new model next year.\",\n \"H: Spinning a six and K: spinning a five on the same spinner.\",\n \"A: I look out of the window and it is sunny, B: I win the National Lottery jackpot this weekend!\",\n \"A: I look out of the window and it is cloudy, B: Newcastle \"+{something}+\" this weekend.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= P(E) \\\\times P(F)$\",\n \"A student is selected at random from this class. The events A and B are such that A: the student has \"+ abbe+ \" average shoe size and B: the student was born in \"+ {mo},\n \"E: An individual eats out more than \"+thismany+\" times a week. F: An individual has \"+col+\" hair.\",\n \"$H$ and $K$, where $P(K) = P(K|H)$.\"]\n ", "description": "", "name": "indep"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "indep+notindep", "description": "", "name": "a"}, "pef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.3..0.8)", "description": "", "name": "pef"}, "tm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(9,10,11)", "description": "", "name": "tm"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"win easily\",\"scrape a draw\", \"get beat due to a disputed penalty\")", "description": "", "name": "something"}, "npef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pef^2+random(0.1..0.2#0.01),2)", "description": "", "name": "npef"}, "m2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u < k,1,-1)", "description": "", "name": "m2"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "definition": "length(indep)", "description": "", "name": "k"}, "sc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[t]", "description": "", "name": "sc1"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t < k,1,-1)", "description": "", "name": "m1"}, "col": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"black\",\"brown\",\"blonde\")", "description": "", "name": "col"}, "notindep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"A: The sky is cloudy today. B: It will rain today.\",\n \"A: A level marks in Mathematics, B: A level marks in Physics from students in the same school.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)=\\\\var{pef}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= \\\\var{npef}$\",\n \"H: Tom lies in on \"+ td + \", K: Tom is late for his \"+ tm+\" o'clock lecture on \"+ td,\n \"A student is selected at random from this class. The events H and K are such that H: the student is \"+ abbe+ \" average in height and K: the student is \"+abbe +\" average in weight.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E\\\\; \\\\textrm{and}\\\\; F)\\\\neq P(E)\\\\times P(F)$\",\n \"H: There is a severe thunderstorm in my home town this afternoon. K: My computer crashes this afternoon.\",\n \"A: A patient takes an abnormally long time to recover from an operation. B: The patient is elderly.\"]\n ", "description": "", "name": "notindep"}, "td": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Monday\",\"Tuesday\", \"Wednesday\",\"Thursday\",\"Friday\")", "description": "", "name": "td"}, "sc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[u]", "description": "", "name": "sc2"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1)", "description": "", "name": "t"}, "pf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pf"}, "mo": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"January\",\"February\", \"March\", \"April\",\"June\", \"October\",\"November\",\"December\")", "description": "", "name": "mo"}}, "ungrouped_variables": ["something", "indep", "pc", "tm", "pf", "m3", "m2", "m1", "td", "pm", "abbe", "npef", "pe", "thismany", "sc1", "pef", "sc3", "sc2", "a", "mm", "mo", "notindep", "col", "u", "t", "v", "k"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"layout": {"expression": ""}, "choices": ["First Pair: {sc1}", "Second Pair: {sc2}", "Third Pair: {sc3}"], "matrix": "mm", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "answers": ["Independent", "Not independent"], "scripts": {}, "minMarks": 0, "minAnswers": 0, "maxMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "marks": 0}], "type": "gapfill", "prompt": "

[[0]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

Choose whether or not the following three pairs of events are independent or not.

\n

For every wrong choice you will lose a mark.  The minimum mark you can get is 0.

\n ", "tags": ["checked2015", "MAS1403", "MAS1604"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added sc tag as can add more pairs of events. Note that if you add more then the number of independent events in the new list has to be updated in variables m1,m2,m3.**

\n \t\t

The presentation of the pairs in the MCQ is not optimal! Not sure about the rather random labelling (A and B, H and K etc).

\n \t\t

No solution given. Perhaps a general statement on independence in Advice or in Show steps.  

\n \t\t

** Split up into two arrays, independent and not independent pairs.  If you add events to these arrays then everything is automatically updated.

\n \t\t

Question tested, OK.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Independent events in probability. Choose whether given three given pairs of events are independent or not.

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

No solution provided.

"}, {"name": "Find probabilities from 2D frequency table, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"w": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..6)", "name": "w", "description": ""}, "cat": {"group": "Ungrouped variables", "templateType": "anything", "definition": "['single','married','divorced','widowed']", "name": "cat", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..6)", "name": "v", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[[round(tc1/random(7.5..8.5#0.1)),0,round(tc1/random(6.5..7.5#0.1)),round(tc1/random(19.5..20.5#0.1))],[round(tc2/random(3.5..4.5#0.1)),0,round(tc2/random(19.5..20.5#0.1)),round(tc2/random(19.5..20.5#0.1))],[round(tc3/random(2.5..3.5#0.1)),0,random(5..15),round(tc3/random(14.5..15.5#0.1))]]", "name": "a", "description": ""}, "w1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..6)", "name": "w1", "description": ""}, "tc2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "n-tc1-tc3", "name": "tc2", "description": ""}, "t": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..3)", "name": "t", "description": ""}, "tc3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(n/random(6.5..7.5#0.1))", "name": "tc3", "description": ""}, "sumr": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(sum(list(r[y])),y,0..3)", "name": "sumr", "description": ""}, "oneof": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(v=1,cat[0]+\" or \"+ cat[1] ,v=2,cat[0]+\" or \"+cat[2],v=3,cat[0]+\" or \"+cat[3],v=4,cat[1]+\" or \"+cat[2],v=5,cat[1]+\" or \"+cat[3],cat[2]+\" or \"+cat[3])", "name": "oneof", "description": ""}, "othercats": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(t=0,cat[1]+\" or \"+ cat[2] ,t=1,cat[0]+\" or \"+cat[3],t=2,cat[0]+\" or \"+cat[1],t=3,cat[0]+\" or \"+cat[2],cat[0]+\" or \"+cat[2])", "name": "othercats", "description": ""}, "ans": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(precround(x,3),x,[sumr[t]/n,tc[u]/n,ve/n,1-tc[u]/n,ce1/n,ce2/n,sumr[t]*(sumr[t]-1)/(n*(n-1)),tc[u1]*(tc[u1]-1)/(n*(n-1)),r[t][u]/tc[u],we2/tc[u]])", "name": "ans", "description": ""}, "n": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1200..2300#2)", "name": "n", "description": ""}, "tc": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[tc1,tc2,tc3]", "name": "tc", "description": ""}, "at": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"teetotal\",\"drinking 1-20 units/week\",\"drinking 21+ units/week\"]", "name": "at", "description": ""}, "we2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "if(u=0, if(t=0,r[1][0]+r[2][0], if(t=1,r[0][0]+r[3][0], if(t=2,r[0][0]+r[1][0],r[0][0]+r[2][0]))),if(u=1, if(t=0,r[1][1]+r[2][1], if(t=1,r[0][1]+r[3][1], if(t=2,r[0][1]+r[1][1],r[0][1]+r[2][1]))),if(t=0,r[1][2]+r[2][2], if(t=1,r[0][2]+r[3][2], if(t=2,r[0][2]+r[1][2], r[0][2]+r[2][2])))))", "name": "we2", "description": ""}, "u1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..2)", "name": "u1", "description": ""}, "ce1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(w=1, r[0][0],w=2, r[0][1],w=3, r[0][2],w=4,r[1][0],w=5, r[1][1],r[1][2])", "name": "ce1", "description": ""}, "ce2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(w1=1, r[2][0],w1=2, r[2][1],w1=3, r[2][2],w1=4,r[3][0],w1=5, r[3][1],r[3][2])", "name": "ce2", "description": ""}, "drk1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "At[u1]", "name": "drk1", "description": ""}, "tc1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(n/random(2.5..3.5#0.1))", "name": "tc1", "description": ""}, "tot": {"group": "Ungrouped variables", "templateType": "anything", "definition": "sum(tc)", "name": "tot", "description": ""}, "things": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\"male\"", "name": "things", "description": ""}, "cats": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\"Marital Status\"", "name": "cats", "description": ""}, "catattrib1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(w=1,cat[0]+\" and \"+At[0],w=2,cat[0]+\" and \"+At[1],w=3,cat[0]+\" and \"+At[2],w=4,cat[1]+\" and \"+At[0],w=5,cat[1]+\" and \"+At[1],cat[1]+\" and \"+At[2])", "name": "catattrib1", "description": ""}, "ve": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(v=1,sumr[0]+ sumr[1] ,v=2,sumr[0]+sumr[2],v=3,sumr[0]+sumr[3],v=4,sumr[1]+sumr[2],v=5,sumr[1]+sumr[3],sumr[2]+sumr[3])", "name": "ve", "description": ""}, "this": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\"alcohol consumption\"", "name": "this", "description": ""}, "catattrib2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(w1=1,cat[2]+\" and \"+At[0],w1=2,cat[2]+\" and \"+At[1],w1=3,cat[2]+\" and \"+At[2],w1=4,cat[3]+\" and \"+At[0],w1=5,cat[3]+\" and \"+At[1],cat[3]+\" and \"+At[2])", "name": "catattrib2", "description": ""}, "somecat": {"group": "Ungrouped variables", "templateType": "anything", "definition": "cat[t]", "name": "somecat", "description": ""}, "drkpair": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(u=0,\"drinks alcohol\",u=1,At[0]+' or ' + At[2],At[0]+\" or \" +At[1])", "name": "drkpair", "description": ""}, "r": {"group": "Ungrouped variables", "templateType": "anything", "definition": "transpose(matrix(map(norm(a[y],1,tc[y]),y,0..2)))", "name": "r", "description": ""}, "drk": {"group": "Ungrouped variables", "templateType": "anything", "definition": "At[u]", "name": "drk", "description": ""}, "u": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..2)", "name": "u", "description": ""}}, "ungrouped_variables": ["somecat", "ve", "othercats", "at", "ce1", "ans", "cat", "drk1", "things", "u1", "tot", "catattrib2", "cats", "tc", "w1", "oneof", "tc2", "tc3", "tc1", "catattrib1", "a", "drkpair", "this", "n", "we2", "drk", "r", "u", "t", "w", "v", "sumr", "ce2"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {"norm": {"type": "list", "language": "javascript", "definition": "\n var b=a;\n var s=-b[x];\n for(i=0;iFind the following probabilities that a randomly chosen {things} involved in this survey:(Enter all probabilities to 3 decimal places).

\n

1) is {somecat}: Probability =? [[0]]

\n

2) is {drk}:  Probability = ? [[1]]

\n

3) is either {oneof}: Probability =? [[2]]

\n

4) {drkpair}: Probability =? [[3]]

\n

5) {catattrib1}: Probability =? [[4]]

\n

6) {catattrib2}: Probability=? [[5]]

\n ", "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "ans[6]", "minValue": "ans[6]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "ans[7]", "minValue": "ans[7]", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n

Find the probability (to 3 decimal places) that two randomly selected {things}s in this survey are

\n

7) both {somecat}:  Probability = ? [[0]]

\n

8) both {drk1}: Probability =? [[1]]

\n ", "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "ans[8]", "minValue": "ans[8]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "ans[9]", "minValue": "ans[9]", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n

Given that a randomly selected {things} in this survey is {drk}, what is the probability that he:

\n

9) is {somecat}: Probability = ? [[0]]

\n

10) is {othercats}: Probability =? [[1]]

\n

 

\n ", "marks": 0}], "statement": "\n

A survey was conducted to obtain information on {this}. A random sample of {things}s gave :

\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
{Cats}{At[0]}{At[1]}{At[2]}Total
{cat[0]}{r[0][0]}{r[0][1]}{r[0][2]}{sumr[0]}
{cat[1]}{r[1][0]}{r[1][1]}{r[1][2]}{sumr[1]}
{cat[2]}{r[2][0]}{r[2][1]}{r[2][2]}{sumr[2]}
{cat[3]}{r[3][0]}{r[3][1]}{r[3][2]}{sumr[3]}
Totals{tc[0]}{tc[1]}{tc[2]}{tot}
\n \n ", "tags": ["ACE2013", "checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added tags and description.

\n \t\t

This is easily configurable to other surveys by changing the variables used for labelling. Added the tag sc to denote this. Also added tag, table, as there is a table included.

\n \t\t

The column labels in the table need to be centred.

\n \t\t

The presentation and layout of the questions should be improved and made consistent.

\n \t\t

There is a user-defined function norm(a,x,n) which takes a numeric list a and changes the entry a[x] so that the sum of entries in a is n. Added the tag udf. 

\n \t\t

Calculations correct on testing.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Finding probabilities from a survey giving a table of data on the alcohol consumption of males. This can be easily adapted to data from other types of surveys.

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

1) The total number of {somecat} {things}s is $\\var{sumr[t]}$ hence the probability that a random {things} from this survey is {somecat} is $\\displaystyle \\frac{ \\var{sumr[t]}}{\\var{n}}=\\var{ans[0]}$ to 3 decimal places.

\n

 

\n

2) The total number of  {things}s who are {drk} is $\\var{tc[u]}$ hence the probability that a random {things} from this survey is {drk} is $\\displaystyle \\frac{ \\var{tc[u]}}{\\var{n}}=\\var{ans[1]}$  to 3 decimal places.

\n

 

\n

3) Looking at the table there are $\\var{ve}$ {things}s that are {oneof}. Hence the probability is $\\displaystyle \\frac{ \\var{ve}}{\\var{n}}=\\var{ans[2]}$  to 3 decimal places.

\n

 

\n

4) These are the {things}s that are not {drk}, and hence there are $\\var{n}-\\var{tc[u]}=\\var{n-tc[u]}$ of them (see answer to part b)), and the probability of randomly selecting one is  $\\displaystyle \\frac{ \\var{n-tc[u]}}{\\var{n}}=\\var{ans[3]}$ to 3 decimal places.

\n

 

\n

5)Looking at the table we see that the number corresponding to {catattrib1} is $\\var{ce1}$. Hence the probability of randomly selecting one is $\\displaystyle \\frac{ \\var{ce1}}{\\var{n}}=\\var{ans[4]}$ to 3 decimal places.

\n

6) As in the last question, looking at the table we see that the number corresponding to {catattrib2} is $\\var{ce2}$. Hence the probability of randomly selecting one is $\\displaystyle \\frac{ \\var{ce2}}{\\var{n}}=\\var{ans[5]}$ to 3 decimal places.

\n

 

\n

7) We know from question a) that the probability of selecting a {somecat} {things} is,  $\\displaystyle \\frac{ \\var{sumr[t]}}{\\var{n}}$, after this we now have $\\var{sumr[t]-1} $ {somecat} {things}s amongst the $\\var{n-1}$  left,  and the probability of yet again selecting one  of these is $\\displaystyle \\frac{ \\var{sumr[t]-1}}{\\var{n-1}}$. So the probability of selecting two is  $\\displaystyle \\frac{ \\var{sumr[t]}\\times  \\var{sumr[t]-1}}{\\var{n}\\times\\var{n-1}}=\\var{ans[6]}$ to 3 decimal places.

\n

8) The probability of selecting a {things} who is {drk1} is $\\displaystyle \\frac{ \\var{tc[u1]}}{\\var{n}}$, after this we now have  $\\var{tc[u1]-1}$ {drk1} {things}s amongst the $\\var{n-1}$ left, and the probability of yet again selecting one  of these is $\\displaystyle \\frac{ \\var{tc[u1]-1}}{\\var{n-1}}$. So the probability of selecting two is  $\\displaystyle \\frac{ \\var{tc[u1]}\\times  \\var{tc[u1]-1}}{\\var{n}\\times\\var{n-1}}=\\var{ans[7]}$ to 3 decimal places.

\n

9) Since there are $\\var{r[t][u]}$ {somecat} {things}s from the  $\\var{tc[u]}$ {things}s that are {drk} the probability of selecting one  is $\\displaystyle \\frac{\\var{r[t][u]}}{\\var{tc[u]}}= \\var{ans[8]}$ to 3 decimal places.

\n

10) Since there are $\\var{we2}$ {othercats} {things}s from the $\\var{tc[u]}$ {things}s that are {drk} the probability of selecting one  is $\\displaystyle \\frac{\\var{we2}}{\\var{tc[u]}}= \\var{ans[9]}$   to 3 decimal places.

\n "}, {"name": "Make decision based on expected monetary value", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"cat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"Market the product nationwide\",\"Sell by mail order\",\"Sell the patent\"]", "description": "", "name": "cat"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map([cat[x]]+a[x],x,0..2)", "description": "", "name": "b"}, "a22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a12+random(5..15#5)", "description": "", "name": "a22"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-p1-p2,2)", "description": "", "name": "p3"}, "outcomes": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"outcomes\"", "description": "", "name": "outcomes"}, "emv": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix(a)*vector(p)", "description": "", "name": "emv"}, "correct": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(mm[0]=1,Cat[0],mm[1]=1,Cat[1],Cat[2])", "description": "", "name": "correct"}, "product": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"product\"", "description": "", "name": "product"}, "a10": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(random(0.75..0.9#0.5)*a00)", "description": "", "name": "a10"}, "a20": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(a10*random(0.7..0.85))", "description": "", "name": "a20"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(random(0.2..0.35#0.05),2)", "description": "", "name": "p1"}, "expectedreturn": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the Marketing Director`s thoughts on the likely profit (in thousands of pounds) to be earned\"", "description": "", "name": "expectedreturn"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A car accessory company, Marla PLC, \"", "description": "", "name": "something"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(award(1,maxemv=emv[x]),x,0..abs(cat)-1)", "description": "", "name": "mm"}, "info": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"Initial market research\"", "description": "", "name": "info"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[p1,p2,p3]", "description": "", "name": "p"}, "maxemv": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(list(emv))", "description": "", "name": "maxemv"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'thousands of pounds'", "description": "", "name": "units"}, "hasdonethis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"has developed a new car immobiliser \"", "description": "", "name": "hasdonethis"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(p1+random(0.05..0.1#0.05),2)", "description": "", "name": "p2"}, "a02": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-40..-10#10)", "description": "", "name": "a02"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[[a00,a01,a02],[a10,a11,a12],[a20,a21,a22]]", "description": "", "name": "a"}, "decision": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"and has to decide whether to:\"", "description": "", "name": "decision"}, "a00": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(80..120#10)", "description": "", "name": "a00"}, "a01": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(40..70#10)", "description": "", "name": "a01"}, "att": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\" \",\"highly successful\",\"moderately successful\",\"limited success/failure\"]", "description": "", "name": "att"}, "a12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..15#5)", "description": "", "name": "a12"}, "a11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(random(0.75..0.95#0.5)*a01)", "description": "", "name": "a11"}, "a21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(a01*random(0.7..0.85))", "description": "", "name": "a21"}}, "ungrouped_variables": ["a20", "a21", "a22", "a02", "a00", "a01", "outcomes", "something", "maxemv", "decision", "units", "correct", "a", "product", "a11", "a10", "a12", "b", "p2", "p3", "p1", "mm", "info", "cat", "p", "att", "emv", "expectedreturn", "hasdonethis"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "variable_groups": [], "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[0]", "minValue": "emv[0]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[1]", "minValue": "emv[1]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[2]", "minValue": "emv[2]", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "\n

Calculate the Expected Monetary Value (EMV) for each option:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
 EMV
{Cat[0]}[[0]]
{Cat[1]}[[1]]
{Cat[2]}[[2]]
\n ", "showCorrectAnswer": true, "marks": 0}, {"displayType": "radiogroup", "choices": ["{Cat[0]}", "{Cat[1]}", "{Cat[2]}"], "matrix": "mm", "prompt": "\n

Hence determine the optimal course of action:

\n

 

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

{Something} {hasdonethis} {decision}

\n

A. {Cat[0]}

\n

B. {Cat[1]}

\n

C. {Cat[2]}

\n

{info} has the following probabilities associated to the following {outcomes} for the {product}:

\n

{Att[1]}, {Att[2]} or {Att[3]}.

\n

{table([['<strong>Probability</strong>']+p],Att)}

\n

The next table shows {expectedreturn} for each option against these {outcomes}:

\n

{table(b,Att)}

\n ", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added tag sc (as configurable to other applications).

\n \t\t

Also added tag table.

\n \t\t

The tables need sorting out. OK, but need better table functions.

\n \t\t

Checked calculations, OK.

\n \t\t

 

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given data on probabilities of three levels of success of three options and projections of the profits that the options will accrue depending on the level of success, find the expected monetary value (EMV) for each option and choose the one with the greatest EMV.

"}, "advice": "\n

The Expected Monetary Value for the first option:  {Cat[0]} is given in four steps (all numbers below are in {units}):

\n

1.  Multiplying the probability $\\var{p1}$  of a {Att[1]} outcome by the expected profit $\\var{a[0][0]}$,  gives:

\n

expected profit = $\\var{p1}\\times \\var{a[0][0]}=  \\var{p1*a[0][0]}$ 

\n

 

\n

2.  Multiplying the probability $\\var{p2}$  of a {Att[2]} outcome  by the expected profit,  $\\var{a[0][1]}$ gives:

\n

 expected profit =  $\\var{p2}\\times \\var{a[0][1]}=  \\var{p2*a[0][1]}$  

\n

 

\n

3.   Multiplying the probability $\\var{p3}$  of a {Att[3]} outcome  by the expected profit,  $\\var{a[0][2]}$ gives:

\n

 expected profit =  $\\var{p3}\\times \\var{a[0][2]}=  \\var{p3*a[0][2]}$ 

\n

4. Finally add these three together to get the Expected Monetary Value  for the option {Cat[0]} :

\n

$\\var{p1*a[0][0]}+\\var{p2*a[0][1]}-\\var{abs(p3*a[0][2])}=\\var{emv[0]}$

\n

 

\n

You calculate in the same way for the other options - the next table gives the Expected Monetary Value for all three::

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
 EMV
{Cat[0]}{emv[0]}
{Cat[1]}{emv[1]}
{Cat[2]}{emv[2]}
\n

The optimal course of action is take to be that which has the highest Expected Monetary Value (EMV) and this is seen to be :

\n

{Correct} with EMV  $\\var{maxemv}$.

\n

 

\n

 

\n

 

\n

 

\n

 

\n "}, {"name": "Are described variables from Poisson or binomial distributions?, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"mm": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[[1,-1],[1-2*t,2*t-1],[-1,1]]", "name": "mm", "description": ""}, "p2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(t=0,random(0..abs(b)-1 except p1),random(0..abs(pd)-1 except p3))", "name": "p2", "description": ""}, "b": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\n[\"20% of eggs from a family-run farm are bad. X is the number of bad eggs in a box of a dozen.\",\n \"A salesperson has a 50% chance of making a sale on a customer visit and she arranges 10 visits in a day. Let X be the number of sales that day.\",\n \"30% of items off a factory production line have been shown to have defects. Let A be the number of defectives in a box of 20 such items.\",\n \"One in ten new small businesses in the north-east goes bust within a year. Let X be the number of small businesses that fail in the next year out of thirty that have been set up.\",\n \"The probability that an office photocopier will fail on any given day is 0.15. The human resources office at Newcastle University has ten such photocopiers; Let Y be the number of photocopiers that fail today.\",\n \"Callers to the Vodaphone call centre will get through to an operator immediately with probability 0.25. X is the number of callers that speak to an operator immediately out of thirty such callers.\",\n \"Experience has shown that two in every ten components produced by a circuitboard company will be defective. A random sample of 100 components is inspected for defects, and D is the number of defectives in this sample.\"]\n", "name": "b", "description": ""}, "ch1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "b[p1]", "name": "ch1", "description": ""}, "p1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(b)-1)", "name": "p1", "description": ""}, "ch2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(t=0,b[p2],pd[p2])", "name": "ch2", "description": ""}, "p3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(pd)-1)", "name": "p3", "description": ""}, "pd": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\n[\"Y is the number of flights sold per hour by an online travel agency. This travel agency usually sells 10 flights per hour.\",\n \"X is the number of cars sold by a local garage in a month. This garage usually sells about 10 cars per month.\",\n \"The number of calls, Y, received at the British Passport Office in Durham occurs at the rate of 10 a minute.\",\n \"We are interested in X, the number of machine breakdowns in a day. Such breakdowns at a particular IT company occur at a rate of eight per week.\",\n \"X is the number of e-mails arriving in your inbox in a one hour period. On average you receive 3 e-mails per hour.\",\n \"On average, three patients arrive at a local Accident and Emergency department every hour. We count the number, X, of patients in an hour period.\",\n \"About five customers arrive at a fish shop queue every ten minutes during the lunch time rush. We count X, the number of customers arriving during the lunch time rush.\"]\n", "name": "pd", "description": ""}, "t": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0,1)", "name": "t", "description": ""}, "ch3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "pd[p3]", "name": "ch3", "description": ""}}, "ungrouped_variables": ["p2", "p3", "b", "mm", "ch3", "ch1", "ch2", "p1", "t", "pd"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {}, "parts": [{"displayType": "radiogroup", "layout": {"type": "all", "expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "mm", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": true, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "answers": ["Binomial Distribution", "Poisson Distribution"], "warningType": "none"}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

Which of the following random variables could be modelled with a binomial distribution and which could be modelled with a Poisson distribution?

\n

You will lose 1 mark for every incorrect answer. The minimum mark is 0.

\n ", "tags": ["checked2015", "MAS1403", "MAS1604"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

06/12/2013

\n

Replaced a Poisson scenario that wasn't strictly Poisson. (AJY)

\n

31/12/2012:

\n


Checked choices, OK. Added tag sc as examples can be easily added to via the arrays b and pd.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given descriptions of  3 random variables, decide whether or not each is from a Poisson or Binomial distribution.

"}, "advice": "

No solution given.

"}, {"name": "Calculate expectation and probabilities from Poisson distribution", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"thisnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(thismany<8,thismany-1, random(3..7))", "description": "", "name": "thisnumber"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(number1=2,0,1)", "description": "", "name": "v"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"sales.\"", "description": "", "name": "things"}, "tprob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(number1=2,e^(-thismany)*(1+thismany),e^(-thismany)*(1+thismany+thismany^2/2))", "description": "", "name": "tprob2"}, "thisaswell": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"a randomly selected employee receives a warning.\"", "description": "", "name": "thisaswell"}, "tprob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(thismany^thisnumber)*e^(-thismany)/fact(thisnumber)", "description": "", "name": "tprob1"}, "descx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the number of sales per day\"", "description": "", "name": "descx"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(thismany),3)", "description": "", "name": "sd"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..10)", "description": "", "name": "thismany"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"a randomly selected employee makes exactly \"", "description": "", "name": "this"}, "what": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"daily sales.\"", "description": "", "name": "what"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob2,3)", "description": "", "name": "prob2"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob1,3)", "description": "", "name": "prob1"}, "pre": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The mean number of sales per day at a telecommunications centre is \"", "description": "", "name": "pre"}, "number1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(thismany<8,2, 3)", "description": "", "name": "number1"}, "else": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"per day.\"", "description": "", "name": "else"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"Employees receive a warning if they make less than \"", "description": "", "name": "something"}}, "ungrouped_variables": ["pre", "what", "this", "things", "number1", "descx", "else", "thismany", "something", "tol", "v", "tprob1", "sd", "tprob2", "prob2", "thisnumber", "thisaswell", "prob1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thismany", "minValue": "thismany", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thismany", "minValue": "thismany", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "sd+tol", "minValue": "sd-tol", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Assuming a Poisson distribution for $X$, {descX}, write down the value of $\\lambda$.

\n

$X \\sim \\operatorname{Poisson}(\\lambda)$

\n

$\\lambda = $?[[0]]

\n

Find $\\operatorname{E}[X]$ the expected {descX}.

\n

$\\operatorname{E}[X]=$?[[1]]

\n

Find the standard deviation for {what}.

\n

Standard deviation = ? [[2]] (to 3 decimal places).

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob1+tol", "minValue": "prob1-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob2+tol", "minValue": "prob2-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Find the probability that {this} $\\var{thisnumber}$ {things}

\n

$\\operatorname{P}(X=\\var{thisnumber})=$? [[0]] (to 3 decimal places).

\n

 

\n

Find the probability that {thisaswell}

\n

Probability = ? [[1]] (to 3 decimal places).

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

{pre} $\\var{thismany}$.

\n

{something} $\\var{number1}$ {else}

\n

 

\n ", "tags": ["checked2015", "expectation", "expected number", "MAS1403", "Poisson distribution", "poisson distribution", "probability", "Probability", "sc", "standard deviation", "statistical distributions", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

31/12/2012:

\n

Can be configured to other applications using the string variables supplied. Hence added tag sc.

\n

Not as yet properly tested.

\n

26/11/14:

\n

Edited the advice to better reflect the notation used on the module.

\n

\n

", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\t

Application of the Poisson distribution given expected number of events per interval.

\n \t\t

Finding probabilities using the Poisson distribution.

\n \t\t"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

1. $X \\sim \\operatorname{Poisson}(\\var{thismany})$, so $\\lambda = \\var{thismany}$.

\n

2. The expected number (or mean) is given by $\\operatorname{E}[X]=\\lambda=\\var{thismany}$

\n

3. $\\operatorname{SD}(X)=\\sqrt{\\operatorname{Var}(X)}=\\sqrt{\\lambda}=\\sqrt{\\var{thismany}}=\\var{sd}$ to 3 decimal places.

\n

b)

\n

1. \\[ \\begin{eqnarray*}\\operatorname{P}(X = \\var{thisnumber}) &=& \\frac{\\var{thismany} ^ {\\var{thisnumber}}e ^ { -\\var{thismany}}} {\\var{thisnumber}!}\\\\& =& \\var{prob1} \\end{eqnarray*} \\] to 3 decimal places.

\n

 

\n

2. If an employee receives a warning then he or she must have sold less than {number1}.

\n

Hence we need to find :

\n

\\[ \\begin{eqnarray*}\\operatorname{P}(X < \\var{number1})& =& \\simplify[all,!collectNumbers]{P(X = 0) + P(X = 1) + {v}*P(X = 2)}\\\\& =& \\simplify[all,!collectNumbers]{e ^ { -thismany} + {thismany} * e ^ { -thismany} + {v} * (({thismany} ^ 2 * e ^ { -thismany}) / 2)} \\\\&=& \\var{prob2} \\end{eqnarray*} \\]

\n

to 3 decimal places.

\n

 

"}, {"name": "Calculate probabilities from a binomial distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"thisnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(number1<6,random(2..3), if(number1<8,random(2..4),random(3..6)))", "description": "", "name": "thisnumber"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "descx1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"number of chocolate chip cookies in our sample:\"", "description": "", "name": "descx1"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..20)", "description": "", "name": "thismany"}, "post": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"% of biscuits made by a baker are chocolate chip cookies.\"", "description": "", "name": "post"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob1,3)", "description": "", "name": "prob1"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"our selection contains exactly \"", "description": "", "name": "this"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(thatnumber=1,0,1)", "description": "", "name": "v"}, "prob": {"templateType": "anything", "group": "Ungrouped variables", "definition": "thismany/100", "description": "", "name": "prob"}, "tprob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialpdf(thisnumber,number1,prob)", "description": "", "name": "tprob1"}, "else": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"biscuits are selected at random.\"", "description": "", "name": "else"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "''", "description": "", "name": "something"}, "thisaswell": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"our selection contains no more than \"", "description": "", "name": "thisaswell"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"chocolate chip cookies.\"", "description": "", "name": "things"}, "descx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the number of chocolate chip cookies\"", "description": "", "name": "descx"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(number1*prob*(1-prob)),3)", "description": "", "name": "sd"}, "thatnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2)", "description": "", "name": "thatnumber"}, "tprob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialcdf(thatnumber,number1,prob)", "description": "", "name": "tprob2"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob2,3)", "description": "", "name": "prob2"}, "what": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"daily sales.\"", "description": "", "name": "what"}, "pre": {"templateType": "anything", "group": "Ungrouped variables", "definition": "' '", "description": "", "name": "pre"}, "number1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..12)", "description": "", "name": "number1"}}, "ungrouped_variables": ["pre", "descx1", "something", "thisnumber", "what", "things", "descx", "tol", "prob", "thisaswell", "else", "thismany", "number1", "post", "prob2", "prob1", "thatnumber", "this", "v", "tprob1", "tprob2", "sd"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "number1", "minValue": "number1", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob", "minValue": "prob", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "number1*thismany/100", "minValue": "number1*thismany/100", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "sd+tol", "minValue": "sd-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Assuming a binomial distribution for $X$ , {descX}, write down the values of $n$ and $p$.

\n

$X \\sim \\operatorname{Bin}(n,p)$

\n

$n=\\; $?[[0]]        $p=\\;$?[[1]]

\n

Find $\\operatorname{E}[X]$ the expected {descX1}

\n

$\\operatorname{E}[X]=$?[[2]]

\n

Find the standard deviation for the {descX1}

\n

Standard deviation = ? [[3]] (to 3 decimal places).

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob1+tol", "minValue": "prob1-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob2+tol", "minValue": "prob2-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Find the probability that {this} $\\var{thisnumber}$ {things}

\n

$\\operatorname{P}(X=\\var{thisnumber})=$? [[0]] (to 3 decimal places).

\n

 

\n

Find the probability that {thisaswell} {thatnumber} {things}

\n

Probability = ? [[1]] (to 3 decimal places).

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "

{pre} $\\var{thismany}$ {post}

\n

{something} $\\var{number1}$ {else}

", "tags": ["binomial distribution", "Binomial Distribution", "Binomial distribution", "checked2015", "expectation", "expected number", "MAS1403", "probability", "Probability", "sc", "standard deviation", "statistical distributions", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

31/12/2012:

\n

Can be configured to other applications using the string variables supplied. Hence added tag sc.

\n

Not as yet properly tested.

\n

13/01/2013:

\n

Used stats extension functions binomialpdf and binomialcdf instead of calculating insitu.

\n

26/11/2014:

\n

Minor edits to the question and advice to better reflect the notation used in the coursse, e.g. Bin rather than bin.

\n

", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\t

Application of the binomial distribution given probabilities of success of an event.

\n \t\t

Finding probabilities using the binomial distribution.

\n \t\t"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

1. $X \\sim \\operatorname{Bin}(\\var{number1},\\var{prob})$, so $n= \\var{number1},\\;\\;p=\\var{prob}$.

\n

2. The expected number (or mean) is given by $\\operatorname{E}[X]=n\\times p=\\var{number1}\\times \\var{prob}=\\var{number1*prob}$

\n

3. $\\operatorname{SD}(X)=\\sqrt{\\operatorname{Var}(X)}=\\sqrt{n\\times p \\times (1-p)}=\\sqrt{\\var{number1}\\times \\var{prob} \\times \\var{1-prob}}=\\var{sd}$ to 3 decimal places.

\n

b)

\n

1. \\[ \\begin{eqnarray*}\\operatorname{P}(X = \\var{thisnumber}) &=& ^\\var{number1}C_\\var{thisnumber}\\times\\var{prob}^{\\var{thisnumber}}\\times\\var{1-prob}^{\\var{number1}-\\var{thisnumber}}\\\\&=& \\var{comb(number1,thisnumber)} \\times\\var{prob}^{\\var{thisnumber}}\\times\\var{1-prob}^{\\var{number1-thisnumber}}\\\\&=&\\var{prob1}\\end{eqnarray*} \\] to 3 decimal places.

\n

 

\n

2. 

\n

\\[ \\begin{eqnarray*}\\operatorname{P}(X \\leq \\var{thatnumber})& =& \\simplify[all,!collectNumbers]{P(X = 0) + P(X = 1) + {v}*P(X = 2)}\\\\& =& \\simplify[zeroFactor,zeroTerm,unitFactor]{{1 -prob} ^ {number1}+ {number1} *{prob} *{1 -prob} ^ {number1 -1} + {v} * ({number1} * {number1 -1}/2)* {prob} ^ 2 *( {1 -prob} ^ {number1 -2})}\\\\& =& \\var{prob2}\\end{eqnarray*} \\]

\n

to 3 decimal places.

\n

 

"}, {"name": "Calculate probabilities from a normal distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "description": "", "name": "tol"}, "amount": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"electricity consumption\"", "description": "", "name": "amount"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalcdf(zupper,0,1),4)", "description": "", "name": "p1"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(750..1250#50)", "description": "", "name": "m"}, "prob3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(p1-p2,2)", "description": "", "name": "prob3"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-p,2)", "description": "", "name": "prob1"}, "zupper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((upper-m)/s,2)", "description": "", "name": "zupper"}, "stuff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"a frozen foods warehouse each week in the summer months \"", "description": "", "name": "stuff"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(m-1.5*s..m-0.5s#5)", "description": "", "name": "lower"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-p", "description": "", "name": "p2"}, "zlower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((m-lower)/s,2)", "description": "", "name": "zlower"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(60..100#10)", "description": "", "name": "s"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalcdf(zlower,0,1),4)", "description": "", "name": "p"}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(m+0.5s..m+1.5*s#5)", "description": "", "name": "upper"}, "units1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"k Wh\"", "description": "", "name": "units1"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-p1,2)", "description": "", "name": "prob2"}}, "ungrouped_variables": ["units1", "upper", "lower", "p1", "m", "s", "zupper", "p", "amount", "p2", "tol", "zlower", "stuff", "prob2", "prob3", "prob1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob1+tol", "minValue": "prob1-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob2+tol", "minValue": "prob2-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob3+tol", "minValue": "prob3-tol", "correctAnswerFraction": false, "marks": "2", "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Find the probability that in a particular week the {amount} is less than {lower} {units1}:

\n

Probability = ?[[0]](to 2  decimal places)

\n

Find the probability that in a particular week the {amount} is greater than {upper} {units1}:

\n

Probability = ?[[1]](to 2  decimal places)

\n

Find the probability that in a particular week the {amount} is between {lower}{units1} and {upper} {units1}:

\n

Probability = ?[[2]](to 2  decimal places)

", "showCorrectAnswer": true, "marks": 0}], "statement": "

The {amount}, $X$, of {stuff}  is normally distributed with mean {m}{units1} and standard deviation {s}{units1}.

\n

i.e.   \\[X \\sim \\operatorname{N}(\\var{m},\\var{s}^2)\\]

\n

 

", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

1/1/2012:

\n

Can be configured to other applications using the string variables suppplied. Included tag sc.

\n

26/11/2014:

\n

Added an extra question on the probability that X lies between the upper and lower values. Edited the advice to reflect the use of tables in the module.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given a random variable $X$  normally distributed as $\\operatorname{N}(m,\\sigma^2)$ find probabilities $P(X \\gt a),\\; a \\gt m;\\;\\;P(X \\lt b),\\;b \\lt m$.

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

1. Converting to $\\operatorname{N}(0,1)$

\n

$\\simplify[all,!collectNumbers]{P(X < {lower}) = P(Z < ({lower} -{m}) / {s})} = P(Z<-\\var{zlower})= \\var{prob1}$ to 2 decimal places.

\n

2. Converting to $\\operatorname{N}(0,1)$

\n

$\\simplify[all,!collectNumbers]{P(X > {upper}) = P(Z > ({upper} -{m}) / {s})} = P(Z>\\var{zupper}) = 1-P(Z<\\var{zupper})=1-\\var{p1} = \\var{prob2}$ to 2 decimal places.

\n

3.

\n

$\\simplify[all,!collectNumbers]{P({lower} < X < {upper}) = P(X < {upper})-P(X < {lower})}=P(Z<\\var{zupper})-P(Z<-\\var{zlower}) =\\var{p1}-\\var{p2} = \\var{prob3}$ to 2 decimal places.

"}, {"name": "Find a confidence interval for the population mean with variance unknown, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"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": "Shweta Sharma", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21418/"}], "tags": ["checked2015"], "metadata": {"description": "

Finding the confidence interval at either 90%, 95% or 99% for the mean given the mean and standard deviation of a sample. The population variance is not given and so the t test has to be used. Various scenarios are included.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

The management of {sc[s]} wants to {dothis[s]}.

\n

A random sample of {spec} $\\var{n}$ {t[s]} gave a mean and standard deviation of {p}$\\var{m[s]}$ {units} and {p}$\\var{sd[s]}$ {units} respectively.

", "advice": "

1.

\n

The population variance is unknown. So we have to use the t tables to find the confidence interval.

\n

2.

\n

We now calculate the $\\var{confl}$ confidence interval:

\n

As we have $\\var{n}-1=\\var{n-1}$ degrees of freedom, the interval is given by:

\n

\\[ \\var{m[s]} \\pm t_{\\var{n-1}}\\sqrt{\\frac{\\var{sd[s]}^2}{\\var{n}}}\\]

\n

Looking up the t tables for $\\var{confl}$% we see that $t_{\\var{n-1}}=\\var{invt}$ to 3 decimal places.

\n

Hence:

\n

Lower value of the confidence interval $=\\;\\displaystyle \\var{m[s]} -\\var{invt} \\sqrt{\\frac{\\var{sd[s]} ^ 2} {\\var{n}}} =\\var{p} \\var{lci}$ {units} to 2 decimal places.

\n

Upper value of the confidence interval $=\\;\\displaystyle \\var{m[s]} +\\var{invt} \\sqrt{\\frac{\\var{sd[s]} ^ 2} {\\var{n}}} = \\var{p}\\var{uci}$ {units} to 2 decimal places.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"s": {"name": "s", "group": "Ungrouped variables", "definition": "random(0..abs(sc)-1)", "description": "", "templateType": "anything", "can_override": false}, "sc1ch": {"name": "sc1ch", "group": "Ungrouped variables", "definition": "random(\"hotels\",\"motels\", \"Bed and Breakfasts\",\"budget hotels\")", "description": "", "templateType": "anything", "can_override": false}, "sc": {"name": "sc", "group": "Ungrouped variables", "definition": "\n [\"a national chain of \"+ sc1ch,\n \"a \"+sc2ch + \" chain of clothing shops \",\n \" a large factory \",\n \" a regional passenger airline in \"+sc4ch,\n \"Choclastic!, a company producing a variety of chocolate bars \",\n \" a large bakery \"]\n ", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "\n [\"vacated rooms was inspected by the management and this\",\n \"clothing outlets \",\n \"workers\",\n \"tickets \",\n \"chocolate bars \",\n sc6ch+\" \"]\n \n ", "description": "", "templateType": "anything", "can_override": false}, "sc4ch": {"name": "sc4ch", "group": "Ungrouped variables", "definition": "random(\"the Caribbean\",\"the Mediterranean\",\"North East England\",\"South West England\",\"California\")", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(10..30)", "description": "", "templateType": "anything", "can_override": false}, "sc2ch": {"name": "sc2ch", "group": "Ungrouped variables", "definition": "random(\"local\",\"national\")", "description": "", "templateType": "anything", "can_override": false}, "dothis": {"name": "dothis", "group": "Ungrouped variables", "definition": "\n [\"estimate the mean cost per room of repairing damage caused by its customers during a bank holiday weekend\",\n \"estimate the mean monthly sales of all of its outlets\",\n \"estimate the mean hours worked per week of all its employees\",\n \"estimate the mean cost of a ticket on its most popular route\",\n \"estimate the mean weight of \"+sc5ch+\" inside bars of its most popular product\",\n \"estimate the mean amount of saturated fat in its \"+ sc6ch]\n \n \n \n ", "description": "", "templateType": "anything", "can_override": false}, "invt": {"name": "invt", "group": "Ungrouped variables", "definition": "precround(tinvt,3)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "switch(s=0 or s=1 or s=3,'\u00a3',' ')", "description": "", "templateType": "anything", "can_override": false}, "sc5ch": {"name": "sc5ch", "group": "Ungrouped variables", "definition": "random(\"caramel\",\"Turkish delight\",\"honeycomb\",\"nuts\")", "description": "", "templateType": "anything", "can_override": false}, "sc6ch": {"name": "sc6ch", "group": "Ungrouped variables", "definition": "random(\"Cornish pasties\",\"sausage rolls\",\"chicken pies\",\"minced beef pasties\")", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "\n [random(30..100#0.01),\n random(40000..80000#500),\n random(34..48#0.01),\n random(100..300#0.01),\n random(10..20#0.01),\n random(3.5..6#0.01)]\n \n ", "description": "", "templateType": "anything", "can_override": false}, "lci": {"name": "lci", "group": "Ungrouped variables", "definition": "precround(tlci,2)", "description": "", "templateType": "anything", "can_override": false}, "uci": {"name": "uci", "group": "Ungrouped variables", "definition": "precround(tuci,2)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "switch(s=2,\"hours\",s=4,\"g\",s=5,\"g per 100g\",\" \")", "description": "", "templateType": "anything", "can_override": false}, "tuci": {"name": "tuci", "group": "Ungrouped variables", "definition": "m[s]+invt*sqrt(sd[s]^2/n)", "description": "", "templateType": "anything", "can_override": false}, "sd": {"name": "sd", "group": "Ungrouped variables", "definition": "\n [random(3..10#0.01),\n random(500..4000#0.5),\n random(2..5#0.01),\n random(10..40#0.01),\n random(1..3#0.01),\n random(0.5..1#0.01)]\n ", "description": "", "templateType": "anything", "can_override": false}, "tlci": {"name": "tlci", "group": "Ungrouped variables", "definition": "m[s]-invt*sqrt(sd[s]^2/n)", "description": "", "templateType": "anything", "can_override": false}, "spec": {"name": "spec", "group": "Ungrouped variables", "definition": "if(s=2,\"the timecards of \", \" \")", "description": "", "templateType": "anything", "can_override": false}, "tinvt": {"name": "tinvt", "group": "Ungrouped variables", "definition": "studenttinv((confl+100)/200,n-1)", "description": "", "templateType": "anything", "can_override": false}, "confl": {"name": "confl", "group": "Ungrouped variables", "definition": "random(90,95,99)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["m", "uci", "invt", "units", "lci", "spec", "sc2ch", "sc1ch", "tinvt", "confl", "tuci", "dothis", "sc4ch", "sc6ch", "n", "p", "s", "tlci", "t", "sc", "sc5ch", "sd"], "variable_groups": [], "functions": {"pounds": {"parameters": [["n", "number"]], "type": "number", "language": "javascript", "definition": "return Numbas.util.currency(n,'\u00a3','p');"}}, "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": "

Is the population variance known or unknown?

\n

[[0]]

\n

Calculate a $\\var{confl}$% confidence interval $(a,b)$ for the population mean:

\n

$a=\\;${p}[[1]] {units}          $b=\\;${p}[[2]] {units}

\n

Enter both to 2 decimal places.

", "gaps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Known", "Unknown"], "matrix": [0, 1], "distractors": ["", ""]}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "lci-0.01", "maxValue": "lci+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "uci-0.01", "maxValue": "uci+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Find a confidence interval given the mean of a sample, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"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/"}], "tags": ["checked2015"], "metadata": {"description": "

Finding the confidence interval at either 90%, 95% or 99% for the mean given the mean of a sample. The population variance is given and so the z values are used. Various scenarios are included.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "\n

A company {sc[s]} {dothis[s]} $\\var{sd[s]}$ {units}.

\n

A random sample of $\\var{n}$ {t[s]} gives a mean  of $\\var{m[s]}$ {units}. 

\n

 

\n ", "advice": "

a)

\n

We use the z tables to find the confidence interval as we know the population variance.

\n

We now calculate the $\\var{confl}$% confidence interval.

\n

Note that $z_{\\var{confl/100}}=\\var{zval}$ and the confidence interval is given by:

\n

\\[ \\var{m[s]} \\pm z_{\\var{confl/100}}\\sqrt{\\frac{\\var{sd2}}{\\var{n}}}\\]

\n

Hence:

\n

Lower value of the confidence interval $=\\;\\displaystyle \\var{m[s]} -\\var{zval} \\sqrt{\\frac{\\var{sd2}} {\\var{n}}} = \\var{lci}${units} to 2 decimal places.

\n

Upper value of the confidence interval $=\\;\\displaystyle \\var{m[s]} +\\var{zval} \\sqrt{\\frac{\\var{sd2}} {\\var{n}}} = \\var{uci}${units} to 2 decimal places.

\n

b)

\n

Since $\\var{aim}$ {doornot} {lies} in the confidence interval the answer is {Correct}.

\n

 

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"aim": {"name": "aim", "group": "Ungrouped variables", "definition": "if(s=0,750,if(s=1,100,if(s=2,100,1500)))", "description": "", "templateType": "anything", "can_override": false}, "confl": {"name": "confl", "group": "Ungrouped variables", "definition": "random(90,95,99)", "description": "", "templateType": "anything", "can_override": false}, "sd": {"name": "sd", "group": "Ungrouped variables", "definition": "\n [random(800..1400#20),\n random(1200..1800#20),\n random(300..600#20),\n random(100..200#0.1)]\n \n ", "description": "", "templateType": "anything", "can_override": false}, "sd1": {"name": "sd1", "group": "Ungrouped variables", "definition": "if(s=3,sd[s],sqrt(sd[s]))", "description": "", "templateType": "anything", "can_override": false}, "sc4ch": {"name": "sc4ch", "group": "Ungrouped variables", "definition": "random(\"supermarkets\",\"clothing retailers\",\"department stores\",\"fast food outlets\")", "description": "", "templateType": "anything", "can_override": false}, "lies": {"name": "lies", "group": "Ungrouped variables", "definition": "if(test=0,\"lies\",\"lie\")", "description": "", "templateType": "anything", "can_override": false}, "howwell": {"name": "howwell", "group": "Ungrouped variables", "definition": "\n [\"On average, is the company reaching its target of 750g per bag?\",\n \"The bolts are designed to be 100mm long. Is the process satisfactory?\",\n \"The vending machines are supposed to fill 100ml cups. Is the machine working satisfactorily?\",\n \"The company aims for an average salary of \u00a31500 per month per worker. Is the aim being met?\"]\n ", "description": "", "templateType": "anything", "can_override": false}, "correct": {"name": "correct", "group": "Ungrouped variables", "definition": "if(test=0, \"yes\", \"no\")", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(20..100)", "description": "", "templateType": "anything", "can_override": false}, "sc2ch": {"name": "sc2ch", "group": "Ungrouped variables", "definition": "random(\"bolts\",\"screws\")", "description": "", "templateType": "anything", "can_override": false}, "dothis": {"name": "dothis", "group": "Ungrouped variables", "definition": "\n [var1 + \" is\",\n \"with a \"+var2+\" of\",\n var3+ \" is\",\n \"knows that the population standard deviation for the wages of employees is\"]\n \n \n \n \n ", "description": "", "templateType": "anything", "can_override": false}, "var3": {"name": "var3", "group": "Ungrouped variables", "definition": "random(\"The variance of the filling process \",\"The process variance \")", "description": "", "templateType": "anything", "can_override": false}, "sc3ch": {"name": "sc3ch", "group": "Ungrouped variables", "definition": "random(\"hot water.\",\"tea.\",\"coffee.\",\"hot chocolate.\",\"cappuccino.\")", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "\n [random(700..745),\n random(95..98),\n random(90..99),\n random(1000..2500#50)]\n \n \n ", "description": "", "templateType": "anything", "can_override": false}, "mm": {"name": "mm", "group": "Ungrouped variables", "definition": "[1-test,test]", "description": "", "templateType": "anything", "can_override": false}, "sc1ch": {"name": "sc1ch", "group": "Ungrouped variables", "definition": "random(\"flour.\",\"sugar.\",\"dried milk.\",\"instant coffee.\")", "description": "", "templateType": "anything", "can_override": false}, "var2": {"name": "var2", "group": "Ungrouped variables", "definition": "random(\"process variance \",\"population variance \")", "description": "", "templateType": "anything", "can_override": false}, "lci": {"name": "lci", "group": "Ungrouped variables", "definition": "precround(tlci,2)", "description": "", "templateType": "anything", "can_override": false}, "sc": {"name": "sc", "group": "Ungrouped variables", "definition": "\n [\"packs sacks of \"+sc1ch,\n \"manufactures \"+sc2ch,\n \"produces vending machines which fill cups with \"+sc3ch,\n \"in charge of the accounts of a large chain of \"+sc4ch\n ]\n \n ", "description": "", "templateType": "anything", "can_override": false}, "uci": {"name": "uci", "group": "Ungrouped variables", "definition": "precround(tuci,2)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "switch(s=0,\"g\",s=1,\"mm\",s=2,\"ml\",\"pounds\")", "description": "", "templateType": "anything", "can_override": false}, "tuci": {"name": "tuci", "group": "Ungrouped variables", "definition": "m[s]+zval*sqrt(sd1^2/n)", "description": "", "templateType": "anything", "can_override": false}, "zval": {"name": "zval", "group": "Ungrouped variables", "definition": "if(confl=90,1.645,if(confl=95,1.96,2.576))", "description": "", "templateType": "anything", "can_override": false}, "tlci": {"name": "tlci", "group": "Ungrouped variables", "definition": "m[s]-zval*sqrt(sd1^2/n)", "description": "", "templateType": "anything", "can_override": false}, "spec": {"name": "spec", "group": "Ungrouped variables", "definition": "if(s=2,\"the timecards of \", \" \")", "description": "", "templateType": "anything", "can_override": false}, "s": {"name": "s", "group": "Ungrouped variables", "definition": "random(0..abs(sc)-1)", "description": "", "templateType": "anything", "can_override": false}, "test": {"name": "test", "group": "Ungrouped variables", "definition": "if(aim lci,0,1)", "description": "", "templateType": "anything", "can_override": false}, "doornot": {"name": "doornot", "group": "Ungrouped variables", "definition": "if(test=0, \" \",\"does not\")", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "\n [\"bags \",\n sc2ch,\n \"filled cups \",\n \"monthly wage slips \"]\n \n \n ", "description": "", "templateType": "anything", "can_override": false}, "var1": {"name": "var1", "group": "Ungrouped variables", "definition": "random(\"The variance of the filling process \",\"The process variance \")", "description": "", "templateType": "anything", "can_override": false}, "sd2": {"name": "sd2", "group": "Ungrouped variables", "definition": "if(s=3,sd[s]^2,sd[s])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["sd1", "sd2", "howwell", "n", "doornot", "uci", "test", "confl", "spec", "var1", "var3", "var2", "sc2ch", "units", "zval", "sc1ch", "lci", "tuci", "lies", "mm", "dothis", "sc4ch", "m", "correct", "aim", "sc3ch", "s", "tlci", "t", "sc", "sd"], "variable_groups": [], "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": "\n

Calculate a  $\\var{confl}$% confidence interval $(a,b)$ for the population mean:

\n

$a=\\;$[[0]]{units}          $b=\\;$[[1]]{units}

\n

Enter both to 2 decimal places.

\n

 

\n ", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "lci-0.01", "maxValue": "lci+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "uci-0.01", "maxValue": "uci+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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": "\n

{howwell[s]}

\n

[[0]]

\n ", "gaps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes", "No"], "matrix": "mm"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Perform a t-test to decide if two sample means differ, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "description": "", "name": "evi"}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..15)", "description": "", "name": "n1"}, "confl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[90,95,99]", "description": "", "name": "confl"}, "sd1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(65..90)", "description": "", "name": "sd1"}, "correctc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval>1,\"There is evidence to suggest that average call times for male and female employees differ\",\"There is insufficent evidence to suggest that average call times for male and female employees differ\")", "description": "", "name": "correctc"}, "tval1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(m-m1)*sqrt(n1*n2)/(tpsd*sqrt(n1+n2))", "description": "", "name": "tval1"}, "crit": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(precround(x,3),x,[studenttinv((90+100)/200,n-1),studenttinv((95+100)/200,n-1),studenttinv((99+100)/200,n-1)])", "description": "", "name": "crit"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A call centre company wants to know if there is any difference between the average time spent on the telephone, per call to customers, between male and female employees.\"", "description": "", "name": "this"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "n1+n2-1", "description": "", "name": "n"}, "tval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tval1,3)", "description": "", "name": "tval"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval <2, 'retain','reject')", "description": "", "name": "dothis"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"is greater than 10%\",\"lies between 5% and 10%\",\"lies between 1% and 5%\",\"is less than 1%\"]", "description": "", "name": "pm"}, "n2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(20..30)-n1", "description": "", "name": "n2"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"male employees\"", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(220..380#10)", "description": "", "name": "m"}, "evi1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"no\",\"slight\",\"moderate\",\"strong\"]", "description": "", "name": "evi1"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"seconds\"", "description": "", "name": "units"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(55..85)", "description": "", "name": "sd"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(280..400#10)", "description": "", "name": "m1"}, "fac": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,\"There is evidence to suggest that average call times for male and female employees differ\",\"There is insufficent evidence to suggest that average call times for male and female employees differ\")", "description": "", "name": "fac"}, "tpsd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sqrt(((n1-1)*sd^2+(n2-1)*sd1^2)/(n-1))", "description": "", "name": "tpsd"}, "dmm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,[1,0],[0,1])", "description": "", "name": "dmm"}, "that": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the average time spent on the telephone \"", "description": "", "name": "that"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(tvalStep 1: Null hypothesis

\n

If $\\mu_M$ is the mean for time spent by {things} and  $\\mu_F$ is the mean for time spent by {things1} then you are given that:

\n

$\\operatorname{H}_0\\;:\\;\\mu_M=\\mu_F$. 

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;:\\;\\mu_M \\neq \\mu_F$. 

\n

 

\n ", "showCorrectAnswer": true, "scripts": {}, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "t", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "psd+tol", "minValue": "psd-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "tval+tol", "minValue": "tval-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 3: Test statistic

\n

Should we use the z or t test statistic? Input z or t.

\n

[[0]]

\n

Now calculate the pooled standard deviation: [[1]] (to 3 decimal places)

\n

 

\n

Now calculate the test statistic = ? [[2]]  (to 3 decimal places)

\n

 

\n

(Note that in this calculation you should use a value for the pooled standard deviation which is accurate to at least 5 decimal places and not the value you found to 3 decimal places above).

", "showCorrectAnswer": true, "marks": 0}, {"stepsPenalty": 0, "scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}], "type": "gapfill", "prompt": "

Step 4:  p-value range

\n

Use tables to find a range for your p -value. 

\n

Choose the correct range here for p : [[0]]

\n

 

\n

Click on Show steps below to get more information on using the t tables to find the p-value range. You will not lose any marks.

\n

 

", "steps": [{"type": "information", "prompt": "

Click here to get more information about using t tables.

\n

You will also find the critical values of the t tables in this link.

", "showCorrectAnswer": true, "scripts": {}, "marks": 0}], "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}, {"displayType": "radiogroup", "choices": ["Retain", "Reject"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "dmm", "marks": 0}, {"displayType": "radiogroup", "choices": ["{Correctc}", "{Fac}"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [1, 0], "marks": 0}], "type": "gapfill", "prompt": "\n

 Given the $p$ - value and the range you have found, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

[[1]]

\n

 

\n

Conclusion:

\n

[[2]]

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

{this}

\n

A random  sample of $\\var{n1}$  {things} and $\\var{n2}$  {things1} gave the following results in {units}.

\n

{table([['Male',{m},{sd}],['Female',{m1},{sd1}]],[' ','Mean','Standard deviation'])}

\n

Perform an appropriate hypothesis test to see if there is any difference between {that} between {things} and {things1} (the null and alternative hypotheses have been set out for you).

\n ", "tags": ["ACC1012", "accept null hypothesis", "ACE2013", "alternative hypothesis", "checked2015", "comparing means", "degree of freedom", "diagram", "hypothesis testing", "link", "MAS1403", "null hypothesis", "p values", "pooled standard deviation", "population variance", "random sample", "reject null hypothesis", "sample mean", "sampling", "sc", "statistics", "Steps", "steps", "t tables", "t test", "test statistic", "two-tailed test"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

3/01/2012:

\n \t\t

Added tag sc as can be changed to other applications. Perhaps the tables used should be improved.

\n \t\t

Missing a diagram from the original iassess question, hence tag diagram added.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given two sets of data, sample mean and sample standard deviation, on performance on the same task, make a decision as to whether or not the mean times differ. Population variance not given, so the t test has to be used in conjunction with the pooled sample standard deviation.

\n

Link to use of t tables and p-values in Show steps.

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


b)

\n

Step 3 : Test statistic

\n

We should use the   t statistic as the population variance is unknown.

\n

The pooled standard deviation  is given by :

\n

\\[s = \\sqrt{\\frac{\\var{n1 -1} \\times \\var{sd} ^ 2 + \\var{n2 -1} \\times \\var{sd1} ^ 2 }{\\var{n1} + \\var{n2} -2}} = \\var{tpsd} = \\var{psd}\\] to 3 decimal places.

\n

The test statistic is given by \\[t = \\frac{|\\var{m} -\\var{m1}|}{s \\sqrt{\\frac{1}{ \\var{n1} }+\\frac{1}{ \\var{n2}}}} = \\var{tval}\\] to 3 decimal places.

\n

(Using $s=\\var{tpsd}$ in this formula.)

\n

c)

\n

Step 4: p value range.

\n

As  the degree of freedom is $\\var{n1}+\\var{n2}-2=\\var{n-1}$ we use the $t_{\\var{n-1}}$ tables.  We have the following data from the tables:

\n

{table([['Critical Value',crit[0],crit[1],crit[2]]],['p value','10%','5%','1%'])}

\n

We see that the $p$ value {pm[pval]}.

\n

d)

\n

Step 5: Conclusion

\n

Hence there is {evi1[pval]} evidence against $\\operatorname{H}_0$ and so we {dothis} $\\operatorname{H}_0$.

\n

{Correctc}.

"}, {"name": "Perform t-test for hypothesis given sample mean and standard deviation", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "dmm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,[1,0],[0,1])", "description": "", "name": "dmm"}, "thisamount": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(70..90)", "description": "", "name": "thisamount"}, "confl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(90,95,99)", "description": "", "name": "confl"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(tval1,\"There is sufficient evidence against the claim of the flight company.\",\"There is insufficient evidence against the claim of the flight company.\")", "description": "", "name": "correctc"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A rival flight company decides to test their claim.\"", "description": "", "name": "test"}, "crit": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(precround(x,3),x,[studenttinv((90+100)/200,n-1),studenttinv((95+100)/200,n-1),studenttinv((99+100)/200,n-1)])", "description": "", "name": "crit"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"An online flight company makes the following claim:\"", "description": "", "name": "this"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..30)", "description": "", "name": "n"}, "tval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tval1,3)", "description": "", "name": "tval"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval <2, 'retain','reject')", "description": "", "name": "dothis"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"is greater than 10%\",\"lies between 5% and 10%\",\"lies between 1% and 5%\",\"is less than 1%\"]", "description": "", "name": "pm"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "here": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Barcelona\",\"Madrid\",\"Athens\",\"Berlin\",\"Palma\",\"Rome\",\"Paris\",\"Lisbon\")", "description": "", "name": "here"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"customers is taken.\"", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "thisamount+random(1..15)", "description": "", "name": "m"}, "claim": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The average cost of a flight with us to \"+ here + \" is just \u00a3\" + {thisamount} + \" (including all taxes and charges!)\"", "description": "", "name": "claim"}, "evi1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"no\",\"slight\",\"moderate\",\"strong\"]", "description": "", "name": "evi1"}, "tval1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(m-thisamount)*sqrt(n)/stand", "description": "", "name": "tval1"}, "fac": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,\"There is sufficient evidence against the claim of the flight company\",\"There is insufficient evidence against the claim of the flight company.\")", "description": "", "name": "fac"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "description": "", "name": "evi"}, "stand": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..25)", "description": "", "name": "stand"}, "resultis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The mean cost of a flight to \"+ here + \" from this sample is \"", "description": "", "name": "resultis"}}, "ungrouped_variables": ["claim", "pval", "evi1", "crit", "tval1", "things", "stand", "tol", "test", "pm", "correctc", "resultis", "here", "fac", "confl", "evi", "this", "dothis", "m", "dmm", "n", "mm", "thisamount", "tval"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thisamount", "minValue": "thisamount", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thisamount", "minValue": "thisamount", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Step 1: Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;$[[0]]

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\neq\\;$[[1]]

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "t", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "tval+tol", "minValue": "tval-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 3: Test statistic

\n

Should we use the z or t test statistic? [[0]] (enter z or t).

\n

Now calculate the test statistic = ? [[1]] (to 3 decimal places)

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 4: p-value

\n

Use tables to find a range for your $p$-value. 

\n

Choose the correct range here for $p$ : [[0]]

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}, {"displayType": "radiogroup", "choices": ["Retain", "Reject"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "dmm", "marks": 0}, {"displayType": "radiogroup", "choices": ["{Correctc}", "{Fac}"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [1, 0], "marks": 0}], "type": "gapfill", "prompt": "\n

Step 5: Conclusion

\n

 

\n

Given the $p$ - value and the range you have found, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

[[1]]

\n

 

\n

Conclusion:

\n

[[2]]

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

{this} 

\n

{claim}

\n

{test}

\n

A sample of {n} {things}

\n

{resultis} £{m} with a standard  deviation of £{stand}.

\n

Perform an appropriate hypothesis test to see if the claim made by the online flight company is substantiated (use a two-tailed test).

\n ", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

2/01/2012:

\n \t\t

Added tag sc as has string variables in order to generate other scenarios.

\n \t\t

The jstat function studenttinv(critvalue,n-1) gives the critical p values correctly.

\n \t\t

Added tag diagram as the i-assess question advice has a nice graphic of the p-value and the appropriate decision.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Provided with information on a sample with sample mean and standard deviation, but no information on the population variance, use the t test to either accept or reject a given null hypothesis.

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

a)

\n

Step 1: Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;\\var{thisamount}$

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\neq\\;\\var{thisamount}$

\n

b)

\n

We should use the t statistic as the population variance is unknown.

\n

The test statistic:

\n

\\[t =\\frac{ |\\var{m} -\\var{thisamount}|} {\\sqrt{\\frac{\\var{stand} ^ 2 }{\\var{n}}}} = \\var{tval}\\]

\n

to 3 decimal places.

\n

c)

\n

As  $n=\\var{n}$ we use the $t_{\\var{n-1}}$ tables.  We have the following data from the tables:

\n

{table([['Critical Value',crit[0],crit[1],crit[2]]],['p value','10%','5%','1%'])}

\n

We see that the $p$ value {pm[pval]}.

\n


d)

\n

Hence there is {evi1[pval]} evidence against $\\operatorname{H}_0$ and so we {dothis} $\\operatorname{H}_0$.

\n

{Correctc}

\n "}, {"name": "Perform z-test for hypothesis given sample mean and population variance", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "dmm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,[1,0],[0,1])", "description": "", "name": "dmm"}, "confl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(90,95,99)", "description": "", "name": "confl"}, "zval1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(m-thismuch)*sqrt(n)/sqrt(thisvar)", "description": "", "name": "zval1"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(zval1,\"There is sufficient evidence against the claim of the vending company.\",\n \"There is insufficient evidence against the claim of the vending company.\")", "description": "", "name": "correctc"}, "crit": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[1.282,1.645,2.326]", "description": "", "name": "crit"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A vending machine fills cups with \"", "description": "", "name": "this"}, "thismuch": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(140..160)", "description": "", "name": "thismuch"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(50..100)", "description": "", "name": "n"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval <2, 'retain','reject')", "description": "", "name": "dothis"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"is greater than 10%\",\"lies between 5% and 10%\",\"lies between 1% and 5%\",\"is less than 1%\"]", "description": "", "name": "pm"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"cups is taken\"", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "thismuch-random(3..15)", "description": "", "name": "m"}, "claim": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The vending machine company claims each cup should be filled with \"", "description": "", "name": "claim"}, "evi1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"no\",\"slight\",\"moderate\",\"strong\"]", "description": "", "name": "evi1"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'ml'", "description": "", "name": "units"}, "zval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(zval1,3)", "description": "", "name": "zval"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"Customers of the vending machine suspect the machine is under-filling.\"", "description": "", "name": "test"}, "fac": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,\"There is sufficient evidence against the claim of the vending company\",\n \"There is insufficient evidence against the claim of the vending company.\")", "description": "", "name": "fac"}, "var": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the variance of the filling process is known to be \"", "description": "", "name": "var"}, "thisvar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(300..500#10)", "description": "", "name": "thisvar"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"None\",\"Slight\",\"Moderate\",\"Strong\"]", "description": "", "name": "evi"}, "stand": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..25)", "description": "", "name": "stand"}, "resultis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"giving a mean of \"", "description": "", "name": "resultis"}}, "ungrouped_variables": ["claim", "var", "pval", "evi1", "crit", "zval1", "things", "tol", "units", "thismuch", "pm", "correctc", "resultis", "thisvar", "test", "zval", "fac", "confl", "evi", "mm", "dothis", "m", "dmm", "n", "this", "stand"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thismuch", "minValue": "thismuch", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "thismuch", "minValue": "thismuch", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Step 1: Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;$[[0]]

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\lt\\;$[[1]]

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "z", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "zval+tol", "minValue": "zval-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 3: Test statistic

\n

Should we use the z or t test statistic? [[0]] (enter z or t).

\n

Now calculate the test statistic = ? [[1]] (to 3 decimal places)

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{pm[0]}", "{pm[1]}", "{pm[2]}", "{pm[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 4: p-value

\n

Use tables to find a range for your $p$-value. 

\n

Choose the correct range here for $p$ : [[0]]

\n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}, {"displayType": "radiogroup", "choices": ["Retain", "Reject"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "dmm", "marks": 0}, {"displayType": "radiogroup", "choices": ["{Correctc}", "{Fac}"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [1, 0], "marks": 0}], "type": "gapfill", "prompt": "\n

Step 5: Conclusion

\n

 

\n

Given the $p$ - value and the range you have found, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

[[1]]

\n

 

\n

Conclusion:

\n

[[2]]

\n \n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

{this} {stuff}

\n

{claim}$\\var{thismuch}${units} and {var} {thisvar}.

\n

{test}

\n

To investigate a sample of $\\var{n}$ {things} {resultis} $\\var{m}${units}. 

\n

Perform an appropriate hypothesis test to see if the claim made by the customers is substantiated.

\n ", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

2/01/2012:

\n \t\t

Added tag sc as has string variables in order to generate other scenarios.

\n \t\t

Added tag diagram as the i-assess question advice has a nice graphic of the p-value and the appropriate decision.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Provided with information on a sample with sample mean and known population variance, use the z test to either accept or reject a given null hypothesis.

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

a)

\n

Step 1: Null Hypothesis

\n

$\\operatorname{H}_0\\;: \\; \\mu=\\;\\var{thismuch}$

\n

Step 2: Alternative Hypothesis

\n

$\\operatorname{H}_1\\;: \\; \\mu \\lt\\;\\var{thismuch}$

\n

b)

\n

We should use the z statistic as the population variance is known.

\n

The test statistic:

\n

\\[z =\\frac{ |\\var{m} -\\var{thismuch}|} {\\sqrt{\\frac{\\var{thisvar}}{\\var{n}}}} = \\var{zval}\\]

\n

to 3 decimal places.

\n

c)

\n

{table([['Critical Value',crit[0],crit[1],crit[2]]],['p value','10%','5%','1%'])}

\n

We see that the $p$ value {pm[pval]}.

\n


d)

\n

Hence there is {evi1[pval]} evidence against $\\operatorname{H}_0$ and so we {dothis} $\\operatorname{H}_0$.

\n

{Correctc}

\n "}, {"name": "Perform chi-squared test for differences in preferences", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"w": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "name": "w"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "description": "", "name": "tol"}, "dh": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['Retain','Reject']", "description": "", "name": "dh"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(60..90)", "description": "", "name": "a"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(50..69)", "description": "", "name": "c"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(chi1,\"there is evidence to suggest that customers have a preference between the brands.\",\"there is no evidence to suggest that customers have a preference between the brands.\")", "description": "", "name": "correctc"}, "thislong": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"month\",\"week\",\"fortnight\")", "description": "", "name": "thislong"}, "crit": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[precround(chisquareinv(0.9,n-1),2),precround(chisquareinv(0.95,n-1),2),precround(chisquareinv(0.99,n-1),2)]", "description": "", "name": "crit"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"apple juice\", \"orange juice\",\"baked beans\",\"pasta sauce\",\"vegetarian sausages\",\"frozen yorkshire puddings\",\"microwave lasagne\",\"pineapple juice\",\"tinned tuna\",\"low-fat margarine\",\"natural greek yoghurt\",\"mature cheddar\") ", "description": "", "name": "this"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "5", "description": "", "name": "n"}, "x": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(precround((5*y-t)^2/(5*t),2),y,[a,b,c,d,f])", "description": "", "name": "x"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(60..90)", "description": "", "name": "b"}, "chi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(x)", "description": "", "name": "chi"}, "correcth": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval>1,\"we reject the null hypothesis.\",\"we retain the null hypothesis. \")", "description": "", "name": "correcth"}, "dmm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval < 2,[1,0],[0,1])", "description": "", "name": "dmm"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "e1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "t/5", "description": "", "name": "e1"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "b+v*random(10..15)", "description": "", "name": "d"}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+w*random(10..15)", "description": "", "name": "f"}, "choices": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['is greater than $10$%','lies between $10$% and $5$%','lies between $5$% and $1$%','is smaller than $1$%']", "description": "", "name": "choices"}, "fac": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval<2,\"there is evidence to suggest that customers have a preference between the brands.\",\"there is no evidence to suggest that customers have a preference between the brands.\")", "description": "", "name": "fac"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "name": "v"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['None','Slight','Moderate','Strong']", "description": "", "name": "evi"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+b+c+d+f", "description": "", "name": "t"}}, "ungrouped_variables": ["pval", "crit", "n", "chi", "tol", "correctc", "dh", "correcth", "fac", "e1", "a", "evi", "c", "b", "d", "f", "mm", "dmm", "thislong", "choices", "this", "t", "w", "v", "x"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"table1": {"type": "html", "language": "jme", "definition": "tableformat(table2(data,headers,rtot,ctot),data,c,r,rtot,ctot)", "parameters": [["data", "list"], ["headers", "list"], ["c", "boolean"], ["r", "boolean"], ["rtot", "boolean"], ["ctot", "boolean"]]}, "tableformat": {"type": "html", "language": "javascript", "definition": "\n if(c){table.find('td').css('border-right','1px solid').css('border-left','1px solid');}\n \n if(r){table.find('td').css('border-bottom','1px solid');}\n /* Put a border below the headers */\n table.find('thead').css('border-bottom','1px solid');\n /*if row totals, then split off via gridlines*/\n if(rtot){table.find('tr').find('td:last').css('border-right','1px solid').css('border-left','1px solid');}\n \n /* put a border on the right and left of the first column, assuming there are row labels. */\n table.find('tr').find('td:first').css('border-right','1px solid').css('border-left','1px solid'); \n table.find('tr').find('td:last').css('border-right','1px solid'); \n /*make sure there is a border at the bottom*/\n table.find('tr:last').css('border-bottom','1px solid'); \n \n return table;\n \n \n ", "parameters": [["table", "html"], ["data", "list"], ["c", "boolean"], ["r", "boolean"], ["rtot", "boolean"], ["ctot", "boolean"]]}, "table2": {"type": "html", "language": "javascript", "definition": "\n /* create table element */\n var table = $('
');\n /* add headers */\n for(var i=0;i').html(headers[i]));\n }\n if(rtot){ table.find('thead').append('Totals');}\n \n /*for each record in data, add a row to the table*/\n for(var i=0;i');\n var record = data[i];\n var s=0;\n for(var j=0;j').html(record[j])); \n }\n for(var j=1;j').html(s));}\n table.find('tbody').append(row);\n }\n \n /* this function adds a row of totals to the bottom of the table created by the `table` function */\n \n /* compute the totals */\n var row = $('');\n var ctotals=[];\n for(var i=0;iTotals');\n var s=0;\n for(var j=1;j').html(ctotals[j]);\n s+=ctotals[j];\n row.append(cell);\n }\n if(rtot){cell= $('').html(s); row.append(cell);}\n /* add a border to the top and bottom of the totals row */\n row.css('border-top','1px solid');\n row.css('border-bottom','1px solid');\n /* add the totals row to the table */\n table.find('tbody').append(row);\n }\n return table;\n \n \n ", "parameters": [["data", "list"], ["headers", "list"], ["rtot", "boolean"], ["ctot", "boolean"]]}}, "showQuestionGroupNames": false, "parts": [{"type": "information", "prompt": "\n

Step 1: Null hypothesis

\n

$\\operatorname{H}_0:\\;$ Customers do not have a preference for a particular brand of {this}.

\n

Step 2: Alternative hypothesis

\n

$\\operatorname{H}_1:\\;$ Customers do have a preference for a particular brand of {this}.

\n

 

\n ", "showCorrectAnswer": true, "scripts": {}, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e1", "minValue": "e1", "correctAnswerFraction": false, "marks": 0.2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[0]+tol", "minValue": "x[0]-tol", "correctAnswerFraction": false, "marks": 0.6, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e1", "minValue": "e1", "correctAnswerFraction": false, "marks": 0.2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[1]+tol", "minValue": "x[1]-tol", "correctAnswerFraction": false, "marks": 0.6, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e1", "minValue": "e1", "correctAnswerFraction": false, "marks": 0.2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[2]+tol", "minValue": "x[2]-tol", "correctAnswerFraction": false, "marks": 0.6, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e1", "minValue": "e1", "correctAnswerFraction": false, "marks": 0.2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[3]+tol", "minValue": "x[3]-tol", "correctAnswerFraction": false, "marks": 0.6, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e1", "minValue": "e1", "correctAnswerFraction": false, "marks": 0.2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[4]+tol", "minValue": "x[4]-tol", "correctAnswerFraction": false, "marks": 0.6, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "chi+tol", "minValue": "chi-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Step 3: Test statistic

\n

Complete the following table: (input all values in the  expected column $E$  as exact decimals and input in the last column to 2 decimal places).

\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
 $O$$E$$\\displaystyle \\frac{(O-E)^2}{E}$
A$\\var{a}$[[0]][[1]]
B$\\var{b}$[[2]][[3]]
C$\\var{c}$[[4]][[5]]
D$\\var{d}$[[6]][[7]]
E$\\var{f}$[[8]][[9]]
\n

Hence the test statistic is : $\\chi^2=\\;$[[10]]

\n

Input  the test statistic to 2 decimal places.

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n-1", "minValue": "n-1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"displayType": "radiogroup", "choices": ["{choices[0]}", "{choices[1]}", "{choices[2]}", "{choices[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 4:  p-value range

\n

Calculate , the degrees of freedom, for this test: $\\nu=\\;?$[[0]]

\n

Use tables to find a range for your -value.  Choose the correct choice below. 

\n

[[1]]

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{evi[0]}", "{evi[1]}", "{evi[2]}", "{evi[3]}"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}, {"displayType": "radiogroup", "choices": ["Retain", "Reject"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "dmm", "marks": 0}, {"displayType": "radiogroup", "choices": ["{fac}", "{correctc}"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [0, 1], "marks": 0}], "type": "gapfill", "prompt": "\n

Step 5: Conclusion

\n

Given the  - value and the range you have found what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision in relation to the null hypothesis:

\n

[[1]]

\n

Conclusion:

\n

 [[2]]

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

Some marketing research studies indicate the \"positive impact of store brand penetration on store profitability as measured by market share\" (Lal,M.C.(2000). Building Store Loyalty Through Store Brands, Journal of Marketing Research, 37, no. 3, pp281). 

\n

The manager of a local supermarket that sells four national brands (A, B, C and D) and one store brand (E) of {this} wants to find out whether or not customers have a preference for a particular brand. Over the course of a {thislong}, the number of customers buying each brand of {this} was noted; the results are shown in the table below:

\n

{table1([['A',{a}],['B',{b}],['C',{c}],['D',{d}],['E',{f}]],['Brand','No. of Customers'],true,false,false,true)}

\n

Test the null hypothesis that, in fact, customers at this supermarket do not have a preference for a particular brand of {this}.

\n

 

\n ", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t \t\t \t\t

Code to generate tables of different forms, with row or column totals, with or without gridlines. Very messy and assumes that there are row labels, so have to sum from the start of the data for the various sums. Also the row sums and column sums are done in different codes - need to do the column sums in the table function and leave the tableformat function  to do the rest.*

\n \t\t \t\t \t\t

*This has has been done. So table function has options to put in row and column sums.

\n \t\t \t\t \t\t

table(records,['Name','Maths','English','Science'],true,true)

\n \t\t \t\t \t\t

Boolean variables in order give:

\n \t\t \t\t \t\t

Row totals or not.

\n \t\t \t\t \t\t

Column totals or not.

\n \t\t \t\t \t\t

(If column totals are on, then the totals have top and bottom grid lines).

\n \t\t \t\t \t\t

table1(records,['Name','Maths','English','Science'],true,true,true,true)

\n \t\t \t\t \t\t

Boolean variables in order give:

\n \t\t \t\t \t\t

column grid lines or not,

\n \t\t \t\t \t\t

row grid lines or not,

\n \t\t \t\t \t\t

row totals shown or not.

\n \t\t \t\t \t\t

column totals shown or not.

\n \t\t \t\t \n \t\t \n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Uses the $\\chi^2$ test to see if there is any significant difference in preferences.

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

Step 3

\n

 

\n

Completing the table we have $E= \\var{t}/5=\\var{t/5}$ for all brands.

\n

We do the last column calculations for brand A.

\n

$\\displaystyle \\frac{(O -E) ^ 2}{ E} = \\frac{(\\var{a} -\\var{e1}) ^ 2} {\\var{e1}} = \\var{x[0]}$

\n

to 2 decimal places.

\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
 $O$$E$$\\displaystyle \\frac{(O-E)^2}{E}$
A$\\var{a}$$\\var{e1}$$\\var{x[0]}$
B$\\var{b}$$\\var{e1}$$\\var{x[1]}$
C$\\var{c}$$\\var{e1}$$\\var{x[2]}$
D$\\var{d}$$\\var{e1}$$\\var{x[3]}$
E$\\var{f}$$\\var{e1}$$\\var{x[4]}$
   $\\chi^2=\\;\\var{chi}$
\n

The test statistic is then:

\n

\\[\\displaystyle \\chi ^ 2 = \\sum \\frac{(O -E)^2}{E} = \\var{x[0]} + \\var{x[1]} + \\var{x[2]} + \\var{x[3]} + \\var{x[4]} = \\var{chi}\\]

\n

Step 4:

\n

The degrees of freedom is given by: $\\nu$= no. of categories $- 1 = 5-1=4$

\n

The following are the critical values for $\\nu=4$.

\n

{table1([['Critical Value',{crit[0]},{crit[1]},{crit[2]}]],['p-value','10%','5%','1%'],false,false,false,false)}

\n

Looking at this test statistic we see that the p-range {choices[pval]}.

\n

The conclusion we come to is that {correctc} Hence {correcth}

\n "}, {"name": "Perform chi-squared test on 2D frequency table", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"col1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+d+a1+d1+a2", "description": "", "name": "col1"}, "e10": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r4*col1/tot,3)", "description": "", "name": "e10"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(20..35)", "description": "", "name": "b"}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..18)", "description": "", "name": "f1"}, "e11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r4*col2/tot,3)", "description": "", "name": "e11"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(12..20)", "description": "", "name": "d1"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(ch=2,'There is evidence to suggest an association between degree subject and performance.','There is no evidence to suggest an association between degree subject and performance.')", "description": "", "name": "summary"}, "ch7": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((a1-e7)^2/e7,3)", "description": "", "name": "ch7"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..35)", "description": "", "name": "a"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..22)", "description": "", "name": "c"}, "ch": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(ch1+ch2+ch3+ch4+ch5+ch6+ch7+ch8+ch9+ch10+ch11+ch12+ch13+ch14+ch15,3)", "description": "", "name": "ch"}, "e6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r2*col3/tot,3)", "description": "", "name": "e6"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..25)", "description": "", "name": "t"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..20)", "description": "", "name": "a1"}, "col3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "c+t+c1+t1+c2", "description": "", "name": "col3"}, "e8": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r3*col2/tot,3)", "description": "", "name": "e8"}, "ch6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((t-e6)^2/e6,3)", "description": "", "name": "ch6"}, "e9": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r3*col3/tot,3)", "description": "", "name": "e9"}, "presult": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,'is greater than $10$%',pval=1,'lies between $10$% and $5$%',pval=2,'lies between $5$% and $1$%','is less than $1$%')", "description": "", "name": "presult"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,[1,0,0,0],pval=1,[0,1,0,0],pval=2,[0,0,1,0],[0,0,0,1])", "description": "", "name": "mm"}, "e2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r1*col2/tot,3)", "description": "", "name": "e2"}, "e1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r1*col1/tot,3)", "description": "", "name": "e1"}, "e14": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(r5*col2/tot,3)", "description": "", "name": "e14"}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..25)", "description": "", "name": "f"}, "b1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..22)", "description": "", "name": "b1"}, "t99": {"templateType": "anything", "group": "Ungrouped variables", "definition": "20.09", "description": "", "name": "t99"}, "r3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a1+b1+c1", "description": "", "name": "r3"}, "ch3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((c-e3)^2/e3,3)", "description": "", "name": "ch3"}, "ch4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((d-e4)^2/e4,3)", "description": "", "name": "ch4"}, "retain": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(pval>=2,'reject $H_0$ and accept $H_1$','retain $H_0$')", "description": "", "name": "retain"}, "evi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(pval=0,'no',pval=1,'slight',pval=2,'moderate','strong')", "description": "", "name": "evi"}, "ch9": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((c1-e9)^2/e9,3)", "description": "", "name": "ch9"}, "ch13": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((a2-e13)^2/e13,3)", "description": "", "name": "ch13"}}, "ungrouped_variables": ["f1", "ch", "presult", "a", "d", "r2", "pval", "b1", "b2", "t95", "t1", "c1", "d1", "e11", "e10", "e13", "e12", "e15", "e14", "tot", "ch15", "e3", "b", "t", "r4", "ch13", "col2", "col3", "col1", "a1", "a2", "e9", "t99", "ch9", "e5", "e4", "e7", "e6", "e1", "c2", "e2", "ch12", "evi", "c", "ch11", "r1", "ch14", "f", "mm", "ch10", "r3", "summary", "t90", "ch1", "ch2", "ch3", "ch4", "ch5", "ch6", "ch7", "ch8", "retain", "r5", "e8"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"type": "information", "prompt": "\n\n\n

Step 1: Null hypothesis

\n\n\n\n

$H_0$: There is no association between degree subject and performance.

\n\n\n\n

Step 2: Alternate hypothesis

\n\n\n\n

$H_1$: There is an association between degree subject and performance.

\n\n\n \n", "showCorrectAnswer": true, "scripts": {}, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e7", "minValue": "e7", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e8", "minValue": "e8", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e9", "minValue": "e9", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e13", "minValue": "e13", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e14", "minValue": "e14", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "e15", "minValue": "e15", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ch+0.006", "minValue": "ch-0.006", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Step 3: Test statistic

\n

You are given the expected frequencies (all to $3$ decimal places) for Marketing, Marketing & Management and Accounting & Finance.

\n

You have to calculate the expected frequencies for Business Management and Mathematics and put them in the following table.

\n

Input each expected frequency to $3$ decimal places.

\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
EXPECTED FREQUENCIESExcellentStrongAverage
Marketing{e1}{e2}{e3}
Marketing & Management{e4}{e5}{e6}
Business Management[[0]][[1]][[2]]
Accounting & Finance{e10}{e11}{e12}
Mathematics[[3]][[4]][[5]]
\n

In order to test to see if there is an association we compare this table with the table of observed values and calculate the test statistic by finding:

\n

\\[\\chi^2 = \\sum \\frac{(O - E)^2}{E}\\]

\n

Now calculate the test statistic $\\chi^2 = \\phantom{{}}$[[6]] 

\n

Input the test statistic to $3$ decimal places.

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "8", "minValue": "8", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"displayType": "radiogroup", "choices": ["

$p$ is bigger than $10 \\%$

", "

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

", "

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

", "

$p$ is less than $1 \\%$

"], "displayColumns": 1, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "Mm", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 4: $p$-value range

\n

Calculate $\\nu$, the degrees of freedom, for this test.

\n

$\\nu = \\phantom{{}}$[[0]]

\n

Use tables to find a range for your $p$-value. Choose from the options below.

\n

[[1]]

\n \n", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["

None

", "

Slight

", "

Moderate

", "

Strong

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

Retain $H_0$

", "

Reject $H_0$

"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": ["if(pval<2,1,0)", "if(pval>=2,1,0)"], "marks": 0}, {"displayType": "radiogroup", "choices": ["

There is evidence to suggest an association between degree subject and performance.

", "

There is no evidence to suggest an association between degree subject and performance.

"], "displayColumns": 1, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": ["if(pval>=2,1,0)", "if(pval<2,1,0)"], "marks": 0}], "type": "gapfill", "prompt": "\n

Step 5: Conclusion

\n

Given the $p$-value and the range you have found, what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your decision:

\n

[[1]]

\n

Your conclusion:

\n

[[2]]

\n \n", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

The human resources department of a large finance company is attempting to determine if an employee’s performance is influenced by their undergraduate degree subject.

\n

The 5 subjects considered are: Marketing, Marketing & Management, Business Management, Accounting & Finance and Mathematics.

\n

Personnel ratings are grouped as Excellent, Strong and Average.

\n

A recent assessment gave the following results:

\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 \n \n \n \n \n
 ExcellentStrongAverageTotals
Marketing{a}{b}{c}{r1}
Marketing & Management{d}{f}{t}{r2}
Business Management{a1}{b1}{c1}{r3}
Accounting & Finance{d1}{f1}{t1}{r4}
Mathematics{a2}{b2}{c2}{r5}
Totals{col1}{col2}{col3}{tot}
\n

Test the null hypothesis that there is no association between degree subject and performance.

\n", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

3/01/2012:

\n \t\t

This is the example used in the mathssample exam and was translated from the iassess MAS1403 originally. The table is not created from the inbuilt table function. Included tag sc to indicate that this can be used for other applications.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

The human resources department of a large finance company is attempting to determine if an employee’s performance is influenced by their undergraduate degree subject. Personnel ratings are used to judge performance and the task is to use expected frequencies and the chi-squared statistic to test the null hypothesis that there is no association.

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

Step 3

\n

The expected frequencies are given by replacing a value in the table by the expected value:

\n

\\[E = \\frac{\\textrm{row total} \\times \\textrm{column total}}{\\textrm{overall total}}\\]

\n

For example, the Excellent category for Marketing & Management lies in the second row (with sum $\\var{r2}$) and the first column (with sum $\\var{col1}$).

\n

So the expected frequency of Excellent Marketing & Management students is:
\\[E = \\simplify[]{({r2}*{col1})/({tot})} = \\var{e4}\\]

\n

Hence we get the following table of expected frequencies:

\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
EXPECTED FREQUENCIESExcellentStrongAverage
Marketing{e1}{e2}{e3}
Marketing & Management{e4}{e5}{e6}
Business Management{e7}{e8}{e9}
Accounting & Finance{e10}{e11}{e12}
Mathematics{e13}{e14}{e15}
\n

In order to test to see if there is an association we compare this table with the table of observed values and calculate the test statistic by looking at

\n

\\[\\chi^2 = \\sum \\frac{(O - E)^2}{E}\\]

\n

Calculating the values for Business Management and Mathematics, all to 3 decimal places, you should obtain:

\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
$\\frac{(O - E)^2}{E}$ExcellentStrongAverage
Marketing{ch1}{ch2}{ch3}
Marketing & Management{ch4}{ch5}{ch6}
Business Management{ch7}{ch8}{ch9}
Accounting & Finance{ch10}{ch11}{ch12}
Mathematics{ch13}{ch14}{ch15}
\n

To find the $\\chi^2$ statistic you sum these fifteen values to get:

\n

\\[\\begin{eqnarray} \\chi^2 &=& \\var{ch1} + \\var{ch2} + \\var{ch3} + \\var{ch4} + \\var{ch5} +\\\\ && \\var{ch6} + \\var{ch7} + \\var{ch8} + \\var{ch9} + \\var{ch10} +\\\\ && \\var{ch11} + \\var{ch12} + \\var{ch13} + \\var{ch14} + \\var{ch15} \\\\ &=& \\var{ch}. \\end{eqnarray}\\]

\n

Step 4

\n

The degrees of freedom is given by:

\n

\\[\\nu = (\\textrm{no. of rows} - 1) \\times (\\textrm{no. of columns} - 1) = 4 \\times 2 = 8\\]

\n

The following are the critical values for $\\nu = 8$:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$-value$10 \\%$$5 \\%$$1 \\%$
Critical value$\\var{t90}$$\\var{t95}$$\\var{t99}$
\n

Comparing these values with the the test statistic we see that the $p$-value {pResult}.

\n

Step 5: Conclusion

\n

As the $p$-value {pResult}, there is {evi} evidence against $H_0$.

\n

Hence we {retain}.

\n

{summary}

"}, {"name": "Perform chi-squared test to see if data follows Poisson distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"ex5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(x5*thismany,2)", "description": "", "name": "ex5"}, "few1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(few=3,\"two\",\" \")", "description": "", "name": "few1"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+b+c+d+f+t", "description": "", "name": "thismany"}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m*random(0.6..1.6#0.05)", "description": "", "name": "f1"}, "ch99": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(few=2,11.34,9.21)", "description": "", "name": "ch99"}, "cat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(few=3,\"categories\",\"category\")", "description": "", "name": "cat"}, "x5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-sum(x),3)", "description": "", "name": "x5"}, "pval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(ch');\n /* add headers */\n for(var i=0;i').html(headers[i]));\n }\n if(rtot){ table.find('thead').append('Totals');}\n \n /*for each record in data, add a row to the table*/\n for(var i=0;i');\n var record = data[i];\n var s=0;\n for(var j=0;j').html(cell)); \n }\n for(var j=1;j').html(s));}\n table.find('tbody').append(row);\n }\n \n /* this function adds a row of totals to the bottom of the table created by the `table` function */\n \n /* compute the totals */\n var row = $('');\n var ctotals=[];\n for(var i=0;iTotals');\n var s=0;\n for(var j=1;j').html(ctotals[j]);\n s+=ctotals[j];\n row.append(cell);\n }\n if(rtot){cell= $('').html(s); row.append(cell);}\n /* add a border to the top and bottom of the totals row */\n row.css('border-top','1px solid');\n row.css('border-bottom','1px solid');\n /* add the totals row to the table */\n table.find('tbody').append(row);\n }\n return table;\n \n \n ", "parameters": [["data", "list"], ["headers", "list"], ["rtot", "boolean"], ["ctot", "boolean"]]}}, "showQuestionGroupNames": false, "parts": [{"type": "information", "prompt": "\n

Step 1: Null hypothesis

\n

$\\operatorname{H}_0$: The number of calls per minute follows a Poisson distribution.

\n

Step 2: Alternative hypothesis

\n

$\\operatorname{H}_1$: The number of calls per minute does not follow a Poisson distribution.

\n ", "showCorrectAnswer": true, "scripts": {}, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "v", "minValue": "v", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[0]+tol1", "minValue": "x[0]-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[1]+tol1", "minValue": "x[1]-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[2]+tol1", "minValue": "x[2]-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[3]+tol1", "minValue": "x[3]-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x[4]+tol1", "minValue": "x[4]-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "x5+tol1", "minValue": "x5-tol1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex[0]+tol", "minValue": "ex[0]-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex[1]+tol", "minValue": "ex[1]-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex[2]+tol", "minValue": "ex[2]-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex[3]+tol", "minValue": "ex[3]-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex[4]+tol", "minValue": "ex[4]-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ex5+tol", "minValue": "ex5-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "few", "minValue": "few", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ch+tol", "minValue": "ch-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

Step 3: Test statistic

\n

(a) Calculate the Poisson rate parameter to 2 decimal places  

\n

$\\lambda=\\;$?[[0]]

\n

(b) Calculate the Poisson probabilities for each category using the value for $\\lambda$  you have just calculated.

\n

Calculate all probabilities to 3 decimal places.

\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
$P(X=0)$[[1]]
$P(X=1)$[[2]]
$P(X=2)$[[3]]
$P(X=3)$[[4]]
$P(X=4)$[[5]]
$P(X \\gt 4)$[[6]]
\n

 

\n

(Calculate $P(X \\gt 4)$ as $1-P(X=0)-P(X=1)-P(X=2)-P(X=3) - P(X=4)$  using the probabilities you have found).

\n

c) Calculate the expected frequencies to 2 decimal places using the probabilities you have just calculated.

\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
Observed FrequenciesExpected Frequencies
$\\var{a}$[[7]]
$\\var{b}$[[8]]
$\\var{c}$[[9]]
$\\var{d}$[[10]]
$\\var{f}$[[11]]
$\\var{t}$[[12]]
\n

How many categories need to be pooled to make sure that the expected frequency for each category is $\\geq 5$  ?  [[13]]

\n

Hence the test statistic is: $\\chi^2=\\;$?[[14]]

\n

Input the test statistic to 2 decimal places.

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "5-{few}", "minValue": "5-{few}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"displayType": "radiogroup", "choices": ["

$p$ is bigger than $10 \\%$

", "

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

", "

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

", "

$p$ is less than $1 \\%$

"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "Mm", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 4:  p-value range

\n

After pooling, calculate , the degrees of freedom, for this test: . 

\n

$\\nu =\\;$?[[0]]

\n

Use tables to find a range for your -value.  Choose the correct choice below. 

\n

[[1]]

\n

 

\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["None", "Slight", "Moderate", "Strong"], "displayColumns": 0, "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "Mm", "marks": 0}, {"displayType": "radiogroup", "choices": ["Retain $\\operatorname{H}_0$", "Reject $\\operatorname{H}_0$"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "Mc", "marks": 0}, {"displayType": "radiogroup", "choices": ["No evidence to suggest that the number of calls does not follow a Poisson distribution", "There is evidence to suggest that the number of calls does not follow a Poisson distribution"], "displayColumns": 0, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "Mc", "marks": 0}], "type": "gapfill", "prompt": "\n

Step 5: Conclusion

\n

 

\n

Given the  $p$- value and the range you have found what is the strength of evidence against the null hypothesis?

\n

[[0]]

\n

Your Decision:

\n

 [[1]]

\n

Conclusion:

\n

 [[2]]

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "

You are employed as a business analyst for the NHS European Health Insurance Card (EHIC) division.

\n

Before launching a new automatic telephone application system, you are required to find out whether the number of calls made to the department, per minute, follows a Poisson distribution. 

\n

Over a period of {thismany} minutes, the following information was obtained:

\n

{table1([['0',{a}],['1',{b}],['2',{c}],['3',{d}],['4',{f}],['5+',{t}]],['No. of Calls (X)','Frequency per minute'],true,true,false,false)}

", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Find out whether the data presented in this question follows a Poisson distribution. Uses the $\\chi^2$ test.

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

Step 3.

\n

a) $\\lambda$  is the mean of the data i.e.

\n

\\[\\lambda = \\frac{0 \\times \\var{a}+1\\times \\var{b}+2\\times\\var{c}+3\\times\\var{d}+4\\times\\var{f}+5\\times \\var{t}}{\\var{thismany}} = \\var{v}\\] to 2 decimal places.

\n

b) This is the value of $\\lambda$ we use to calculate the probabilities, to 3 decimal places,  assuming that the data is from a Poisson distribution with this parameter.

\n

For example, $ \\displaystyle P(X=2)=\\frac{e^{-\\lambda}\\lambda^2}{2!}=\\frac{e^{-\\var{v}}\\times \\var{v}^2}{2}=\\var{x[2]}$

\n

to 3 decimal places.

\n

The next table shows the values to 3 decimal places you should have obtained:

\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
$P(X=0)$$\\var{x[0]}$
$P(X=1)$$\\var{x[1]}$
$P(X=2)$$\\var{x[2]}$
$P(X=3)$$\\var{x[3]}$
$P(X=4)$$\\var{x[4]}$
$P(X \\gt 4)$$\\var{x5}$
\n

c) Using this probability then the expected number of occurences of 2 calls in a minute is \\[P(X=2) \\times \\var{thismany} = \\var{x[2]}\\times \\var{thismany}=\\var{ex[2]}\\]  to 2 decimal places.

\n

In the same way we find all the expected frequencies assuming that it is a Poisson distribution with parameter $\\lambda=\\var{v}$.

\n

The following table shows the actual observed frequencies and the expected frequencies, to 2 decimal places, under this assumption.

\n

{table1([[{a},{ex[0]}],[{b},{ex[1]}],[{c},{ex[2]}],[{d},{ex[3]}],[{f},{ex[4]}],[{t},{ex5}]],['No. of Calls (X) Observed','Expected Frequency '],true,true,false,false)}

\n

The expected frequencies in the last {few} categories need to be pooled as the {sumofthe}  expected {freq} for the last {few1} {cat} is less than 5.

\n

Hence we obtain the following table used to calculate the test statistic:

\n

{table1([[{a},{ex[0]}],[{b},{ex[1]}],[{c},{ex[2]}],[{dp},{ep4}],[{fq},{eq5}]],['No. of Calls (X) Observed','Expected Frequency '],true,true,false,false)}

\n

We now use the last table to calculate the $\\chi^2$ statistic to see if there is a reasonable match between the observed and expected frequencies. 

\n

We have:

\n

\\[\\chi ^ 2 = \\simplify[all,!collectNumbers]{({a} -{ex[0]}) ^ 2 / {ex[0]} + ({b} -{ex[1]}) ^ 2 / {ex[1]} + ({c} -{ex[2]}) ^ 2 / {ex[2]} + ({dp} -{ep4}) ^ 2 / {ep4} + {z} * (({fp} -{ep5}) ^ 2 / {ep5}) = {ch}}\\] to 2 decimal places.

\n

Step 4:

\n

The degrees of freedom is given by:  $\\nu=\\;$no. of pooled categories $- 2 =\\var{6-few+1}-2=\\var{5-few}$

\n

(We have to take away $2$ from the number of pooled categories as we have estimated the parameter $\\lambda$ .)

\n

The following are the critical values for $\\nu=\\var{5-few}$:

\n

{table1([['Critical Value',{ch90},{ch95},{ch99}]],['p-Value','10%','5%','1%'],false,false,false,false)}

\n

Comparing these values with the the test statistic we see that the  $p$-value {Correct}.

\n

Step 5: Conclusion

\n

Hence there is {evi[pval]} evidence against and so we {cho} the null hypothesis that the number of calls per minute follows a Poisson distribution.

\n

 

\n

 

"}, {"name": "Calculate moving averages, perform linear regression and give seasonal adjustments, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"sdt2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(t2-mt2,1)", "description": "", "name": "sdt2"}, "ms1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(th1+f1+s1+m2+t2)/5", "description": "", "name": "ms1"}, "mf2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(t2+th2+f2+s2+m3)/5", "description": "", "name": "mf2"}, "st": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sat-om,2)", "description": "", "name": "st"}, "sdm2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(m2-mm2,1)", "description": "", "name": "sdm2"}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "th1+random(1..3)", "description": "", "name": "f1"}, "tms": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sm+st+sth+sf+ss)/5", "description": "", "name": "tms"}, "sdth1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(th1-mth1,1)", "description": "", "name": "sdth1"}, "sds1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(s1-ms1,1)", "description": "", "name": "sds1"}, "comm1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(ms=0, \"Since the mean of the seasonal effects is 0, the adjusted seasonal effects are the same as the seasonal effects found above.\", \" \")", "description": "", "name": "comm1"}, "tol1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1", "description": "", "name": "tol1"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "m1"}, "asth": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sth-ms,2)", "description": "", "name": "asth"}, "t3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(t2,m3)+random(1..2)", "description": "", "name": "t3"}, "s1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "f1+random(1..2)", "description": "", "name": "s1"}, "sdf1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(f1-mf1,1)", "description": "", "name": "sdf1"}, "ms": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tms,2)", "description": "", "name": "ms"}, "ti": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(16..19)", "description": "", "name": "ti"}, "thisdate": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(ti=16,\"Monday 28th April\",if(ti=17,\"Tuesday, 29th April\",if(ti=18,\"Thursday, 1st May\",\"Friday,2nd May\")))", "description": "", "name": "thisdate"}, "sumysquared": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mth1^2+mf1^2+ms1^2+mm2^2+mt2^2+mth2^2+mf2^2+ms2^2+mm3^2+mt3^2+mth3^2", "description": "", "name": "sumysquared"}, "sdm3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(m3-mm3,1)", "description": "", "name": "sdm3"}, "th3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(th2,t3)+random(1..2)", "description": "", "name": "th3"}, "estord": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(estal+estbe*ti+adj+0.00000001)", "description": "", "name": "estord"}, "t1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m1+random(1..3)", "description": "", "name": "t1"}, "f3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(f2,th3)+random(1..2)", "description": "", "name": "f3"}, "syy": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sumysquared-11*meany^2", "description": "", "name": "syy"}, "sds2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(s2-ms2,1)", "description": "", "name": "sds2"}, "thisday": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(ti=16 ,\"Monday\",if(ti=17 ,\"Tuesday\",if(ti=18,\"Thursday\",\"Friday\")))", "description": "", "name": "thisday"}, "ss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sas-om,2)", "description": "", "name": "ss"}, "mth1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(m1+t1+th1+f1+s1)/5", "description": "", "name": "mth1"}, "testbe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sumty-11*meany*meant)/110", "description": "", "name": "testbe"}, "sdth3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(th3-mth3,1)", "description": "", "name": "sdth3"}, "m2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m1+random(0..2)", "description": "", "name": "m2"}, "mt2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(s1+m2+t2+th2+f2)/5", "description": "", "name": "mt2"}, "sf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(saf-om,2)", "description": "", "name": "sf"}, "sdt3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(t3-mt3,1)", "description": "", "name": "sdt3"}, "th2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(th1,t2)+random(1..2)", "description": "", "name": "th2"}, "mt3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(s2+m3+t3+th3+f3)/5", "description": "", "name": "mt3"}, "sat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sdt2+sdt3)/2", "description": "", "name": "sat"}, "ast": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(st-ms,2)", "description": "", "name": "ast"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "description": "", "name": "tol"}, "saf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sdf1+sdf2)/2", "description": "", "name": "saf"}, "sath": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((sdth1+sdth2+sdth3)/3,2)", "description": "", "name": "sath"}, "s2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(s1,f2)+random(1..2)", "description": "", "name": "s2"}, "m3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m2+random(0..2)", "description": "", "name": "m3"}, "mm2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(f1+s1+m2+t2+th2)/5", "description": "", "name": "mm2"}, "sth": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sath-om,2)", "description": "", "name": "sth"}, "testal": {"templateType": "anything", "group": "Ungrouped variables", "definition": "meany-estbe*meant", "description": "", "name": "testal"}, "mm3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(f2+s2+m3+t3+th3)/5", "description": "", "name": "mm3"}, "sumty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "3*mth1+4*mf1+5*ms1+6*mm2+7*mt2+8*mth2+9*mf2+10*ms2+11*mm3+12*mt3+13*mth3", "description": "", "name": "sumty"}, "mf1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(t1+th1+f1+s1+m2)/5", "description": "", "name": "mf1"}, "mth3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(m3+t3+th3+f3+s3)/5", "description": "", "name": "mth3"}, "mth2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(m2+t2+th2+f2+s2)/5", "description": "", "name": "mth2"}, "om": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tom,3)", "description": "", "name": "om"}, "f2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(f1,th2)+random(1..2)", "description": "", "name": "f2"}, "sdf2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(f2-mf2,1)", "description": "", "name": "sdf2"}, "tom": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sdth1+sdf1+sds1+sdm2+sdt2+sdth2+sdf2+sds2+sdm3+sdt3+sdth3)/11", "description": "", "name": "tom"}, "sam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sdm2+sdm3)/2", "description": "", "name": "sam"}, "comm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(om=0, \"Since the mean of the seasonal deviations is 0, these seasonal effects are the same as the seasonal means found above.\", \" \")", "description": "", "name": "comm"}, "asm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sm-ms,2)", "description": "", "name": "asm"}, "th1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "t1+random(1..3)", "description": "", "name": "th1"}, "sm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sam-om,2)", "description": "", "name": "sm"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"A satellite TV store\",\"An electrical store\",\"A plasma TV shop\",\"A computer hardware store\",\"A furniture store\",\"A DIY store\")", "description": "", "name": "this"}, "t2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(t1,m2)+random(1..2)", "description": "", "name": "t2"}, "ass": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(ss-ms,2)", "description": "", "name": "ass"}, "summa": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mth1+mf1+ms1+mm2+mt2+mth2+mf2+ms2+mm3+mt3+mth3", "description": "", "name": "summa"}, "asf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sf-ms,2)", "description": "", "name": "asf"}, "adj": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(ti=16 ,asm,if(ti=17,ast,if(ti=18,asth,asf)))", "description": "", "name": "adj"}, "estal": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(testal,2)", "description": "", "name": "estal"}, "meany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "summa/11", "description": "", "name": "meany"}, "estbe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(testbe,2)", "description": "", "name": "estbe"}, "sas": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(sds1+sds2)/2", "description": "", "name": "sas"}, "meant": {"templateType": "anything", "group": "Ungrouped variables", "definition": "8", "description": "", "name": "meant"}, "s3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(s2,f3)+random(1..2)", "description": "", "name": "s3"}, "sdth2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(th2-mth2,1)", "description": "", "name": "sdth2"}, "ms2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(th2+f2+s2+m3+t3)/5", "description": "", "name": "ms2"}}, "ungrouped_variables": ["f1", "f2", "f3", "sdf2", "sdf1", "thisdate", "t2", "saf", "mm3", "mm2", "this", "mt2", "sas", "t1", "sat", "asth", "tms", "mth3", "sam", "mth1", "sdth3", "s3", "s2", "s1", "sds1", "th3", "th2", "th1", "m1", "m3", "tom", "sath", "sdm3", "adj", "thisday", "sdt3", "sdt2", "ass", "comm1", "tol", "tol1", "ast", "m2", "meany", "testal", "t3", "sdm2", "mf2", "comm", "asf", "sumysquared", "sdth1", "syy", "sm", "asm", "mth2", "testbe", "om", "sdth2", "summa", "estbe", "mf1", "meant", "sumty", "sth", "ms2", "ms1", "st", "ss", "ms", "mt3", "ti", "sds2", "sf", "estal", "estord"], "functions": {}, "variable_groups": [], "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Complete the following table, showing the moving averages for the number of orders based on a five-observation cycle. The first one has been done for you. Input all moving averages to one decimal place.

\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
MonTuesThurFriSat
7/4/08**$\\var{mth1}$[[0]][[1]]
14/4/08[[2]][[3]][[4]][[5]][[6]]
21/4/08[[7]][[8]][[9]]**
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "{mf1}", "maxValue": "{ms1}", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ms1", "maxValue": "ms1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mm2", "maxValue": "mm2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mt2", "maxValue": "mt2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mth2", "maxValue": "mth2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mf2", "maxValue": "mf2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ms2", "maxValue": "ms2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mm3", "maxValue": "mm3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mt3", "maxValue": "mt3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "mth3", "maxValue": "mth3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Fit the linear regression model $Y=\\alpha+\\beta T+\\epsilon$  to this set $Y$ of moving averages, where $T$ represents time. ($T=1$ for 7/4/08,  $T=2$ for 8/4/08,  $T=3$ for 10/4/08 etc.)

\n

You may use the following summaries:

\n

$\\sum t=88,\\;\\;\\sum y=\\var{summa},\\;\\;\\sum ty=\\var{sumty},\\;\\; \\sum t^2=814,\\;\\;\\sum y^2=\\var{sumysquared}$.

\n

Estimate for $\\beta= \\;$[[0]] (estimate to 2 decimal places).

\n

Estimate for $\\alpha= \\;$[[1]] (estimate to 2 decimal places). Use the estimate for $\\beta$ to 2 decimal places to estimate $\\alpha$.

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "estbe-tol", "maxValue": "estbe+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "estal-tol", "maxValue": "estal+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Complete the following table, showing the seasonal deviations and seasonal means for each day of the week:

\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
MonTuesThurFriSat
7/4/08**[[0]][[1]][[2]]
14/4/08[[3]][[4]][[5]][[6]][[7]]
21/4/08[[8]][[9]][[10]]**
Seasonal Mean[[11]][[12]][[13]][[14]][[15]]
\n

Input all entries to 2 decimal places.

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdth1", "maxValue": "sdth1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdf1", "maxValue": "sdf1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sds1", "maxValue": "sds1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdm2", "maxValue": "sdm2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdt2", "maxValue": "sdt2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdth2", "maxValue": "sdth2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdf2", "maxValue": "sdf2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sds2", "maxValue": "sds2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdm3", "maxValue": "sdm3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdt3", "maxValue": "sdt3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sdth3", "maxValue": "sdth3", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sam", "maxValue": "sam", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sat", "maxValue": "sat", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sath-tol", "maxValue": "sath+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "saf", "maxValue": "saf", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sas", "maxValue": "sas", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.25, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Calculate the (unadjusted) seasonal effects for each day of the week: (input all your answers to 2 decimal places).

\n

Seasonal effect for Monday:   $S_M=\\;$    [[0]]                     

\n

Seasonal effect for Tuesday:   $S_T=\\;$ [[1]]

\n

Seasonal effect for Thursday:   $S_{Thu}=\\;$  [[2]]     

\n

Seasonal effect for Friday:        $S_F=\\;$ [[3]]

\n

Seasonal effect for Saturday:    $S_{Sa}=\\;$ [[4]]

\n

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sm-tol", "maxValue": "sm+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "st-tol", "maxValue": "st+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sth-tol", "maxValue": "sth+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "sf-tol", "maxValue": "sf+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ss-tol", "maxValue": "ss+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Calculate the adusted seasonal effects for each day of the week: (input all your answers to 2 decimal places).

\n

Adjusted seasonal effect for Monday:   $S_M=\\;$    [[0]]                     

\n

Adjusted seasonal effect for Tuesday:   $S_T=\\;$ [[1]]

\n

Adjusted seasonal effect for Thursday:   $S_{Thu}=\\;$  [[2]]     

\n

Adjusted seasonal effect for Friday:        $S_F=\\;$ [[3]]

\n

Adjusted seasonal effect for Saturday:    $S_{Sa}=\\;$ [[4]]

\n

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "asm-tol", "maxValue": "asm+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ast-tol", "maxValue": "ast+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "asth-tol", "maxValue": "asth+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "asf-tol", "maxValue": "asf+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ass-tol", "maxValue": "ass+tol", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "

Use the regression equation in part 2 and the adjusted seasonal effects in part 5 to forecast the number of orders on {thisdate}

\n

Estimated orders on {thisdate} = ?[[0]]  (input to the nearest whole number)

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "estord-tol1", "maxValue": "estord+tol1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 2, "showFeedbackIcon": true}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "

{This} has recently opened for business and is open  5 days a week, Monday, Tuesday, Thursday, Friday and Saturday. The number of orders each day during the first three weeks of business is shown below:

\n

{table([[\"7/4/08\",{m1},{t1},{th1},{f1},{s1}],[\"14/4/08\",{m2},{t2},{th2},{f2},{s2}],[\"21/4/08\",{m3},{t3},{th3},{f3},{s3}]],[\" \",\"Mon\",\"Tues\",\"Thur\",\"Fri\",\"Sat\"])}

\n

", "tags": ["checked2015", "forecasting", "moving averages", "regression", "seasonal adjustments", "seasonality", "statistics", "time series"], "rulesets": {}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Moving averages, regression and seasonal adjustments.

"}, "advice": "

a)

\n

 The completed moving average table is as follows:

\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
MonTuesThurFriSat
7/4/08**$\\var{mth1}$$\\var{mf1}$$\\var{ms1}$
14/4/08$\\var{mm2}$$\\var{mt2}$$\\var{mth2}$$\\var{mf2}$$\\var{ms2}$
21/4/08$\\var{mm3}$$\\var{mt3}$$\\var{mth3}$**
\n

b)

\n

The mean value of $T$ is $\\overline{t}=\\frac{3+4+\\cdots+13}{11}=\\frac{88}{11}=8$.

\n

The mean value of $Y$ is $\\overline{y}=\\frac{\\var{summa}}{11}=\\var{meany}$.

\n

We have:

\n

\\[\\begin{align}S_{TY}&=\\sum ty-11\\overline{t}\\overline{y}=\\var{sumty}-11\\times 8 \\times\\var{ meany}\\\\
S_{YY}&=\\sum y^2-11\\overline{y}^2=\\var{sumysquared}-11\\var{meany}^2=\\var{syy}\\\\
S_{TT}&=\\sum t^2-11\\overline{t}^2=814-11\\times 64=110
\\end{align}\\]

\n

Estimate for $\\beta$ is $\\frac{S_{TY}}{S_{TT}}=\\var{testbe}=\\var{estbe}$ to 2 decimal places.

\n

Estimate for $\\alpha$ is $\\overline{y}-\\beta\\overline{t}=\\var{meany}-\\var{estbe}\\times\\var{meant}=\\var{testal}=\\var{estal}$ to 2 decimal places.

\n

So the linear regression equation is $Y=\\simplify{{estal}+{estbe}T}+\\epsilon$ coefficients to 2 decimal places.

\n

c)

\n

The following table shows the calculated seasonal deviations and seasonal means for each day of the week. These are obtained by taking the moving average data away from the original data on orders. The seasonal means for the days are obtained by taking the means in each column.

\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
MonTuesThurFriSat
7/4/08**$\\var{sdth1}$$\\var{sdf1}$$\\var{sds1}$
14/4/08$\\var{sdm2}$$\\var{sdt2}$$\\var{sdth2}$$\\var{sdf2}$$\\var{sds2}$
21/4/08$\\var{sdm3}$$\\var{sdt3}$$\\var{sdth3}$**
Seasonal Mean$\\var{sam}$$\\var{sat}$$\\var{sath}$$\\var{saf}$$\\var{sas}$
\n

d) The seasonal effects for each day of the week are calculated by first finding the means of all the seasonal deviations found in the last table (not including the seasonal means in the last row). Then you take this away from the seasonal mean for each day.

\n

We find that the mean of the seasonal deviations is:

\n

\\[\\simplify[all,!collectNumbers]{({sdth1} + {sdf1} + {sds1} + {sdm2} + {sdt2} + {sdth2} + {sdf2} + {sds2} + {sdm3} + {sdt3} + {sdth3}) / 11} = \\var{om}\\]to 3 decimal places.

\n

{comm}

\n

Seasonal effect for Monday: $S_M=\\;\\simplify[all,!collectNumbers]{{sam}-{om}}=\\var{sm}$ to 2 decimal places.

\n

Seasonal effect for Tuesday: $S_T=\\simplify[all,!collectNumbers]{{sat}-{om}}=\\var{st}$ to 2 decimal places.

\n

Seasonal effect for Thursday: $S_{Thu}=\\simplify[all,!collectNumbers]{{sath}-{om}}=\\var{sth}$ to 2 decimal places.

\n

Seasonal effect for Friday: $S_F=\\simplify[all,!collectNumbers]{{saf}-{om}}=\\var{sf}$ to 2 decimal places.

\n

Seasonal effect for Saturday: $S_{Sa}=\\simplify[all,!collectNumbers]{{sas}-{om}}=\\var{ss}$ to 2 decimal places.

\n

e)

\n

We further adjust the seasonal effects for each day by finding the mean of the seasonal effects we have just found and then taking this away from each of the seasonal effects.

\n

We find that the mean of the seasonal deviations is:

\n

\\[\\simplify[all,!collectNumbers]{({sm} + {st} + {sth} + {sf} + {ss} ) / 5} = \\var{ms}\\] to 3 decimal places.

\n

{comm1}

\n

Adjusted seasonal effect for Monday $\\;=\\simplify[all,!collectNumbers]{{sm}-{ms}}=\\var{asm}$ to 2 decimal places.

\n

Adjusted seasonal effect for Tuesday$\\;=\\simplify[all,!collectNumbers]{{st}-{ms}}=\\var{ast}$ to 2 decimal places.

\n

Adjusted seasonal effect for Thursday$\\;=\\simplify[all,!collectNumbers]{{sth}-{ms}}=\\var{asth}$ to 2 decimal places.

\n

Adjusted seasonal effect for Friday$\\;=\\simplify[all,!collectNumbers]{{sf}-{ms}}=\\var{asf}$ to 2 decimal places.

\n

Adjusted seasonal effect for Saturday $\\;=\\simplify[all,!collectNumbers]{{ss}-{ms}}=\\var{ass}$ to 2 decimal places.

\n

f)

\n

We use the regression equation found above  $Y=\\simplify[all,!collectNumbers]{{estal}+{estbe}T}+\\epsilon$  to estimate the number of orders on {thisdate}.

\n

\n

But we have to adjust for seasonality using the adjusted seasonal effect found above by adding on the adjusted seasonal effect for {thisday} i.e. $\\var{adj}$.

\n

Note that $T=1$ corresponds to 7/4/08 and hence $T=\\var{ti}$ for {thisdate}.

\n

So putting $T=\\var{ti}$ gives  $Y=\\simplify[all,!collectNumbers]{{estal}+{estbe}*{ti}+{adj}}=\\var{estal+estbe*ti+adj}=\\var{estord}$  orders to the nearest whole number.

\n

\n

"}, {"name": "Find regression equation and correlation coefficient, ", "extensions": ["stats", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[random(0..6),random(1..7),random(4..10),random(7..13),random(12..18),random(4..20),random(16..22),random(19..25),random(17..23),random(13..19),random(8..14),random(3..9)]", "description": "", "name": "r1"}, "spxy": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sxy-t[0]*t[1]/n", "description": "", "name": "spxy"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "description": "", "name": "a"}, "tcorr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "spxy/sqrt(ss[0]*ss[1])", "description": "", "name": "tcorr"}, "ssq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "description": "", "name": "ssq"}, "prediction": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(a+b*thisval)", "description": "", "name": "prediction"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[sum(r1),sum(r2)]", "description": "", "name": "t"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..20)", "description": "", "name": "a1"}, "sumr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sum(map(res[x]^2,x,0..n-1)),3)", "description": "", "name": "sumr"}, "tol1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "description": "", "name": "tol1"}, "beverage": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"home-brewed beer\",\"home-brewed lager\",\"specially-brewed beer\",\"super-strength lager\",\"cold-filtered lager\",\"ice-filtered cider\",\"cherry cider\")", "description": "", "name": "beverage"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "12", "description": "", "name": "n"}, "ss": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "description": "", "name": "ss"}, "corr": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tcorr,2)", "description": "", "name": "corr"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(spxy/ss[0],3)", "description": "", "name": "b"}, "pub": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Black Bull Inn\",\"County Inn\",\"Dog and Duck Pub\",\"Slug and Lettuce Pub\", \"Cross Keys Pub\",\"Newcastle Arms Pub\",\"Red Lion Pub\")", "description": "", "name": "pub"}, "res": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "description": "", "name": "res"}, "ch": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..11)", "description": "", "name": "ch"}, "sc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r1[ch]", "description": "", "name": "sc"}, "b1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.25..0.45#0.05)", "description": "", "name": "b1"}, "sxy": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "description": "", "name": "sxy"}, "thisval": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..22)", "description": "", "name": "thisval"}, "obj": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['Jan','Feb','March','April','May','June','July','August','Sept','Oct','Nov','Dec']", "description": "", "name": "obj"}, "owner": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Kevin\",\"Mary\",\"Bill\",\"Doreen\",\"Peter\",\"Helen\",\"Michael\",\"Samantha\")", "description": "", "name": "owner"}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(round(a1+b1*x+random(-9..9)),x,r1)", "description": "", "name": "r2"}, "ls": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(a+b*sc,2)", "description": "", "name": "ls"}, "tsqovern": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[t[0]^2/n,t[1]^2/n]", "description": "", "name": "tsqovern"}, "rsquared": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(spxy^2/(ss[0]*ss[1]),3)", "description": "", "name": "rsquared"}}, "ungrouped_variables": ["ch", "prediction", "b1", "owner", "sxy", "res", "spxy", "ls", "tol", "tcorr", "a", "ssq", "sumr", "pub", "a1", "thisval", "corr", "tsqovern", "b", "obj", "r1", "r2", "ss", "tol1", "n", "beverage", "t", "sc", "rsquared"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"regressline": {"type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n{boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:false});\n var board = div.board; \nvar l1=board.create('text',[maxx/2,-2,'Temperature']);\nvar l2=board.create('text',[-2,maxy/2,'Sales']);\nvar names = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\nfor (j=0;j<12;j++){ board.create('point',[r1[j],r2[j]],{fixed:true, style:3,name:'\\\\\\\\['+names[j]+'\\\\\\\\]'})};\nvar a1 = board.create('point',[minx+5,miny+5],{color:'blue'});\nvar b1 = board.create('point',[minx+7,miny+5],{color:'blue'});\nfunction updr(a,b){\n var s=0;\n for(var i=0;i<12;i++){\ns=s+Math.pow(r2[i]-a*r1[i]-b,2);}\ns=Numbas.math.niceNumber(Numbas.math.precround(s,2));\n$('#rsquared').text(s);}\n var li=board.create('line',[a1,b1], {straightFirst:false, straightLast:false});\n var a=0;\n var b=0;\n function dr(p){\n p.on('drag',function(){\n a = Numbas.math.niceNumber((b1.Y()-a1.Y())/(b1.X()-a1.X()));\n b = Numbas.math.niceNumber((a1.Y()*b1.X()-a1.X()*b1.Y())/(b1.X()-a1.X()));\n Numbas.exam.currentQuestion.parts[1].gaps[0].display.studentAnswer(a);\n Numbas.exam.currentQuestion.parts[1].gaps[1].display.studentAnswer(b);\n updr(a,b);\n })};\n dr(a1);\n dr(b1);\n \nreturn div;\n\n \n", "parameters": [["r1", "list"], ["r2", "list"], ["minx", "number"], ["maxx", "number"], ["miny", "number"], ["maxy", "number"]]}, "regfun": {"type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n{boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:true});\n var board = div.board; \nvar l1=board.create('text',[maxx/2,-2,'Temperature']);\nvar l2=board.create('text',[-2,maxy/2,'Sales']);\n var names = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\n for (j=0;j<12;j++){ board.create('point',[r1[j],r2[j]],{fixed:true, style:3, strokecolor:\"#0000a0\", name:'\\\\\\\\['+names[j]+'\\\\\\\\]'})};\nvar regressionPolynomial = JXG.Math.Numerics.regressionPolynomial(1, r1, r2);\nvar reg = board.create('functiongraph',[regressionPolynomial],{strokeColor:'blue',name:'Regression Line.',withLabel:true}); \n //for(var i=0;i<12;i++){board.create(\"segment\",[[r1[i],r2[i]],[r1[i],regressionPolynomial(r1[i])]])};\nvar regExpression = regressionPolynomial.getTerm();\nvar regTeX = Numbas.jme.display.exprToLaTeX(regExpression,[],scope);\n\n//var t = board.create('text',[1,5,\n//function(){ return \"\\\\[r(Y) = \" + regExpression +'\\\\]';}\n//],\n//{strokeColor:'black',fontSize:18}); \n\nreturn div;\n \n", "parameters": [["r1", "list"], ["r2", "list"], ["maxx", "number"], ["maxy", "number"], ["rsquared", "number"], ["sumr", "number"]]}}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "corr+tol1", "minValue": "corr-tol1", "correctAnswerFraction": false, "marks": 4, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Calculate the sample correlation coefficient $r$ for these data:

\n

$r=\\;$[[0]] (enter to 2 decimal places).

", "showCorrectAnswer": true, "marks": 0}, {"stepsPenalty": 0, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "b+tol", "minValue": "b-tol", "correctAnswerFraction": false, "marks": 2, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "a+tol", "minValue": "a-tol", "correctAnswerFraction": false, "marks": 2, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Calculate the equation of the best fitting regression line.

\n

\\[Y = \\alpha + \\beta X.\\] Find $\\alpha$ and $\\beta$ to 5 decimal places, then input them below to 3 decimal places. You will use these approximate values in the rest of the question. 

\n

$\\beta=\\;$[[0]],      $\\alpha=\\;$[[1]] (enter both to 3 decimal places).

\n

\n

Click on Show steps if you want more information on calculating $\\alpha$ and $\\beta$. You will not lose any marks by doing so.

\n

 

", "steps": [{"type": "information", "prompt": "

To find $\\alpha$ and $\\beta$ you first find  $\\displaystyle \\beta = \\frac{S_{XY}}{S_{XX}}$ where:

\n

$\\displaystyle S_{XY}=\\sum xy - n\\overline{x}\\overline{y}$

\n

$\\displaystyle S_{XX}=\\sum x^2 - n\\overline{x}^2$

\n

Then $\\displaystyle \\alpha = \\overline{y}-\\beta \\overline{x}$

\n

Now go back and fill in the values for $\\alpha$ and $\\beta$.

", "showCorrectAnswer": true, "scripts": {}, "marks": 0}], "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prediction+1", "minValue": "prediction-1", "correctAnswerFraction": false, "marks": 2, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Next month, the average temperature in {owner}'s town is forecast to be  $\\var{thisval}^{\\small o}$C. Use the regression equation in the second part to predict sales of the {beverage} in that month.

\n

What is the predicted value of sales (in hundreds of pounds) ?

\n

Use the values of $\\alpha$ and $\\beta$ you input above to 3 decimal places.

\n

Enter the predicted sales here:  [[0]] (hundreds of pounds to the nearest whole number).

\n

", "showCorrectAnswer": true, "marks": 0}], "statement": "

{owner} owns the {pub}. {owner} believes that sales of {beverage} in the pub are linked to the average monthly temperature, with higher sales being recorded in months with higher temperatures. To investigate, {owner} records the average monthly temperature in the local town over a period of one year ($X$ degrees Celsius), along with total monthly sales of {beverage} ($Y$ hundred pounds). The results are shown in the table below: 

\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
Month$\\var{obj[0]}$$\\var{obj[1]}$$\\var{obj[2]}$$\\var{obj[3]}$$\\var{obj[4]}$$\\var{obj[5]}$$\\var{obj[6]}$$\\var{obj[7]}$$\\var{obj[8]}$$\\var{obj[9]}$$\\var{obj[10]}$$\\var{obj[11]}$
$X$ (temperature)$\\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]}$$\\var{r1[10]}$$\\var{r1[11]}$
$Y$ (sales, £100s)$\\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]}$$\\var{r2[10]}$$\\var{r2[11]}$
\n

You are given the following information:

\n\n\n\n\n\n\n\n\n\n\n\n
$X$ $\\sum x=\\;\\var{t[0]}$$\\sum x^2=\\;\\var{ssq[0]}$
$Y$$\\sum y=\\;\\var{t[1]}$$\\sum y^2=\\;\\var{ssq[1]}$
\n

Also you are given $\\sum xy = \\var{sxy}$.

", "tags": ["ACC1012", "checked2015", "correlation", "data analysis", "fitted value", "linear regression", "MAS1043", "regression", "statistics"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

04/02/2014:

\n

No advice as yet. Adapted from iassess question for ACE.

\n

18/02/2014:

\n

Slight changes in notation from Regression 3. No SSE

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Find a regression equation given 12 months data on temperature and sales of a drink. 

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

For part a) you calculate $r$ using:

\n

\\[r=\\frac{S_{XY}}{\\sqrt{S_{XX} \\times S_{YY}}}\\] where :

\n

$\\displaystyle S_{XY}=\\sum xy - n\\overline{x}\\overline{y}$

\n

$\\displaystyle S_{XX}=\\sum x^2 - n\\overline{x}^2$

\n

$\\displaystyle S_{YY}=\\sum y^2 - n\\overline{y}^2$

\n

For part b): The regression line has equation:

\n

$\\simplify[all,!collectNumbers]{Y={a}+{b}X}$ and this is displayed below:  

\n

\n

{regfun(r1,r2,max(r1)+10,max(r2)+10,rsquared,sumr)}

\n

For part c):

\n

Predicted sales whem $X=\\var{thisval}^{\\small o}$C:

\n

\\[\\begin{align} Y&=\\simplify[all,!collectNumbers]{{a}+{b}* {thisval}}\\\\
&=\\var{{a+b*thisval}}\\\\
&=\\var{prediction}
\\end{align}\\] to nearest whole number of hundreds of pounds.

"}], "name": "", "pickQuestions": 0}], "name": "Quantitative Methods for Business Management", "showQuestionGroupNames": false, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Questions used in a university course titled \"Quantitative Methods for Business Management\""}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "extensions": ["jsxgraph", "stats"], "custom_part_types": [], "resources": []}