################################################### ### chunk number 1: simpleO3 ################################################### load("o3-data.RData") par(mfrow = c(3, 1), mar = c(2, 4, 4, 1)) plot(xtime, o3[, "06037"], type = "l", main = "Los Angeles, CA", ylab = "ppb") plot(xtime, o3[, "17031"], type = "l", main = "Chicago, IL", ylab = "ppb") plot(xtime, o3[, "36005"], type = "l", main = "Bronx, NY", ylab = "ppb") ################################################### ### chunk number 2: loadcode ################################################### source("mvtsplot.R") ################################################### ### chunk number 3: simulatedata ################################################### set.seed(971) x1 <- matrix(-0.005 * (1:200) + rnorm(200 * 10), 200, 10) x2 <- matrix(-0.005 * (1:200) + rnorm(200 * 10, mean = 2, sd = 2), 200, 10) x <- cbind(x1, x2) colnames(x) <- paste("X", 1:ncol(x)) g <- gl(2, 10) ################################################### ### chunk number 4: norminternal ################################################### mvtsplot(x, margin = FALSE, norm = "internal", group = g) ################################################### ### chunk number 5: normglobal ################################################### mvtsplot(x, margin = FALSE, norm = "global", group = g) ################################################### ### chunk number 6: usemargin ################################################### mvtsplot(x, group = g, levels = 7) ################################################### ### chunk number 7: showargs ################################################### args(mvtsplot) ################################################### ### chunk number 8: loadcode ################################################### source("mvtsplot.R") ################################################### ### chunk number 9: ozone ################################################### load("o3-data.RData") use <- xtime >= as.Date("2002-01-01") xtime <- xtime[use] o3 <- o3[use, ] use <- dget("top100.R") o3 <- o3[, use] cc <- dget("countycensus.R") ord <- order(cc[use, "lat"]) source("fipsNames.R") colnames(o3) <- fipsNames(colnames(o3)) mvtsplot(o3[, ord], xtime = xtime, levels = 11) ################################################### ### chunk number 10: sulfate ################################################### load("component-data.RData") sulfate <- sapply(compList, function(x) x[, "SULFATE"]) region <- dget("fips-region.R") tab <- region$regionEW names(tab) <- region$fips EW <- tab[colnames(sulfate)] source("fipsNames.R") colnames(sulfate) <- fipsNames(colnames(sulfate)) mvtsplot(sulfate, group = EW, xtime = xtime) ################################################### ### chunk number 11: sulfateSmooth ################################################### sulfate <- sapply(compList, function(x) x[, "SULFATE"]) region <- dget("fips-region.R") tab <- region$regionEW names(tab) <- region$fips EW <- tab[colnames(sulfate)] source("fipsNames.R") colnames(sulfate) <- fipsNames(colnames(sulfate)) mvtsplot(sulfate, group = EW, xtime = xtime, smooth.df = 4*4, levels = 21) ################################################### ### chunk number 12: nickel ################################################### nickel <- sapply(compList, function(x) x[, "nickel"]) region <- dget("fips-region.R") source("fipsNames.R") colnames(nickel) <- fipsNames(colnames(nickel)) mvtsplot(nickel, xtime = xtime, sort = "median", levels = 15, smooth.df = 4*8) ################################################### ### chunk number 13: allcomponentsNY ################################################### x <- compList[["36005"]] ## Bronx med <- apply(x, 2, median, na.rm = TRUE) ord <- order(med, decreasing = TRUE) use <- ord[1:40] ## Omit sulfur (5) so that we don't double count mvtsplot(x[, use[-5]], xtime = xtime, rowstat = sum, smooth.df = 4 * 4, levels = 15) ################################################### ### chunk number 14: finance ################################################### load("stockprices.rda") mvtsplot(sw, xtime = xt, levels = 21, rowstat = sum)