Difference between revisions of "PhET-Simulations-for-Mathematics/C2/Curve-Fitting/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 32: Line 32:
  
 
'''System Requirements'''
 
'''System Requirements'''
 
  
  
Line 47: Line 46:
  
 
[https://spoken-tutorial.org/ https://spoken-tutorial.org]
 
[https://spoken-tutorial.org/ https://spoken-tutorial.org]
 +
 
|| To follow this tutorial the learner should be familiar with topics in basic mathematics.
 
|| To follow this tutorial the learner should be familiar with topics in basic mathematics.
  
Line 67: Line 67:
 
|-
 
|-
 
|| '''PhET Simulations'''
 
|| '''PhET Simulations'''
|| In this tutorial, we will use '''Curve Fitting PhET Simulation.'''
+
|| In this tutorial, we will use '''Curve Fitting PhET Simulation'''.
 
|-
 
|-
 
|| Show the '''Downloads''' folder.
 
|| Show the '''Downloads''' folder.
Line 93: Line 93:
 
|| First panel has '''Linear''',''' Quadratic''' and '''Cubic''' radio buttons.
 
|| First panel has '''Linear''',''' Quadratic''' and '''Cubic''' radio buttons.
  
Second panel has''' Best fit '''and '''Adjustable fit''' functions.
+
Second panel has ''' Best fit '''and '''Adjustable fit''' functions.
 
|-
 
|-
 
|| Point to '''Linear''' and '''Best Fit''' default selections
 
|| Point to '''Linear''' and '''Best Fit''' default selections
Line 105: Line 105:
 
|-
 
|-
 
|| Click the Values and Residues check boxes from the functions panel.
 
|| Click the Values and Residues check boxes from the functions panel.
|| Click the '''Values''' and '''Residuals '''check boxes from the functions panel.
+
|| Click the '''Values''' and '''Residuals ''' check boxes from the functions panel.
 
|-
 
|-
 
|| Select the data point and place it at '''(5.0,5.0)''' and other at '''(-5.0,-5.0)'''
 
|| Select the data point and place it at '''(5.0,5.0)''' and other at '''(-5.0,-5.0)'''
Line 112: Line 112:
 
|| Place a data point at  (5.0,5.0) and another point at (-5.0,-5.0).
 
|| Place a data point at  (5.0,5.0) and another point at (-5.0,-5.0).
  
A line passing through the points is seen on the screen.
+
A line passing through the two points is seen on the screen.
 
|-
 
|-
 
|| Point to the line.
 
|| Point to the line.
 
|| The necessary condition to plot a line is presence of any two points in a 2-D space.  
 
|| The necessary condition to plot a line is presence of any two points in a 2-D space.  
  
In a linear curve fitting process, the necessity of two points leads to zero residuals.
+
In a linear curve fitting process, the necessity of the two points leads to zero residuals.
 
|-
 
|-
 
|| Point to the left top corner on the graphing plot region
 
|| Point to the left top corner on the graphing plot region
Line 127: Line 127:
 
|-
 
|-
 
|| Point to the equation '''y = cx + d'''.
 
|| Point to the equation '''y = cx + d'''.
|| In this equation '''y equals cx plus d'''.
+
|| In this equation '''y''' is equal to '''cx plus d'''.
 
|-
 
|-
 
|| Point to c.  
 
|| Point to c.  
Line 143: Line 143:
  
 
Move the second point back to '''(-5.0,-5.0)'''  
 
Move the second point back to '''(-5.0,-5.0)'''  
|| d stands for the intercept which shows where the line intersects the y axis.
+
|| '''d''' stands for the intercept which shows where the line intersects the y axis.
  
 
Move the second point back to its original place.
 
Move the second point back to its original place.
 
|-
 
|-
 
|| Point to the '''Deviations''' panel '''left side''' of the screen.
 
|| Point to the '''Deviations''' panel '''left side''' of the screen.
|| Left side of the screen has a '''Deviations''' panel.  
+
|| Left side of the screen has '''Deviations''' panel.  
  
 
In this there are two measures of how good the fit of the curve is.
 
In this there are two measures of how good the fit of the curve is.
Line 181: Line 181:
 
|-
 
|-
 
|| Point to the '''χ<sup>2</sup>''' scale.
 
|| Point to the '''χ<sup>2</sup>''' scale.
|| The chi-square value is also another measure for goodness of fit.  
+
|| The chi-square value is another measure for goodness of fit.  
  
 
A very good fit of data is seen with '''chi squared statistic''' of 1 or close to 1.
 
A very good fit of data is seen with '''chi squared statistic''' of 1 or close to 1.
Line 191: Line 191:
 
|| Let us place another point at (-3.0, -2.0).  
 
|| Let us place another point at (-3.0, -2.0).  
  
The '''chi-square''' value becomes 1.12.
+
The '''chi-squared''' value becomes 1.12.
 
|-
 
|-
 
|| Point to chi-square value = 23.9
 
|| Point to chi-square value = 23.9
Line 254: Line 254:
 
The ''' chi squared statistic''' becomes 111.
 
The ''' chi squared statistic''' becomes 111.
  
A high chi-squared is an indicator of extremely poor fit.
+
A high chi-square is an indicator of extremely poor fit.
 
|-
 
|-
 
|| Point to the residual lines
 
|| Point to the residual lines
Line 266: Line 266:
 
|| Click the '''Adjustable Fit radio button'''.
 
|| Click the '''Adjustable Fit radio button'''.
  
Drag '''slider'''s''' c''' and '''d''' to values close to 0.
+
Drag the '''slider'''s''' c''' and '''d''' to values close to 0.
  
 
Observe how this erases the line drawn earlier.
 
Observe how this erases the line drawn earlier.
Line 289: Line 289:
 
|| Click the '''Best Fit radio button''' again.
 
|| Click the '''Best Fit radio button''' again.
  
Note down the values of '''c''' and '''d '''which is''' '''0.19 x and 2.5.
+
Note down the values of '''c''' and '''d '''which is 0.19 x and 2.5.
 
|-
 
|-
 
|| click '''Adjustable Fit'''.
 
|| click '''Adjustable Fit'''.
Line 356: Line 356:
 
|-
 
|-
 
|| Point to the chi-square value
 
|| Point to the chi-square value
|| There is an immediate hike in the '''chi squared''' value to 26.8 and r2 value to 0.84.  
+
|| There is an intermediate hike in the '''chi squared''' value to 26.8 and r2 value to 0.84.  
  
This is because the point (5.0,-5.0) does not justify the equation '''y=x<sup>2</sup>.'''
+
This is because the point (5.0,-5.0) does not satisfy the equation '''y=x<sup>2</sup>.'''
 
|-
 
|-
 
|| Click on '''Adjustable Fit'''
 
|| Click on '''Adjustable Fit'''
|| click on '''Adjustable Fit''' and see effects of b, '''c''', '''d''' on the fit.
+
|| Click on '''Adjustable Fit''' and see effects of b, '''c''', and '''d''' on the fit.
 
|-
 
|-
 
|| Slide parameter b
 
|| Slide parameter b
Line 374: Line 374:
  
 
Click on the best fit option.
 
Click on the best fit option.
|| Let's change the d parameter.
+
|| Change the d parameter.
  
 
The height of the curve gets adjusted to the top or bottom of the graphing plot.
 
The height of the curve gets adjusted to the top or bottom of the graphing plot.
Line 401: Line 401:
  
 
Point to the deviations panel
 
Point to the deviations panel
|| Drag the fourth point (5.0, -5.0) to (5.0, 0.0).
+
|| Drag and place the fourth point (5.0, -5.0) to (5.0, 0.0).
  
 
Here any set of 4 points on the plotting region lead to a best fit line.
 
Here any set of 4 points on the plotting region lead to a best fit line.

Revision as of 17:26, 8 November 2023

Title of the script: Curve Fitting

Author: Shraddha Kodavade

Keywords: Phet simulation, curve fitting, data points, slope, intercept, quadratic polynomial, cubic polynomial, reduced chi squared statistic, r squared correlation coefficient, video tutorial.


Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this tutorial on Curve Fitting.
Slide Number 2

Learning Objectives

In this tutorial, we will learn about:
  • Lines
  • Quadratic polynomials
  • Cubic polynomials
  • Best fit and Adjustable fit
  • Reduced chi squared statistic and r squared correlation coefficient
Slide Number 3

System Requirements


This tutorial is recorded using,

Windows 10 (64-bit) operating system

Chrome version 101.0.49

Slide Number 4

Pre-requisites

https://spoken-tutorial.org

To follow this tutorial the learner should be familiar with topics in basic mathematics.

Please use the link below to access the tutorials on PhET Simulations.

Slide Number 5

Link for Phet Simulations

https://phet.colorado.edu/en/simulations/curve-fitting

Please use the given link to download the PhET simulation.
Slide Number 6

Curve Fitting

Curve fitting.

It is the process of constructing a best fit mathematical function, subject to constraints.

PhET Simulations In this tutorial, we will use Curve Fitting PhET Simulation.
Show the Downloads folder. I have already downloaded Curve Fitting simulation to my Downloads folder.
Let us begin.
Cursor on the interface. This is the interface of Curve Fitting simulation.
Point to the top right corner On the top right we have a function box with 3 check boxes.

Curve, Residuals and Values.

Click on Curve check box in the function box Click on the Curve check box.

Two panels appear below the function box.

Point to first panel

Point to second panel

First panel has Linear, Quadratic and Cubic radio buttons.

Second panel has Best fit and Adjustable fit functions.

Point to Linear and Best Fit default selections Linear and Best Fit radio buttons are selected by default.
Point to the Data Points bucket at the left side of screen Observe the Data Points bucket.

It consists of orange points.

Click the Values and Residues check boxes from the functions panel. Click the Values and Residuals check boxes from the functions panel.
Select the data point and place it at (5.0,5.0) and other at (-5.0,-5.0)

Point to the line.

Place a data point at (5.0,5.0) and another point at (-5.0,-5.0).

A line passing through the two points is seen on the screen.

Point to the line. The necessary condition to plot a line is presence of any two points in a 2-D space.

In a linear curve fitting process, the necessity of the two points leads to zero residuals.

Point to the left top corner on the graphing plot region

Point to c=1 and d=0.

Here, in the second quadrant, we see the equation is y=1.00x-0.1.

Here c=1 and d=- 0.1.

Point to the equation y = cx + d. In this equation y is equal to cx plus d.
Point to c.

Move the second point from (-5.0,-5.0) to any other point to show negative slope line and intercept.

Here c stands for slope.

It is the rate of change of y with respect to x.

A positive slope indicates an upward moving line.

A negative slope indicates a downward moving line.

Point to d.

Move the second point back to (-5.0,-5.0)

d stands for the intercept which shows where the line intersects the y axis.

Move the second point back to its original place.

Point to the Deviations panel left side of the screen. Left side of the screen has Deviations panel.

In this there are two measures of how good the fit of the curve is.

Point to chi squared statistic.

Point to r squared correlation coefficient.

The first is a chi squared statistic.

The second is r squared correlation coefficient.

Point to the r2 scale. r-squared stands for coefficient of determination.

Coefficient of determination is a statistical measure.

It explains how a difference in one variable causes a shift in another variable.

It predicts the outcome of a given event.

Point to residuals. If the r squared value is close to 1, it predicts the variance in y from x.

In our case, we have zero residuals.

Point to the r squared value. This indicates that the best fit line has been achieved.

Hence, the value is 1.

It shows that this is the best fit line with no errors.

Point to the χ2 scale. The chi-square value is another measure for goodness of fit.

A very good fit of data is seen with chi squared statistic of 1 or close to 1.

Point to chi-square value. This value is 0 over here, which shows it is the best fit with 0 errors.
Point to chi-square value = 0.86 Let us place another point at (-3.0, -2.0).

The chi-squared value becomes 1.12.

Point to chi-square value = 23.9 Move this point to (-3.0, 2.0).

The Chi square value increases to 23.9.

Hence the point at (-3.0 ,-2.0) was a better fit than at (-3.0, 2.0).

Point to the formula in the Help box. The formula for the chi squared statistic is given in the Help box.
Place third data point at (0.0,0.0) Let us place the third point at (0.0, 0.0).
Point to the equation. Since the equation is y=x, the third point equates to this line.

Hence it lies on the line.

There is therefore no change in the statistical measure.

Place third data point at (0.0,5.0),

Point to the equation at the top left corner of the plotting graph.

Let us move the third data point to (0, 5).

We see that the best fit line changes.

The new equation is y=1.00x + 1.6

Point to the residual lines. The residual lines are shown as vertical lines from the data points.

These lines touching the best fit line show the deviation from the line.

The goal of a best fit line is to minimise the distance of the error lines.

Point to the deviations panel.

Point to r squared = 0.75

Point to chi-squared value = 26.2.

The r square value decreases to 0.75.

The chi-square value increases to 26.8.

This shows that the third point is not collinear to the other two.

Hence a linear line does not pass through all the 3 points.

Drag the data point from (0.0,5.0) to (-8.0, 6.0).

Point to the equation y = 0.19x-2.5.

Drag the data point from (0,5) to (-8, 6).

Note that the equation changes to y = 0.19x+2.5.

Point to r2 = 0.05 and χ2 of 111 The r squared value becomes 0.05.

The chi squared statistic becomes 111.

A high chi-square is an indicator of extremely poor fit.

Point to the residual lines The residual vertical lines have increased.

This is because the equation has become less reliable in prediction.

Click Adjustable Fit.

Drag sliders c and d to values close to 0.

Click the Adjustable Fit radio button.

Drag the sliders c and d to values close to 0.

Observe how this erases the line drawn earlier.

Point to the line that is now parallel to the x axis.

Point to the data points.

A line parallel to x axis is seen.

The data points are still where we placed them earlier.

Point to the red bar and χ2.

Point to the r2 value of 0.

The reduced chi square statistic is very high and in the red zone.

The r square value is 0, meaning poor correlation.

Click Best Fit again.

Note down the values for c and d

Click the Best Fit radio button again.

Note down the values of c and d which is 0.19 x and 2.5.

click Adjustable Fit.

Drag sliders c and d and point to the line.

Point to the line.

Drag slider b to 0.19 and d to 2.5

Again, click the Adjustable Fit radio button.

Now drag sliders c and d from end to end.

Observe the effects of these changes on the line.

Drag slider c close to 1.9 and d to 2.5.

Point to the line, r2 and χ2

Click on best fit.

Click on reset option.

The line looks similar to the best fit line we saw earlier.

Note the r squared and the reduced chi squared statistic.

Click on Best fit option.

Click on reset option.

Only Narration Now, we will see how to graph a quadratic polynomial.

Details about quadratic polynomials are given in the Additional reading material.

Point to curve. Point to quadratic option. Select Curve, Residuals and values options from the screen.

Choose the Quadratic option.

Drag and place data points at the following coordinates. (0,0), (2.0,4.0), (3.0,9.0) Drag and place data points at the following coordinates (0,0), (2.0,4.0), (3.0,9.0).
Point to the equation.

Point to r-squared and chi squared statistic values

An upward sloping curve parabola is formed.

This is representative of y=x2.

The r square and reduced chi-squared statistic values are 1 and 0 respectively.

Note that the three points are on the curve.

Therefore the deviation parameter indicates the best fit curve.

Point to (5.0-5.,0) Let us add the fourth point at (5.0,-5.0).
Point to the diagram A downward sloping parabola is formed

The new equation is on the screen.

Point to the chi-square value There is an intermediate hike in the chi squared value to 26.8 and r2 value to 0.84.

This is because the point (5.0,-5.0) does not satisfy the equation y=x2.

Click on Adjustable Fit Click on Adjustable Fit and see effects of b, c, and d on the fit.
Slide parameter b The b parameter affects the upward and downward face of the parabola.
Slide parameter c Change the c parameter.

The curve shifts to the second and third quadrants and first and fourth quadrants.

Slide parameter d

Click on the best fit option.

Change the d parameter.

The height of the curve gets adjusted to the top or bottom of the graphing plot.

Click on best fit option.

Select Cubic option.


Point to r squared value

Point to chi square value

Select Cubic option.

Details about cubic polynomials are given in the Additional reading material.

Observe that the arrangement of 4 points on the screen has lead to a best fit line.

The r square value is 1.

The chi square value is 0.

Drag the fourth point (5.0,-5.0) to (5.0,0.0).


Point to the deviations panel

Drag and place the fourth point (5.0, -5.0) to (5.0, 0.0).

Here any set of 4 points on the plotting region lead to a best fit line.

This can be depicted by the deviations measure.

Both indicate that a best fit line has been obtained.

Only Narration With this we have come to the end of this tutorial.

Let us summarise.

Slide Number 7

Summary

In this tutorial, we have learnt about,
  • Lines
  • Quadratic polynomials
  • Cubic polynomials
  • Best Fit and Adjustable fit
  • Reduced chi squared statistic and r squared correlation coefficient


Slide Number 8

Assignment

As an assignment,

Add 5 data points to the cubic polynomial and explore the Adjustable fit option.

Slide Number 9

About the Spoken Tutorial Project

The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide Number 10

Spoken Tutorial workshops

The Spoken Tutorial Project team:

conducts workshops using spoken tutorials and

gives certificates on passing online tests.

For more details, please write to us.

Slide Number 11

Forum for specific questions:

Do you have questions about THIS Spoken Tutorial?

Please visit this site.

Choose the minute and second where you have the question

Explain your question briefly

Someone from our team will answer them

Please post your timed queries in this forum.
Slide Number 12

Acknowledgement

The Spoken Tutorial project is funded by the Ministry of Education, Govt. of India
Slide Number 13

Thank you

This is Shraddha Kodavade, a FOSSEE summer fellow 2022, IIT Bombay signing off.

Thanks for joining.

Contributors and Content Editors

Madhurig