Function Repository Resource:

LinearRegressionDataQuiz

Source Notebook

Generate an interactive quiz on matching data to a regression line

Contributed by: Nicholas E. Brunk, Wolfram|Alpha Math Team

ResourceFunction["LinearRegressionDataQuiz"][]

generates an interactive graphical quiz for users to specify points fitted by a requested line.

Details

ResourceFunction["LinearRegressionDataQuiz"] randomly chooses a line of best fit. The user is then tested on their ability to generate a set of points whose linear regression (as determined by LinearModelFit) matches the requested line. Parameters of the best fit line must be within 0.5 of the requested parameters in order to be marked as correct.
Click the graph to place a data point. Right-click a given data point to remove it from the list.
The interface returned by ResourceFunction["LinearRegressionDataQuiz"] includes the following buttons:
Check answerautomatically grades input with feedback
Reset problemresets the problem by removing all chosen points
Next problemrandomly generates a new problem and internally saves the previous problem history
Print reportprints a description of the problems that have been attempted so far, all guesses made and whether the last guess on each problem was correct

Examples

Basic Examples (1) 

Generate an interactive quiz on matching a specified regression line:

In[1]:=
ResourceFunction[
 "LinearRegressionDataQuiz", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[1]=

Scope (3) 

Clicking Check answer marks an attempt based on the number of points and the approximate linear fit of the chosen points. Correct attempts are marked with a green check mark:

In[2]:=
ResourceFunction[
 "LinearRegressionDataQuiz", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[2]=

If an attempt does not approximately meet the specified criteria, clicking Check answer marks the attempt as incorrect with a red x:

In[3]:=
ResourceFunction[
 "LinearRegressionDataQuiz", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[3]=

Clicking the Print report button returns a description of the problems that have been attempted so far, all guesses made and if the last guess on each problem was correct:

In[4]:=
ResourceFunction[
 "LinearRegressionDataQuiz", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[4]=

Neat Examples (1) 

For uncorrelated points or a low-quality fit, the P-value is generally high and the t-statistic is low; similarly, for a set of points exhibiting large residuals, the coefficient of determination R2 is small:

In[5]:=
ResourceFunction[
 "LinearRegressionDataQuiz", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[5]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.1 – 17 March 2021
  • 1.0.0 – 22 February 2021

Related Resources

Author Notes

To view the full source code for LinearRegressionDataQuiz, evaluate the following:

In[1]:=
SystemOpen[
 FileNameJoin[{DirectoryName[FindFile["ResourceFunctionHelpers`"]], "RegressionDataQuiz.wl"}]]

License Information