globtemp: Annual Average Global Surface Temperature

Description Usage Details Source References Examples

Description

Time Series of length 113 of annual average global surface temperature deviations from 1880 to 1992.

Usage

1

Details

This is Example 1 of the COBS paper, where the hypothesis of a monotonely increasing trend is considered; Koenker and Schorfheide (1994) consider modeling the autocorrelations.

Source

temp.data’ in file ‘cobs.shar’ available from http://www.cba.nau.edu/pin-ng/cobs.html.

References

He, X. and Ng, P. (1999) COBS: Qualitatively Constrained Smoothing via Linear Programming; Computational Statistics 14, 315–337.

Koenker, R. and Schorfheide F. (1994) Quantile Spline Models for Global Temperature Change; Climate Change 28, 395–404.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
data(globtemp)
plot(globtemp, main = "Annual Global Temperature Deviations")
str(globtemp)
## forget about time-series, just use numeric vectors:
year <- as.vector(time(globtemp))
temp <- as.vector(globtemp)



##---- Code for Figure 1a of He and Ng (1999) ----------

a50 <- cobs(year, temp, knots.add = TRUE, degree = 1, constraint = "increase")
summary(a50)
## As suggested in the warning message, we increase the number of knots to 9
a50 <- cobs(year, temp, nknots = 9, knots.add = TRUE, degree = 1,
            constraint = "increase")
summary(a50)
## Here, we use the same knots sequence chosen for the 50th percentile
a10 <- cobs(year, temp, nknots = length(a50$knots), knots = a50$knot,
            degree = 1, tau = 0.1, constraint = "increase")
summary(a10)
a90 <- cobs(year, temp, nknots = length(a50$knots), knots = a50$knot,
            degree = 1, tau = 0.9, constraint = "increase")
summary(a90)

which(hot.idx  <- temp >= a90$fit)
which(cold.idx <- temp <= a10$fit)
normal.idx <- !hot.idx & !cold.idx

plot(year, temp, type = "n", ylab = "Temperature (C)", ylim = c(-.7,.6))
lines(predict(a50, year, interval = "both"), col = 2)
lines(predict(a10, year, interval = "both"), col = 3)
lines(predict(a90, year, interval = "both"), col = 3)
points(year, temp, pch = c(1,3)[2 - normal.idx])

## label the "hot" and "cold" days
text(year[hot.idx], temp[hot.idx] + .03, labels = year[hot.idx])
text(year[cold.idx],temp[cold.idx]- .03, labels = year[cold.idx])

Example output

 Time-Series [1:113] from 1880 to 1992: -0.32 -0.32 -0.4 -0.39 -0.65 -0.43 -0.4 -0.52 -0.3 -0.12 ...
qbsks2():
 Performing general knot selection ...

 WARNING! Since the number of  6  knots selected by  AIC  reached the
   upper bound during general knot selection, you might want to rerun
   cobs with a larger number of knots. 

 Deleting unnecessary knots ...

 Searching for missing knots ...

 WARNING! Since the number of  6  knots selected by  AIC  reached the
   upper bound during general knot selection, you might want to rerun
   cobs with a larger number of knots. 
COBS regression spline (degree = 1) from call:
	 cobs(x = year, y = temp, constraint = "increase", degree = 1,     knots.add = TRUE)
{tau=0.5}-quantile;  dimensionality of fit: 4 from {4}
x$knots[1:4]: 1880, 1947, 1969, 1992
coef[1:4]: -0.4426198,  0.0200000,  0.0200000,  0.2960013
R^2 = 69.95% ;  empirical tau (over all): 55/113 = 0.4867257 (target tau= 0.5)
qbsks2():
 Performing general knot selection ...

 Deleting unnecessary knots ...

 Searching for missing knots ...
COBS regression spline (degree = 1) from call:
	 cobs(x = year, y = temp, constraint = "increase", nknots = 9,     degree = 1, knots.add = TRUE)
{tau=0.5}-quantile;  dimensionality of fit: 6 from {6}
x$knots[1:6]: 1880, 1908, 1936, ... , 1992
coef[1:6]: -0.40678101, -0.31185185,  0.02000000,  0.02000000,  0.06666667,  0.43641321
R^2 = 70.87% ;  empirical tau (over all): 57/113 = 0.5044248 (target tau= 0.5)
COBS regression spline (degree = 1) from call:
	 cobs(x = year, y = temp, constraint = "increase", knots = a50$knot,     nknots = length(a50$knots), degree = 1, tau = 0.1)
{tau=0.1}-quantile;  dimensionality of fit: 6 from {6}
x$knots[1:6]: 1880, 1908, 1936, ... , 1992
coef[1:6]: -0.5515010, -0.4255000, -0.1400000, -0.1400000, -0.0800000,  0.1300034
empirical tau (over all): 12/113 = 0.1061947 (target tau= 0.1)
COBS regression spline (degree = 1) from call:
	 cobs(x = year, y = temp, constraint = "increase", knots = a50$knot,     nknots = length(a50$knots), degree = 1, tau = 0.9)
{tau=0.9}-quantile;  dimensionality of fit: 6 from {6}
x$knots[1:6]: 1880, 1908, 1936, ... , 1992
coef[1:6]: -0.2481832, -0.0700000,  0.1300000,  0.1300000,  0.2420000,  0.5080043
empirical tau (over all): 101/113 = 0.8938053 (target tau= 0.9)
 [1]  10  21  22  36  47  58  59  61  68  74 101 102
 [1]   5   8  25  38  39  71  77  85  86  92  97 113

cobs documentation built on Jan. 24, 2020, 5:10 p.m.

Related to globtemp in cobs...