// Numbas version: finer_feedback_settings {"name": "SM11 Linear Interpolation", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "SM11 Linear Interpolation", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "
This frequence table stores data about the lengths of some plants:
\n| Length ($x$ cm) | \nFrequency | \n
| 10 < $x$ $\\leq$ 20 | \n{f1} | \n
| 20 < $x$ $\\leq$ 30 | \n{f2} | \n
| 30 < $x$ $\\leq$ 40 | \n{f3} | \n
| 40 < $x$ $\\leq$ 50 | \n{f4} | \n
a)
\nTo find the median we must find the middle value. To do this we sum the frequencies and divide the result by 2:
\n$\\frac{\\var{f1}+\\var{f2}+\\var{f3}+\\var{f4}}{2} = \\frac{\\var{total}}{2} = \\var{middle1}$.
\nHence we must find value number $\\var{middle1}$, we can do this by totalling the cumulative frequency in the table below.
\n| \n Length $x$ cm \n | \nFrequency | \nCumulative Frequency | \n
| 1. 10 < $x$ $\\leq$ 20 | \n{f1} | \n$\\var{f1}$ | \n
| 2. 20 < $x$ $\\leq$ 30 | \n{f2} | \n$\\var{f1}+\\var{f2}=\\var{cf2}$ | \n
| 3. 30 < $x$ $\\leq$ 40 | \n{f3} | \n$\\var{f1}+\\var{f2} +\\var{f3} =\\var{cf3}$ | \n
| 4. 40 < $x$ $\\leq$ 50 | \n{f4} | \n$\\var{f1}+\\var{f2} +\\var{f3} + \\var{f4} =\\var{total}$ | \n
You can see value number $\\var{middle1}$ lies in interval number $\\var{interval1}$ hence this is the median class interval for the time taken.
\nWe can estimate the median by using interpolation:
\n$$
\\text{Estimate of median} = \\text{class start value} + \\frac{\\text{position in class}}{\\text{frequency in class}}\\times \\text{class width}
$$
In this case this is $\\var{lower1}+\\frac{\\var{middle1}-\\var{cf11}}{\\var{fint1}}\\times 10 =\\var{lower1}+\\var{interpolation1}=\\var{median1}.$
\n(Note: that sometimes it is convenient to use $(\\var{total} + 1)/2 = \\var{middle2}$ as the way to work out the median position. The distinction does not really matter as this is an estimated value and often the decision is made based on which is the most convenient to calculate). This question has been written so that both answers will be marked correctly.
\nb)
\nTo calculate the $i^{th}$ quartile ($Q_i$) we must use the following formula:
\n$Q_i = l + \\frac{\\frac{iN}{4}-F}{f}\\times h,$
\nwhere:
\n$l$ = lower limit of the interval in which $Q_i$ lies;
\n$N$ = Total number of observations;
\n$F$ = Cumulative frequency of class previous to the $i^{th}$ quartile class;
$f$ = Frequency of $i^{th}$ quartile class.
Since we want to calculate the lower quartile, $i=1$.
\nIf we calculate $\\frac{iN}{4} = \\frac{\\var{total}}{4} = \\var{quarter}$, we can see in the table from part a) that the lower quartile will be in interval number $\\var{intervallq}$. This means that $F = \\var{fprev}$ and $f = \\var{frequency}$.
\nHence,
\n$Q_1 = \\var{lowerlq} + \\frac{\\var{quarter} - \\var{Fprev}}{\\var{frequency}} \\times 10 = \\var{lowerlq} + \\frac{\\var{quarter-Fprev}}{\\var{frequency}} \\times 10 = \\var{lowerlq} + \\var{((quarter-Fprev)/frequency)*10} = \\var{lq}.$
So, The lower quartile is $\\var{lqround}$ to two decimal places.
c)
\nTo calculate the upper quartile we use the same formula as in part b) but this time $i=3$. So, $\\frac{iN}{4} = \\frac{\\var{3*total}}{4} = \\var{3*quarter}$, we can see in the table from part a) that the lower quartile will be in interval number $\\var{intervaluq}$. This means that $F = \\var{ufprev}$ and $f = \\var{ufrequency}$.
\nHence,
\n$Q_3 = \\var{upperlq} + \\frac{\\var{3*quarter} - \\var{uFprev}}{\\var{ufrequency}} \\times 10 = \\var{upperlq} + \\frac{\\var{3*quarter-uFprev}}{\\var{ufrequency}} \\times 10 = \\var{upperlq} + \\var{((3*quarter-uFprev)/ufrequency)*10} = \\var{uq}.$
So, The lower quartile is $\\var{uqround}$ to two decimal places.
d)
\nTo calculate the interquartile range we subtract the lower quartile from the upper quartile.
\nHence,
\n$IQR = Q_3 - Q_1 = \\var{uq}-\\var{lq}=\\var{iqr}$.
\nSo the interquartile range rounded to two decimal places is $\\var{iqrround}$.
\n\nUse this link to find some resources which will help you revise this topic.
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"f1": {"name": "f1", "group": "Ungrouped variables", "definition": "random(4 .. 24#4)", "description": "Frequency 1
", "templateType": "randrange", "can_override": false}, "f2": {"name": "f2", "group": "Ungrouped variables", "definition": "random(4 .. 24#4)", "description": "Frequency 2
", "templateType": "randrange", "can_override": false}, "f3": {"name": "f3", "group": "Ungrouped variables", "definition": "random(4 .. 24#4)", "description": "Frequency 3
", "templateType": "randrange", "can_override": false}, "f4": {"name": "f4", "group": "Ungrouped variables", "definition": "random(4 .. 24#4)", "description": "Frequency 4
", "templateType": "randrange", "can_override": false}, "median1": {"name": "median1", "group": "Part a", "definition": "lower1 + interpolation1", "description": "", "templateType": "anything", "can_override": false}, "total": {"name": "total", "group": "Ungrouped variables", "definition": "f1+f2+f3+f4", "description": "Sum of frequencies
", "templateType": "anything", "can_override": false}, "middle1": {"name": "middle1", "group": "Part a", "definition": "total/2", "description": "Middle Value
", "templateType": "anything", "can_override": true}, "cf2": {"name": "cf2", "group": "Ungrouped variables", "definition": "f1+f2", "description": "Cumulative Frequency - first and second frequencies
", "templateType": "anything", "can_override": false}, "cf3": {"name": "cf3", "group": "Ungrouped variables", "definition": "f1+f2+f3", "description": "Cumulative freqeuncy - sum of first, second, third frequencies
", "templateType": "anything", "can_override": false}, "lower1": {"name": "lower1", "group": "Part a", "definition": "if(interval1=1,10,if(interval1=2,20,if(interval1=3,30,if(interval1=4,40,0))))", "description": "Lower bound of interval which median sits
", "templateType": "anything", "can_override": false}, "interval1": {"name": "interval1", "group": "Part a", "definition": "if(middle1Formula to find lower quartile
", "templateType": "anything", "can_override": false}, "intervallq": {"name": "intervallq", "group": "Part b", "definition": "if(quarter<=f1,1,if(quarter<=cf2,2,if(quarter<=cf3,3,if(quarter<=total,4,0))))", "description": "Interval which lower quartile sits in
", "templateType": "anything", "can_override": false}, "quarter": {"name": "quarter", "group": "Part b", "definition": "total/4", "description": "Quarter value
", "templateType": "anything", "can_override": false}, "fprev": {"name": "fprev", "group": "Part b", "definition": "if(intervallq=1,0,if(intervallq=2,f1,if(intervallq=3,cf2,if(intervallq=4,cf3,0))))", "description": "Cumulative frequency of class previous to one which lower quartile sits in
", "templateType": "anything", "can_override": false}, "frequency": {"name": "frequency", "group": "Part b", "definition": "if(intervallq=1,f1,if(intervallq=2,f2,if(intervallq=3,f3,if(intervallq=4,f4,0))))", "description": "Frequency of class which lower quartile sits in
", "templateType": "anything", "can_override": false}, "lqround": {"name": "lqround", "group": "Part b", "definition": "precround(lq,2)", "description": "Lower quartile rounded to 2 decimal places
", "templateType": "anything", "can_override": false}, "uqround": {"name": "uqround", "group": "Part c", "definition": "precround(uq,2)", "description": "Upper quartile rounded to 2 decimal places
", "templateType": "anything", "can_override": false}, "uq": {"name": "uq", "group": "Part c", "definition": "rational(upperlq + (((total*0.75) - UFprev)/Ufrequency) * 10)", "description": "Upper quartile
", "templateType": "anything", "can_override": false}, "ufprev": {"name": "ufprev", "group": "Part c", "definition": "if(intervaluq=1,0,if(intervaluq=2,f1,if(intervaluq=3,cf2,if(intervaluq=4,cf3,0))))", "description": "cumulative frequency of class previous to the one which the upper quartile sits in
", "templateType": "anything", "can_override": false}, "ufrequency": {"name": "ufrequency", "group": "Part c", "definition": "if(intervaluq=1,f1,if(intervaluq=2,f2,if(intervaluq=3,f3,if(intervaluq=4,f4,0))))", "description": "Frequency of class upper quartile sits in
", "templateType": "anything", "can_override": false}, "intervaluq": {"name": "intervaluq", "group": "Part c", "definition": "if(3*quarter<=f1,1,if(3*quarter<=cf2,2,if(3*quarter<=cf3,3,if(3*quarter<=total,4,0))))", "description": "class which upper quartile sits in
", "templateType": "anything", "can_override": false}, "iqr": {"name": "iqr", "group": "Part d", "definition": "rational(uq-lq)", "description": "Interquartile range
", "templateType": "anything", "can_override": false}, "lowerlq": {"name": "lowerlq", "group": "Part b", "definition": "if(intervallq=1,10,if(intervallq=2,20,if(intervallq=3,30,if(intervallq=4,40,0))))", "description": "width of class which lower quartile sits in
", "templateType": "anything", "can_override": false}, "upperlq": {"name": "upperlq", "group": "Part c", "definition": "if(intervaluq=1,10,if(intervaluq=2,20,if(intervaluq=3,30,if(intervaluq=4,40,0))))", "description": "width of class upper quartile sits in
", "templateType": "anything", "can_override": false}, "iqrround": {"name": "iqrround", "group": "Part d", "definition": "precround(iqr,2)", "description": "Round interquartle range to two decimal places
", "templateType": "anything", "can_override": false}, "interpolation1": {"name": "interpolation1", "group": "Part a", "definition": "if(middle1Calculate the lower quartile, give your answer to 2 decimal places.
", "minValue": "lqround", "maxValue": "lqround", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "c)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Calculate an estimate for the upper quartile using linear interpolation, give your answer to two decimal places.
", "minValue": "uqround", "maxValue": "uqround", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "d)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Estimate the interquartile range, give your answer to two decimal places.
", "minValue": "iqrround", "maxValue": "iqrround", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Megan Oliver", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23526/"}], "resources": []}]}], "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Megan Oliver", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23526/"}]}