Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Frame and Hubble's Plot

Similar presentations


Presentation on theme: "Data Frame and Hubble's Plot"— Presentation transcript:

1 Data Frame and Hubble's Plot

2 We can combine vectors into a spreadsheet-like format that R calls a data.frame (copy and paste)
dist = c(0.032,0.034,0.214,0.263,0.275,0.275,0.45,0.5,0.5, 0.63,0.8,0.9, 0.9,0.9,0.9,1,1.1,1.1,1.4,1.7,2,2,2,2) vel = c(170, 290, -130, -70,-185,-220, 200, 290, 270, 200, 300, -30, 650, 150, 500, 920, 450, 500, 500, 960, 500, 850, 800, 1090) hubble = data.frame(dist, vel)

3 Result

4 Plot the Hubble Data

5 Result of plotting Hubble Data

6 Note we can export the plot

7 Fitting the Hubble data.frame to a linear model

8 Summary of linear model from R and the linear fit from Excel for comparison
The intercept and slope are the “coefficients”.

9 Using abline() to add linear model result to plot

10 Get help on a function

11 Adding the equation to the plot
Text(middle_x, middle_y, text_to_display) Note that 0.5 is near the middle of the displayed equation horizontally And that 800 is near the middle of the displayed equation vertically


Download ppt "Data Frame and Hubble's Plot"

Similar presentations


Ads by Google