31 Pages

lecture22

Course: STATS 120, Fall 2009
School: UWO
Rating:
 
 
 
 
 

Word Count: 1696

Document Preview

120 Statistics Scatter Plots and Smoothing First Prev Next Last Go Back Full Screen Close Quit An Example Car Stopping Distances An experiment was conducted to measure how the stopping distance of a car depends on its speed. The experiment used a random selection of cars and a variety of speeds. The measurements are contained in the R data set "cars," which can be loaded with the command:...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> UWO >> STATS 120

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
120 Statistics Scatter Plots and Smoothing First Prev Next Last Go Back Full Screen Close Quit An Example Car Stopping Distances An experiment was conducted to measure how the stopping distance of a car depends on its speed. The experiment used a random selection of cars and a variety of speeds. The measurements are contained in the R data set "cars," which can be loaded with the command: data(cars) First Prev Next Last Go Back Full Screen Close Quit Car Stopping Distances Imperial Units mph 4 4 7 7 8 9 10 10 10 11 11 12 12 ft 2 10 4 22 16 10 18 26 34 17 28 14 20 mph 12 12 13 13 13 13 14 14 14 14 15 15 15 ft 24 28 26 34 34 46 26 36 60 80 20 26 54 mph 16 16 17 17 17 18 18 18 18 19 19 19 20 ft 32 40 32 40 50 42 56 76 84 36 46 68 32 mph ft 20 48 20 52 20 56 20 64 22 66 23 54 24 70 24 92 24 93 24 120 25 85 First Prev Next Last Go Back Full Screen Close Quit Car Stopping Distances Metric Units kph m 6.4 0.6 6.4 3.0 11.3 1.2 11.3 6.7 12.9 4.9 14.5 3.0 16.1 5.5 16.1 7.9 16.1 10.4 17.7 5.2 17.7 8.5 19.3 4.3 19.3 6.1 kph 19.3 19.3 20.9 20.9 20.9 20.9 22.5 22.5 22.5 22.5 24.1 24.1 24.1 m 7.3 8.5 7.9 10.4 10.4 14.0 7.9 11.0 18.3 24.4 6.1 7.9 16.5 kph 25.7 25.7 27.4 27.4 27.4 29.0 29.0 29.0 29.0 30.6 30.6 30.6 32.2 m 9.8 12.2 9.8 12.2 15.2 12.8 17.1 23.2 25.6 11.0 14.0 20.7 9.8 kph 32.2 32.2 32.2 32.2 35.4 37.0 38.6 38.6 38.6 38.6 40.2 m 14.6 15.8 17.1 19.5 20.1 16.5 21.3 28.0 28.3 36.6 25.9 First Prev Next Last Go Back Full Screen Close Quit Question Why would anyone collect this kind of data? First Prev Next Last Go Back Full Screen Close Quit Graphical Investigation We are going to use the value to investigate the relationship between speed and stopping distance. The best way to investigate the relationship between two related variables is to simply plot the pairs of values. The basic plot is produced with plot. > data(cars) > attach(cars) > plot(speed, dist) Using default labels is fine for exploratory work, but not for publication. First Prev Next Last Go Back Full Screen Close Quit 120 q 100 q q q q 80 q q q q q q dist 60 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 40 20 q q q q q q 0 5 10 15 speed 20 25 First Prev Next Last Go Back Full Screen Close Quit Comments There is a general trend for stopping distance to increase with speed. There is evidence that the variability in the stopping distances also increases with speed. It is difficult to be more precise about the form of the relationship by just looking at the scatter of points. First Prev Next Last Go Back Full Screen Close Quit Scatterplot Smoothing One way to try to uncover the nature of the relationship is to add a line which conveys the basic trend in the plot. This can be done using a technique known as scatterplot smoothing. R has a smoothing procedure called L OWESS which can be used to add the trend line. L OWESS is a relatively complicated procedure, but it is easy to use. plot(speed, dist) lines(lowess(speed, dist)) First Prev Next Last Go Back Full Screen Close Quit 120 q 100 q q q q 80 q q q q q q dist 60 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 40 20 q q q q q q 0 5 10 15 speed 20 25 First Prev Next Last Go Back Full Screen Close Quit Conclusions The "smooth" confirms that stopping distance increases with speed, but it gives us more detail. The relationship is not of the form y = a + bx but has an unknown mathematical form. If we are just interested in determining the stopping distance we can expect for a given speed this doesn't matter. We can just read the answer off the graph. First Prev Next Last Go Back Full Screen Close Quit Turning a Smooth into a Function It is useful to have a a computational procedure for "reading off the results" from the lowess curve. This can be done by fitting a spline curve through the points returned by lowess. > z = lowess(speed, dist) > u = !duplicated(z$x) > f = splinefun(z$x[u], z$y[u]) The function f can now be used to do the lookup of values on the curve. > f(10:12) [1] 21.28031 24.12928 27.11955 First Prev Next Last Go Back Full Screen Close Quit Mathematical Modelling While the curve obtained by the L OWESS lets us read off the kind of stopping distance we can expect for a given speed, it does not help understand why the relationship is the way it is. It is possible to use the data to try to fit a well defined mathematical curve to the data points. This suffers from the same difficulty. It is much better to try to understand the mechanism which produced the data. First Prev Next Last Go Back Full Screen Close Quit Conservation of Energy A moving car has kinetic energy associated with it. The kinetic energy is dissipated as work is done against friction during breaking. When the car comes to rest the Kinetic energy dissipated equals work done. First Prev Next Last Go Back Full Screen Close Quit Equations from Physics Thanks Isaac to Newton (and others) we know the following. Kinetic Energy = 1 mv2 2 where m is the mass of the car and v is the car speed. Work Done = F d where F is the frictional force and d is the distance travelled. When the car comes to a halt, all the kinetic energy has been dissipated as work done against the frictional force. First Prev Next Last Go Back Full Screen Close Quit Conservation of Energy Because energy is conserved, we can equate right-hand side of the previous equations. F d = 1 mv2 2 Ignoring constants, this says that d v2 or d v. First Prev Next Last Go Back Full Screen Close Quit Using Plots We can check whether these are really the underlying relationships with scatterplots. Either plot distance against speed-squared or plot the square-root of distance against speed. First Prev Next Last Go Back Full Screen Close Quit Producing the Plots > plot(speed^2, dist, main = "Car Stopping Distances", xlab = "Speed-squared (MPH^2)", ylab = "Stopping Distance (Feet)") > lines(lowess(speed^2, dist)) > plot(speed, sqrt(dist), main = "Car Stopping Distances", xlab = "Speed (MPH)", ylab = "Square Root Stopping Distance (Feet)") > lines(lowess(speed, sqrt(dist))) First Prev Next Last Go Back Full Screen Close Quit Car Stopping Distances 120 q 100 q q Stopping Distance (Feet) q q 80 q q q q q q 60 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 40 20 q q q q q q 0 0 100 200 300 400 500 600 Speed-squared (MPH^2) First Prev Next Last Go Back Full Screen Close Quit Car Stopping Distances q 10 q q Square Root Stopping Distance (Feet) q q q q q q q q q 8 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 4 6 q q 2 5 10 15 Speed (MPH) 20 25 First Prev Next Last Go Back Full Screen Close Quit Conclusions Both the plots indicate that there is close to a straight line relationship between speed-squared and distance. From a statistical point-of-view, the second plot is preferable because the scatter of points about the line is independent of speed. (I.e. it is possible to compare apples with apples). The straight line of best fit to the plot of square-root distance versus speed is: d = 1.28 + 0.32 v Dropping the intercept, the best fit is: d = 0.4 v First Prev Next Last Go Back Full Screen Close Quit How Lowess Works It is worth spending a little time to see how lowess works. We'll consider how to get an estimate of the lowess curve at just one location in a scatter plot. We will compute the value of the lowess curve at the 6th point in the following plot. The lowess procedure does this for every point in the plot. First Prev Next Last Go Back Full Screen Close Quit q q q q 0.8 0.6 q q q q y 0.4 q q q q 0.2 q q q q 0.0 q q q q 0.2 0.4 x 0.6 0.8 First Prev Next Last Go Back Full Screen Close Quit Step 1 : Find the neighbours of the point. q q q ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UWO - STATS - 120
Statistics 120 Fitting a Straight LineFirst Prev Next Last Go Back Full Screen Close QuitThe ProblemGiven a set of points (x1 , y1 ), . . . , (xn , yn ), how do we find a straight line y = a + bx which provides a good description of the general
UWO - STATS - 120
Statistics 120 Multipanel Conditioning PlotsFirst Prev Next Last Go Back Full Screen Close QuitTrellis Graphics Trellis Graphics is a family of techniques for viewing complex, multi-variable data sets. The ideas have been around for a while, bu
UWO - STATS - 120
Statistics 120 Multipanel Conditioning IIFirst Prev Next Last Go Back Full Screen Close QuitTrellis Graphics The Trellis graphics system in R is written by Deepayan Sarkar of the University of Wisconsin, using the "Grid" graphics system written
UWO - STATS - 120
Statistics 120 Examining Three-Dimensional DataFirst Prev Next Last Go Back Full Screen Close QuitExamining Two Variables The most important tool is the scatter plot. Scatter plots do two things well They display relationships between variable
UWO - STATS - 120
Statistics 120 Clusters and SurfacesFirst Prev Next Last Go Back Full Screen Close QuitHigh-Dimensional Data A typical statistical data set can be laid out in a matrix with rows corresponding to cases and columns to variables. If there are n ca
UWO - STATS - 120
Statistics 120 Displaying Time Series DataFirst Prev Next Last Go Back Full Screen Close QuitTime Series A time series is a set of observations made at equally spaced points in time. Time series observations are usually numerical measurements,
UWO - STATS - 120
Statistics 120 Time Series ApplicationsFirst Prev Next Last Go Back Full Screen Close QuitAtmospheric Carbon Dioxide Levels The island of Hawaii is a volcanic cone which rises roughly 17km from the ocean floor to the top of its tallest peak. Th
UWO - STATS - 120
Chapter 2An Introduction to R2.1 Computing and GraphicsThe introduction of cheap, powerful computers has brought about a revolution in the production of graphs. In the past, the production of a quality graph required that someone with special ski
UWO - STATS - 120
Chapter 3Graphics with R3.1 Low-Level GraphicsR has extensive facilities for producing graphs. There are both low- and high-level graphics facilities. The low-level graphics facilities provide basic building blocks which can be used to build up g
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
AbbotPalo AltoBowermanPalo AltoChanMountain ViewGarciaSunnyvaleNighthorseMenlo ParkTanakaMountain View
Foothill College - CIS - 068
JosephAbbotJaneBowermanAmyChanJorgeGarciaJoanNighthorseHidekiTanaka
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
Garcia Apr 3 11:04 viSmith Apr 3 12:35 ccUeda Apr 3 12:36 lsSmith Apr 4 12:45 lsSmith Apr 4 12:47 catUeda Apr 4 12:56 lsSmith Apr 4 13:55 cat
Foothill College - CIS - 068
Hans Baker Menlo ParkJack Garcia Palo AltoJoe Smith Mountain ViewDavid Spinelli Mountain ViewJane Tang Mountain ViewShirley Walsh Palo AltoJack Ueda Menlo Park
Foothill College - CIS - 068
GarciaApr311:04viSmithApr312:35ccUedaApr312:36lsSmithApr412:45lsSmithApr412:47catUedaApr412:56lsSmithApr413:55catSmithApr414:00viChangApr414:05ccGarciaApr414:07viUedaApr500:05catUedaApr500:30
Foothill College - CIS - 068
1.Line one2.Line two3.Line three4.Line four5.Line five6.Line six7.Line seven8.Line eight9.Line nine10.Line ten11.Line eleven12.Line twelve13.Line thirteen14.Line fourteen15.Line fifteen16.Line sixteen17.Line seventeen
Foothill College - CIS - 068
root:x:0:1:Super-User:/:/sbin/shdaemon:x:1:1:/:bin:x:2:2:/usr/bin:sys:x:3:3:/:adm:x:4:4:Admin:/var/adm:lp:x:71:8:Line Printer Admin:/usr/spool/lp:uucp:x:5:5:uucp Admin:/usr/lib/uucp:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uu
Foothill College - CIS - 068
GarciaApr 311:04viSmithApr 312:35ccUedaApr 312:36lsSmithApr 412:45lsSmithApr 412:47catUedaApr 412:56lsSmithApr 413:55catSmithApr 414:00viChangApr 414:05ccGarciaApr 414:07viUedaApr 500:05catUedaApr 500:30
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavid SpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavid SpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
Abbot Palo AltoBowerman Palo AltoChan Mountain ViewGarcia SunnyvaleNighthorse Menlo ParkTanaka Mountain View
Foothill College - CIS - 052
select version(); CREATE TABLE players(id varchar( 4 ) ,name varchar( 25 ))insert into employee values('01', 'Kim');SELECT * FROM `employee`alter table employee add address varchar(35)alter table employee add PRIMARY KEY (`id`)alter t
Foothill College - CIS - 068
Hans Baker Menlo ParkJack Garcia Palo AltoJoe Smith Mountain ViewDavid Spinelli Mountain ViewJane Tang Mountain ViewShirley Walsh Palo AltoJack Ueda Menlo Park
Foothill College - CIS - 068
GarciaApr311:04viSmithApr312:35ccUedaApr312:36lsSmithApr412:45lsSmithApr412:47catUedaApr412:56lsSmithApr413:55catSmithApr414:00viChangApr414:05ccGarciaApr414:07viUedaApr500:05catUedaApr500:30
Foothill College - CIS - 068
GarciaApr311:04viSmithApr3SmithccUedaApr312:36lsSmithApr412:45lsSmithApr412:47catUedaApr412:56lsSmithApr413:55catSmithApr414:00viChangApr414:05ccGarciaApr414:07viUedaApr500:05catUedaApr500:30
Foothill College - CIS - 068
GarciaApr 311:04viSmithApr 312:35ccUedaApr 312:36lsSmithApr 412:45lsSmithApr 412:47catUedaApr 412:56lsSmithApr 413:55catVBChangApr 414:05ccGarciaApr 414:07viUedaApr 500:05catUedaApr 500:30lsChangApr 506
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoe SmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
1. Line one2. Line two3. Line three4. Line four5. Line five6. Line six7. Line seven8. Line eight9. Line nine10. Line ten11. Line eleven12. Line twelve13. Line thirteen14. Line fourteen15. Line fifteen16. Line sixteen17. Line seventeen
Foothill College - CIS - 068
Abbot Palo AltoBowermanPalo AltoChanMountain ViewGarciaSunnyvaleNighthorseMenlo ParkTanakaMountain View
Foothill College - CIS - 068
root:x:0:1:Super-User:/:/sbin/shdaemon:x:1:1:/:bin:x:2:2:/usr/bin:sys:x:3:3:/:adm:x:4:4:Admin:/var/adm:lp:x:71:8:Line Printer Admin:/usr/spool/lp:uucp:x:5:5:uucp Admin:/usr/lib/uucp:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uu
Foothill College - CIS - 068
one two three four five
Foothill College - CIS - 068
=HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park=
Foothill College - CIS - 068
=HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park=
Foothill College - CIS - 068
Hans Baker Menlo ParkJack Garcia Palo AltoJoe Smith Mountain ViewDavid Spinelli Mountain ViewJane Tang Mountain ViewShirley Walsh Palo AltoJack Ueda Menlo Park
Foothill College - CIS - 068
AbbotPalo AltoBowermanPalo AltoChanMountain ViewGarciaSunnyvaleNighthorseMenlo ParkTanakaMountain View
Foothill College - CIS - 068
9873645210
Foothill College - CIS - 068
JosephAbbotJaneBowermanAmyChanJorgeGarciaJoanNighthorseHidekiTanaka
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo altoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Foothill College - CIS - 068
1.Line one 2.Line two3.Line three4.Line four5.Line five6.Line six7.Line seven8.Line eight9.Line nine10.Line ten11.Line eleven12.Line twelve13.Line thirteen14.Line fourteen15.Line fifteen16.Line sixteen17.Line sevente
Foothill College - CIS - 068
HansBakerMenlo ParkJackGarciaPalo AltoJoeSmithMountain ViewDavidSpinelliMountain ViewJaneTangMountain ViewShirleyWalshPalo AltoJackUedaMenlo Park
Palomar - MATH - 105
Hints and Answers to Selected ExercisesNote to students: The selected answers below give you some indication about whether you are on the right track. They are NOT intended to be the type of answers you would turn in to an instructor. Your complete
Palomar - MATH - 105
Hints and Answers to Selected ExercisesNote to students: The selected answers below give you some indication about whether you are on the right track. They are NOT intended to be the type of answers you would turn in to an instructor. Your complete
Foothill College - CIS - 068
=1. Line one2. Line two3. Line three4. Line four5. Line five6. Line six7. Line seven8. Line eight9. Line nine10. Line ten11. Line eleven12. Line twelwe13. Line thirteen14. Line fourteen15. Line fiftteen16. Line sixteen17. L
Foothill College - CIS - 068
=1. Line one2. Line two3. Line three4. Line four5. Line five6. Line six7. Line seven8. Line eight9. Line nine10. Line ten11. Line eleven12. Line twelve13. Line thirteen14. Line fourteen15. Line fifteen16. Line sixteen17. Line sevent
Foothill College - CIS - 068
HansBaker Menlo ParkJackGarcia Palo AltoJoeSmith Mountain ViewDavidSpinelli Mountain ViewJaneTang Mountain ViewShirleyWalsh Palo AltoJackUeda Menlo Park
Arizona - MATH - 115
Math115a WoodProbability and Sets Worksheet #1Name:_ #:1. Let V be the event that a tourist visited a certain museum and let S be the event that the tourist went to a sporting event. P (V ) = 0.35, P ( S ) = 0.59, P (V S ) = 0.16Use the above
Arizona - MATH - 115
WS Class note on continuous random variableA random variable whose possible values form an interval is called a continuous random variable. For c.d.f. cumulative distribution function, FX ( x ) = P ( X x ) any continuous random variable Since the r
Arizona - MATH - 115
Worksheet 11: Bayes' Theorem Keep this sheet for your notes, turn in pages 2-14 on Friday Bayes' Theorem: If the sample space is partition then given P ( B | A) and P(A) we can find P ( A | B) . If you can find the reverse probabilities without the f
Foothill College - COIN - 074
575 S Rengstorff Ave, Apt 77 Mountain View, CA 94040.Ph: (412) 478 8286 Email: naveenjha@gmail.comNAVEEN KUMAROBJECTIVEResearch and development position in compiler and computer architecture areas involving runtime program adaptation, hard
Washington - OC - 230
River ResponseRiver ResponseSediment Water WoodConfinementValley slopeChannel morphologyBank materialFlow obstructionsRiparian vegetationCHANNEL RESPONSEclimatesediment inputscatchment vegetationTime-variable drivers hydrologi
Wisconsin - CURRIC - 606
Eat Your Vegetables 1Eat Your Vegetables and Do Your Homework: A Design-Based Investigation of Enjoyment and Meaning in Learning1Sasha Barab, Associate Professor in Learning Sciences @ Indiana University, sbarab@indiana.edu, Anne Arici, Doctoral
Wisconsin - CURRIC - 606
Black, R. B. (in press) JAAL 1Access and affiliation: The literacy and composition practices of English language learners in an online fanfiction community After reading J.R.R. Tolkien's novels as a child, I had a difficult time leaving Middle Eart
Wisconsin - CURRIC - 606
Collaborative News Networks: Distributed Editing, Collective Action, and the Construction of Online News on Slashdot.orgby Anita J. Chan anita1@mit.eduSUBMITTED TO THE DEPARTMENT OF COMPARATIVE MEDIA STUDIES IN THE PARTIAL FULFILLMENT OF THE REQU
Wisconsin - CURRIC - 606
Wisconsin - CURRIC - 606
Wisconsin - CURRIC - 606
INTERACTIVE AUDIENCES? THE 'COLLECTIVE INTELLIGENCE' OF MEDIA FANS by Henry Jenkins 'You've got fifteen seconds. Impress me.' An advertisement for Applebox Productions depicts the new youth consumer: his scraggly dishwater blonde hair hangs down into
Wisconsin - CURRIC - 606
Memes, literacy and affinity spaces: Implications for policy and digital divides in education.Michele KnobelMontclair State University, NJ (USA) & Central Queensland University, QLD (Australia)Conference paper presented to the "Policy Options and
Wisconsin - CURRIC - 606
Wisconsin - CURRIC - 606
Language Learning & Technology http:/llt.msu.edu/vol8num3/lam/September 2004, Volume 8, Number 3 pp. 44-65SECOND LANGUAGE SOCIALIZATION IN A BILINGUAL CHAT ROOM: GLOBAL AND LOCAL CONSIDERATIONSWan Shun Eva Lam Northwestern University ABSTRACT Th