34 Pages

lecture28

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

Word Count: 1463

Document Preview

120 Statistics Displaying Time Series Data First Prev Next Last Go Back Full Screen Close Quit Time Series A time series is a set of observations made at equally spaced points in time. Time series observations are usually numerical measurements, but occasionally categorical time series are encountered. Time series observations are typically not (statistically) independent. This means that the time order the...

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 Displaying Time Series Data First Prev Next Last Go Back Full Screen Close Quit Time Series A time series is a set of observations made at equally spaced points in time. Time series observations are usually numerical measurements, but occasionally categorical time series are encountered. Time series observations are typically not (statistically) independent. This means that the time order the observations is crucial to their analysis. First Prev Next Last Go Back Full Screen Close Quit Average Monthly Rainfall in Auckland mm 0 1950 100 200 300 1960 1970 Time 1980 1990 2000 First Prev Next Last Go Back Full Screen Close Quit Average Monthly Temperature in Auckland 26 Degrees C 14 1950 16 18 20 22 24 1960 1970 Time 1980 1990 2000 First Prev Next Last Go Back Full Screen Close Quit Average Monthly Rainfall in Auckland 350 mm 0 1995 50 100 150 200 250 300 1996 1997 1998 Time 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit Average Monthly Temperature in Auckland 26 Degrees C 14 1995 16 18 20 22 24 1996 1997 1998 Time 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit The NZ Dollar in Australian Dollars 1.0 0.6 1970 0.7 0.8 0.9 1975 1980 1985 Time 1990 1995 2000 First Prev Next Last Go Back Full Screen Close Quit Time Series in R The function ts can be used to turn an ordinary vector into a special time series object. It does this by specifying parameters which describe when the observations were made. The parameter frequency describes how many observations are made per unit time. The parameter start describes when sampling started. First Prev Next Last Go Back Full Screen Close Quit Example Creating the Rain Series Suppose that the Auckland rainfall values have been read into a vector called rainvalues. The values are monthly values with the first value sampled in January 1949. > rain = ts(rainvalues, frequency = 12, start = c(1949, 1)) R interprets the value 1949 as "the start of 1949" so we could use the simpler form. > rain = ts(rainvalues, frequency = 12, start = 1949) First Prev Next Last Go Back Full Screen Close Quit Simple Operations on Time Series Arithmetic operations can be carried out on time series just as you might expect. > lograin = log(rain) Subsetting is done by focusing on the values of a time series which fall within a given time window. > rain2000 = window(rain, start = c(2000, 1), end = c(2000, 12)) First Prev Next Last Go Back Full Screen Close Quit Printing Time Series Time series are printed in a special way. > window(rain, start = c(1999, 1), end = c(2000, 12)) Jan Feb Mar Apr May Jun 1999 103.8 57.7 72.9 165.7 55.2 110.2 2000 86.2 9.2 51.2 128.4 118.1 203.4 Jul Aug Sep Oct Nov Dec 1999 130.7 113.2 69.6 96.6 172.5 42.8 2000 173.2 84.2 72.2 65.5 74.8 63.4 The frequency values 12 and 4 are recognised as special and taken to correspond to monthly and quarterly observations. First Prev Next Last Go Back Full Screen Close Quit Time Series Plots The plot function recognises time series and plots them in an appropriate way. The default plotting method is to "join up the dots," but this and other aspects of the plot can be customised. > recent = window(rain, start = c(1995, 1), end = c(2000, 12)) > plot(recent) > plot(recent, type = "h") > plot(recent, type = "o", pch=20) First Prev Next Last Go Back Full Screen Close Quit The Default Time Series Plot 350 recent 0 1995 50 100 150 200 250 300 1996 1997 1998 Time 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit type="h" 350 recent 0 1995 50 100 150 200 250 300 1996 1997 1998 Time 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit type = "o", pch = 20 350 q 300 q 250 q 200 recent q q q qq q qq q q q q q 150 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 q q q q q q q q q q q q q q q q q q q 100 q 0 50 q 1995 1996 1997 1998 Time 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit Time Series Plots We saw earlier in the course that it is easy to produce filled time series plots using polygon. > plot.new() > plot.window(c(1995, 2001), xaxs = "i", c(0,400), yaxs = "i") > x = c(1995, time(recent), 2001) > y = c(0, recent, 0) > polygon(x, y, col = "lightblue") > axis(1); axis(2); box() First Prev Next Last Go Back Full Screen Close Quit 0 1995 100 200 300 400 1996 1997 1998 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit 400 1995 300 200 100 0 1996 1997 1998 1999 2000 2001 First Prev Next Last Go Back Full Screen Close Quit A Horizon Effect? There appears to be a difference between these two plots. My conjecture is that there is wiring in the brain which means that we notice peaks rather than troughs in plots. This is true especially for plots which are divided horizontally by a colour horizon. Because of this effect, my recommendation is that you avoid this kind of plot. First Prev Next Last Go Back Full Screen Close Quit Example: Stock Prices In this example we will look at the closing price for IBM stock, daily from Jan 1, 1980 to Oct. 8, 1992. This is a typical pattern for any stock. > plot(ibm) First Prev Next Last Go Back Full Screen Close Quit ibm 60 0 80 100 120 140 160 500 1000 1500 Time 2000 2500 3000 First Prev Next Last Go Back Full Screen Close Quit Stock Prices and Efficient Markets Theory says that in an efficient market stock prices should behave as random walks. This means that on any given day the price of a stock will go up or down with equal probability. There are a variety of reasons why the New Zealand market cannot be considered efficient. We can check the theory with the IBM stock by examining the first differences in the series i.e. each day's value minus the day before. > plot(diff(ibm)) First Prev Next Last Go Back Full Screen Close Quit diff(ibm) -30 0 -20 -10 0 10 500 1000 1500 Time 2000 2500 3000 First Prev Next Last Go Back Full Screen Close Quit Time Series Decomposition It can useful to regard many real world series as being composed of several independent components. A particularly useful model is the trend plus seasonal plus irregular component model. xt = Tt + St + It where Tt St It = = = a slowly varying trend model a periodic seasonal component a set of random irregular "shocks" First Prev Next Last Go Back Full Screen Close Quit Example U.S. Housing Starts The number of housing starts in any given month is an important leading economic indicator. Houses are only built when there are clearly economic "good times" ahead. This example shows the United States housing start series from 1966 to 1974. First Prev Next Last Go Back Full Screen Close Quit Monthly U.S. Housing Starts 1966-1974 Housing Starts (Thousands) 50 1966 100 150 200 1968 1970 Time 1972 1974 First Prev Next Last Go Back Full Screen Close Quit Interpretation The series clearly shows: a regular seasonal variation with a peak in housing starts in summer and a trough in winter. a long term (cyclical) trend. short term irregularities which are not explained by the other two components. This is typical of monthly or quarterly economic series. First Prev Next Last Go Back Full Screen Close Quit Seasonal Decomposition There are statistical techniques which can be used to decompose a time series into trend plus seasonal plus irregular components. We will use a technique called STL which uses the lowess smoother as follows. A long term trend is estimated using a lowess smooth and then subtracted from the series. Each month (or quarter) is smoothed separately and this seasonal effect is subtracted. The remainder of the series is taken to be the irregular compon...

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 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
Wisconsin - CURRIC - 606
Virtual Schools: A Critical View 1Chapter IVirtual Schools: A Critical ViewGlenn Russell Monash University, AustraliaAbstractThis chapter investigates some of the critical issues associated with virtual schools. It reviews historical forms of
Wisconsin - CURRIC - 606
They research, teach, learn, and collaborate. So far, without librariesBy Kurt Squire & Constance SteinkuehlerTake a l o o k at the t w o characters on these pages.Do you recognize them? The image above, of course, is Mario, NiiitL'ndos mascot,
Wisconsin - CURRIC - 606
Distance Education, Vol. 23, No. 1, 2002Cracking the Resource Nut With Distributed Problem-Based Learning in Secondary Teacher EducationConstance A. Steinkuehler & Sharon J. DerryUniversity of Wisconsin-Madison, Wisconsin, USACindy E. Hmelo-Sil
Foothill College - CIS - 027
My name is betuBetu Has Unix account.WE are just checking i Unix s
Foothill College - CIS - 027
My name is betuBetu Has Linux account.WE are just checking i Linux s
Foothill College - CIS - 027
1020304050