// Numbas version: finer_feedback_settings {"name": "Multiple linear regression - model selection", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Multiple linear regression - model selection", "tags": [], "metadata": {"description": "

Assessment of application of different model selection approaches in multiple regression.

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

Consider the general multiple linear regression model:

\n

\\[\\hat{y}=\\beta_0+\\beta_1x_1+ \\beta_2x_2+\\beta_3x_3+\\beta_4x_4 \\]

\n

", "advice": "

See literature on multiple regression, e.g., Section 9.2 of OpenIntro Statistics.

", "rulesets": {}, "extensions": ["stats"], "variables": {"p2": {"name": "p2", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except [p0,p1])", "description": "", "templateType": "anything"}, "p4": {"name": "p4", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except [p0,p1,p2,p3])", "description": "", "templateType": "anything"}, "data": {"name": "data", "group": "Ungrouped variables", "definition": "[[\"$\\\\beta_1$\",p1],\n [\"$\\\\beta_2$\",p2],[\"$\\\\beta_3$\",p3],\n [\"$\\\\beta_4$\",p4]]", "description": "", "templateType": "anything"}, "p0": {"name": "p0", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01)", "description": "", "templateType": "anything"}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except p0)", "description": "", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "max(p)", "description": "", "templateType": "anything"}, "p3": {"name": "p3", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except [p0,p1,p2])", "description": "", "templateType": "anything"}, "mm": {"name": "mm", "group": "Ungrouped variables", "definition": "map(if(p[j]=m,1,0),j,0..3)", "description": "", "templateType": "anything"}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "findinlist(p,m)+1", "description": "", "templateType": "anything"}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "[p1,p2,p3,p4]", "description": "", "templateType": "anything"}, "pMax": {"name": "pMax", "group": "Ungrouped variables", "definition": "max([p1,p2,p3,p4])", "description": "", "templateType": "anything"}, "R2full": {"name": "R2full", "group": "Ungrouped variables", "definition": "random(0.10..0.4#0.01)", "description": "", "templateType": "anything"}, "dataBE": {"name": "dataBE", "group": "Ungrouped variables", "definition": "[[\"$\\\\beta_1$\",R2BE1],\n [\"$\\\\beta_2$\",R2BE2],[\"$\\\\beta_3$\",R2BE3],\n [\"$\\\\beta_4$\",R2BE4]]", "description": "

Backward elimination data

", "templateType": "anything"}, "R2BE1": {"name": "R2BE1", "group": "Ungrouped variables", "definition": "random(R2full..0.9#0.01)", "description": "", "templateType": "anything"}, "R2BE2": {"name": "R2BE2", "group": "Ungrouped variables", "definition": "random(R2full..0.9#0.01 except R2BE1)", "description": "", "templateType": "anything"}, "R2BE3": {"name": "R2BE3", "group": "Ungrouped variables", "definition": "random(R2full..0.9#0.01 except [R2BE1, R2BE2])", "description": "", "templateType": "anything"}, "R2BE4": {"name": "R2BE4", "group": "Ungrouped variables", "definition": "random(R2full..0.9#0.01 except [R2BE1, R2BE2, R2BE3])", "description": "", "templateType": "anything"}, "R2BEMax": {"name": "R2BEMax", "group": "Ungrouped variables", "definition": "max([R2BE1,R2BE2,R2BE3,R2BE4])", "description": "", "templateType": "anything"}, "dataFS": {"name": "dataFS", "group": "Ungrouped variables", "definition": "[[\"$\\\\beta_1$\",R2FS1],\n [\"$\\\\beta_2$\",R2FS2],[\"$\\\\beta_3$\",R2FS3],\n [\"$\\\\beta_4$\",R2FS4]]", "description": "", "templateType": "anything"}, "R2FS1": {"name": "R2FS1", "group": "Ungrouped variables", "definition": "random(0..0.5#0.01)", "description": "", "templateType": "anything"}, "R2FS2": {"name": "R2FS2", "group": "Ungrouped variables", "definition": "random(0..0.5#0.01 except R2FS1)", "description": "", "templateType": "anything"}, "R2FS3": {"name": "R2FS3", "group": "Ungrouped variables", "definition": "random(0..0.5#0.01 except [R2FS1, R2FS2])", "description": "", "templateType": "anything"}, "R2FS4": {"name": "R2FS4", "group": "Ungrouped variables", "definition": "random(0..0.5#0.01 except [R2FS1, R2FS2, R2FS3])", "description": "", "templateType": "anything"}, "R2FSMax": {"name": "R2FSMax", "group": "Ungrouped variables", "definition": "max([R2FS1,R2FS2,R2FS3,R2FS4])", "description": "", "templateType": "anything"}, "dataFSp": {"name": "dataFSp", "group": "Ungrouped variables", "definition": "[[\"$\\\\beta_1$\",p1FS],\n [\"$\\\\beta_2$\",p2FS],[\"$\\\\beta_3$\",p3FS],\n [\"$\\\\beta_4$\",p4FS]]", "description": "", "templateType": "anything"}, "p1FS": {"name": "p1FS", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01)", "description": "", "templateType": "anything"}, "p2FS": {"name": "p2FS", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except p1)", "description": "", "templateType": "anything"}, "p3FS": {"name": "p3FS", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except [p1, p2])", "description": "", "templateType": "anything"}, "p4FS": {"name": "p4FS", "group": "Ungrouped variables", "definition": "random(0.01..0.2#0.01 except [p1, p2])", "description": "", "templateType": "anything"}, "pMin": {"name": "pMin", "group": "Ungrouped variables", "definition": "min([p1FS,p2FS,p3FS,p4FS])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["p2", "p3", "p0", "p1", "p4", "mm", "m", "p", "v", "data", "pMax", "R2full", "dataBE", "R2BE1", "R2BE2", "R2BE3", "R2BE4", "R2BEMax", "dataFS", "R2FS1", "R2FS2", "R2FS3", "R2FS4", "R2FSMax", "dataFSp", "p1FS", "p2FS", "p3FS", "p4FS", "pMin"], "variable_groups": [], "functions": {"findinlist": {"parameters": [["l", "list"], ["m", "number"]], "type": "number", "language": "javascript", "definition": "var r=0;\nfor(j=0;j < l.length;j++)\n {if(l[j]==m){r=j;}\n }\nreturn r;"}}, "preamble": {"js": "", "css": "/* left-align variables */\n#table td:first-child, #table th:first-child {\n text-align: center;\n}"}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

The full model is fitted to some data using a statistics software, obtaining R2 adj$=\\var{R2full}$.

\n

Four models are then fitted, each excluding a different predictor, obtaining the following output:

\n
{table(dataBE,[\"Excluded predictor\",\"R2 adj\"])}
\n
\n
We want to eliminate one predictor from the full model; identify such predictor and enter its 'R2 adj':
\n

R2 adj $=$ [[0]]

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "R2BEMax", "maxValue": "R2BEMax", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Starting from a no-predictor model, we fit four models, each including a single predictor, obtaining the following (each row corresponds to a different model):

\n

{table(dataFS,[\"Only predictor\",\"R2 adj\"])}

\n
We want to select a predictor to add to the no-predictor model; identify such predictor and enter its 'R2 adj' value:
\n

R2 adj $=$ [[0]]

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "R2FSMax", "maxValue": "R2FSMax", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

The full model is fitted to some data using a statistics software, obtaining this output:

\n
{table(data,[\"Parameter\",\"p-value\"])}
\n
\n
To improve the model, we want to refit it after eliminating one predictor; identify such predictor and enter its p-value below:
\n
\n
p-value $=$ [[0]]
\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "pMax", "maxValue": "pMax", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Starting from a no-predictor model, we fit four models, each including a single predictor, obtaining the following (each row corresponds to a different model):

\n

{table(dataFSp,[\"Parameter\",\"p-value\"])}

\n

To improve the no-predictor model, we want to add one predictor; identify such predictor and  enter its p-value below:

\n

p-value $=$ [[0]] 

\n

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "pMin", "maxValue": "pMin", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "type": "question", "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}