Presentation is loading. Please wait.

Presentation is loading. Please wait.

Polynomial Fit in R.

Similar presentations


Presentation on theme: "Polynomial Fit in R."— Presentation transcript:

1 Polynomial Fit in R

2 Projectile Data & Fit from Excel
Time (s) Height (m) 0.0244 0.0667 0.0489 0.1207 0.0734 0.168 0.0979 0.2088 0.1226 0.2365 0.1472 0.2624 0.1719 0.282 0.1966 0.2955 0.2214 0.3029 0.2462 0.3044 0.271 0.2977 0.2959 0.2874 0.3208 0.27 0.3457 0.2451 0.3707 0.2198 0.3957 0.1857 0.4207 0.1413 0.4459 0.0875

3 Data in R #copy and paste times = c(0, 0.0244, 0.0489, 0.0734, 0.0979,
0.1226, , , , , 0.2462, 0.271, , , , 0.3707, , , ) heights = c(0, , , 0.168, , 0.2365, , 0.282, , , 0.3044, , , 0.27, , 0.2198, , , ) proj = data.frame(times, heights)

4 Plot Data in R

5 Note that the “x^2” term is inside I()
Compare the coefficients to the fit equation from Excel

6 Isolating the coefficients
Recall we are fitting to the form y(t) = y0 + v0 t + a t2 /2 So for us a (the acceleration) is twice the value from the fit

7 Displaying the equation

8 Displaying the curve

9 Another approach

10 Raw=TRUE Without the raw=TRUE option in poly, the R program will not use simple linear and quadratic powers of the variable, but will introduce “orthogonal” combinations of the variables. This makes for better statistics – to have “independent” variables, but it makes the results harder to read and interpret.

11 Isolating the coefficients in version 2


Download ppt "Polynomial Fit in R."

Similar presentations


Ads by Google