Transcript Lecture 2

What is the period?
320 330 340 350 360
CO2 in parts per million (ppm)
Mauna Loa Atmospheric CO2 Concentration
1960
1970
1980
Time, years
R-code
par(bg='yellow')
plot(co2,lwd=2,col=4,xlab='Time, years',ylab='CO2 in
parts per million (ppm)',
main='Mauna Loa Atmospheric CO2 Concentration')
abline(v=seq(1950,2006,by=10),lty=2)
abline(h=seq(320,360,by=10),lty=2)
1990
320 330 340 350 360
CO2 in parts per million (ppm)
Mauna Loa Atmospheric CO2 Concentration
1960
1970
1980
Time, years
R-code
# This line adds yearly grid
abline(v=seq(1950,2006,by=1),lty=2)
1990
360
340
320
CO2 in parts per million (ppm)
Mauna Loa Atmospheric CO2 Concentration
1960
1970
1980
1990
Time, years
R-code
# Linear trend
time<-time(co2)
l<-lsfit(time,co2)
points(time,time*l$coefficients[2]+l$coefficients[1],type='l',col='green')
320 330 340 350 360
CO2 in parts per million (ppm)
Mauna Loa Atmospheric CO2 Concentration
1960
1970
1980
Time, years
R-code
# Filter with 1-year window and plot a trend
f<-filter(co2,rep(1,12)/12)
points(f,col=2,type='l',lwd=2)
1990
0
-2
-4
CO2-trend
2
4
Detrended CO2 series
1960
1970
1980
1990
Time, years
R-code
# Plot series minus trend
plot(co2-f,ldw=2,col=4,lwd=2,
xlab='Time, years',ylab='CO2-trend',main='Detrended CO2 series')
abline(h=seq(-4,4,by=2),lty=2)
abline(v=seq(1950,2006,by=1),lty=2)
2
1
0
-1
-2
-3
Seasonal component
3
Seasonal Component of CO2 data
1
2
3
4
5
6
7
8
9
Month
R-code
# Perform seasonal analysis and plot season component
m<-decompose(co2)
plot(m$figure,lwd=2,type='p',pch=19,col=4,
xlab='Month',ylab='Seasonal component')
axis(1,at=seq(1,12))
grid(col='black',lty=2)
UNR * STAT 758 * Fall 2006
10
11
12
340
350
R-code
330
m<-decompose(co2)
plot(m)
340
1
0
-1
0.0
-0.5
random
0.5
-3
-2
seasonal
2
320
330
trend
350
360
320
observed
360
Decomposition of additive time series
1960
1970
1980
Time
1990
0
-5
-10
Observations
5
10
Data from a Signal+Noise model
0
2
4
6
Time
8
10
12
Data from a Signal+Noise model
0
-1
Observations
0
-2
-5
-3
-10
Observations
1
5
2
10
3
Data from a Signal+Noise model
0
2
4
6
Time
8
10
12
Estimated signal
0
2
4
6
Time
8
10
12
360
350
340
330
320
CO2 in parts per million (ppm)
Mauna Loa Atmospheric CO2 Concentration
1960
1970
1980
Time, years
1990
2.0
1.5
1.0
0.5
0.0
diff(CO2,12)
2.5
3.0
12th-Order Difference of CO2 series
1960
1970
1980
Time, years
1990
0
-1
-2
diff(CO2,1)
1
2
First-Order Difference of CO2 series
1960
1970
1980
Time, years
1990
0.5
0.0
-0.5
-1.0
diff(diff(CO2,12),1)
1.0
(12+1)-Difference of CO2 series
1960
1970
1980
Time, years
1990