National Academies Press: OpenBook

Surface Temperature Reconstructions for the Last 2,000 Years (2006)

Chapter: Appendix B: R Code for Figure 9-2

« Previous: Appendix A: Statement of Task
Suggested Citation:"Appendix B: R Code for Figure 9-2." National Research Council. 2006. Surface Temperature Reconstructions for the Last 2,000 Years. Washington, DC: The National Academies Press. doi: 10.17226/11676.
×

B
R Code for Figure 9-2

n <- 600;

baseline <- n - 0:99;

phi <- 0.9;


HSIndex <- function(x)

{

(mean(x[baseline]) - mean(x)) / sqrt(var(x));

}


SimulatePC1 <- function(p = 50)

{

a <- matrix(NA, n, p);

for (j in 1:p) {

b <- arima.sim(model = list(ar = phi), n);

a[ , j] <- b - mean(b[baseline]);

}

invisible(svd(a)$u[,1]);

}


a <- matrix(NA, n, 5);

for (j in 1:ncol(a)) {

a[ , j] <- SimulatePC1();

}


b <- apply(a, 2, HSIndex);

c <- t(sign(b) * t(a));

matplot(c, type = “l”, xlab = “”, ylab = “”, lty = 2);

Suggested Citation:"Appendix B: R Code for Figure 9-2." National Research Council. 2006. Surface Temperature Reconstructions for the Last 2,000 Years. Washington, DC: The National Academies Press. doi: 10.17226/11676.
×

PopulationCov <- function(n)

{

a <- matrix(NA, n, n);

a[] <- phi^abs(row(a) - col(a));

for (i in 1:n)

a[i, ] <- a[i, ] - mean(a[i, baseline]);

for (j in 1:n)

a[ , j] <- a[ , j] - mean(a[baseline, j]);

invisible(a);

}


e <- eigen(PopulationCov(n));

lines(e$vectors[,1], col = 2, lwd = 2);

Suggested Citation:"Appendix B: R Code for Figure 9-2." National Research Council. 2006. Surface Temperature Reconstructions for the Last 2,000 Years. Washington, DC: The National Academies Press. doi: 10.17226/11676.
×
Page 140
Suggested Citation:"Appendix B: R Code for Figure 9-2." National Research Council. 2006. Surface Temperature Reconstructions for the Last 2,000 Years. Washington, DC: The National Academies Press. doi: 10.17226/11676.
×
Page 141
Next: Appendix C: Biosketches of Committee Members »
Surface Temperature Reconstructions for the Last 2,000 Years Get This Book
×
Buy Paperback | $54.00 Buy Ebook | $43.99
MyNAP members save 10% online.
Login or Register to save!
Download Free PDF

In response to a request from Congress, Surface Temperature Reconstructions for the Last 2,000 Years assesses the state of scientific efforts to reconstruct surface temperature records for Earth during approximately the last 2,000 years and the implications of these efforts for our understanding of global climate change. Because widespread, reliable temperature records are available only for the last 150 years, scientists estimate temperatures in the more distant past by analyzing "proxy evidence," which includes tree rings, corals, ocean and lake sediments, cave deposits, ice cores, boreholes, and glaciers. Starting in the late 1990s, scientists began using sophisticated methods to combine proxy evidence from many different locations in an effort to estimate surface temperature changes during the last few hundred to few thousand years. This book is an important resource in helping to understand the intricacies of global climate change.

  1. ×

    Welcome to OpenBook!

    You're looking at OpenBook, NAP.edu's online reading room since 1999. Based on feedback from you, our users, we've made some improvements that make it easier than ever to read thousands of publications on our website.

    Do you want to take a quick tour of the OpenBook's features?

    No Thanks Take a Tour »
  2. ×

    Show this book's table of contents, where you can jump to any chapter by name.

    « Back Next »
  3. ×

    ...or use these buttons to go back to the previous chapter or skip to the next one.

    « Back Next »
  4. ×

    Jump up to the previous page or down to the next one. Also, you can type in a page number and press Enter to go directly to that page in the book.

    « Back Next »
  5. ×

    Switch between the Original Pages, where you can read the report as it appeared in print, and Text Pages for the web version, where you can highlight and search the text.

    « Back Next »
  6. ×

    To search the entire text of this book, type in your search term here and press Enter.

    « Back Next »
  7. ×

    Share a link to this book page on your preferred social network or via email.

    « Back Next »
  8. ×

    View our suggested citation for this chapter.

    « Back Next »
  9. ×

    Ready to take your reading offline? Click here to buy this book in print or download it as a free PDF, if available.

    « Back Next »
Stay Connected!