################################################### ### chunk number 3: nationalAverageEstimates ################################################### source(file.path("data", "utils.R")) library(tlnise) library(xtable) Seasons <- c("Winter", "Spring", "Summer", "Fall", "All Seasons") Lags <- paste("Lag", 0:2); exclude <- c("hono", "anch") ## Load non-seasonal estimates load(file.path("results", "city-specific-est.pm10.rda")) results <- lapply(results, function(x) x[setdiff(names(x), exclude)]) ## Pool estimates betacovTotal <- lapply(results, extractBetaCov, pollutant = "pm10") pooledTotal <- lapply(betacovTotal, poolCoef) ## Load seasonal estimates load(file.path("results", "seasonal.factor2.lag.012.pm10.rda")) results <- lapply(results, function(x) x[setdiff(names(x), exclude)]) ## Pool estimates by season pooledSeas <- lapply(results, coefSeasonal, pollutant = "pm10", method = "factor2") pooled <- lapply(seq(along = pooledSeas), function(i) { m <- rbind(pooledSeas[[i]], pooledTotal[[i]]) rownames(m) <- Seasons m }) ## Make table names(pooled) <- Lags pm <- do.call("rbind", pooled) * 1000 ppp <- cbind(pm[,1], pm[,1] - 2*pm[,2], pm[,1] + 2*pm[,2]) lf <- gsub("\\$", "", sub("_", " ", LouisFormat(ppp, "confint"))) estmat <- matrix(lf, byrow = TRUE, ncol = 5, dimnames = list(Lags, Seasons)) print(xtable(estmat, caption = "National average estimates and 95\\% posterior intervals of the overall and season-specific effects of \PMTen\ at lags 0, 1, and 2 for 100 cities, 1987--2000. Estimates were obtained by pooling city-specific coefficients from the main effect and pollutant-season interaction models, respectively, and represent the percent increase in daily mortality for a 10~\mgmcube\ increase in \PMTen.", label = "tab:natlavg", align = c("l", rep("l", 5))))