Learn R Programming

SpatioTemporal (version 0.9.2)

mesa.data.res: Results of some time consuming code.

Description

Data structure holding results of some time consuming code. These precomputed results is used in internal examples and in the package-vignette (Bergen and Lindstr�m{Lindstrom}, 2011).

Usage

data(mesa.data)

Arguments

encoding

latin1

References

M. A. Cohen, S. D. Adar, R. W. Allen, E. Avol, C. L. Curl, T. Gould, D. Hardie, A. Ho, P. Kinney, T. V. Larson, P. D. Sampson, L. Sheppard, K. D. Stukovsky, S. S. Swan, L. S. Liu, J. D. Kaufman. (2009) Approach to Estimating Participant Pollutant Exposures in the Multi-Ethnic Study of Atherosclerosis and Air Pollution (MESA Air). Environmental Science & Technology: 43(13), 4687-4693.

Bergen, S. and Lindstr�m, J.{Lindstrom, J.}. (2011) Tutorial for Spatio-Temporal R Package

See Also

Results from the estimation functions fit.mesa.model, createCV, estimateCV, predictCV, and run.MCMC using data in mesa.data.raw.

Examples

Run this code
##load data
data(mesa.data.model)
data(mesa.data.res)

##examining which components we have
names(mesa.data.res)

##examining the results for the different components

#################
## For par.est ##
#################
names(mesa.data.res$par.est)

##Optimisation status message
mesa.data.res$par.est$message

##extract the estimated parameters
x <- mesa.data.res$par.est$res.best$par.all
##and approximate uncertainties from the hessian
x.sd <- sqrt(diag(-solve(mesa.data.res$par.est$res.best$hessian.all)))

##plot the estimated parameters
par(mfrow=c(1,1),mar=c(13.5,2.5,.5,.5))
plot(x,ylab="",xlab="",xaxt="n")
abline(h=0, col="grey")
axis(1,1:length(x),names(x),las=2)

########################
## For EX and EX.obs  ##
########################
names(mesa.data.res$EX)
names(mesa.data.res$EX.obs)


####################
## For par.est.cv ##
####################
names(mesa.data.res$par.est.cv)

##boxplot of the different estimates from the CV
par(mfrow=c(1,1), mar=c(7,2.5,2,.5), las=2)
boxplot(t(mesa.data.res$par.est.cv$par))
points(mesa.data.res$par.est$res.best$par, pch=4, col=2)

##################
## For pred.cv  ##
##################
names(mesa.data.res$pred.cv)

##Plot observations with CV-predictions and prediction intervals
par(mfcol=c(4,1),mar=c(2.5,2.5,2,.5))
plotCV(mesa.data.res$pred.cv,  1, mesa.data.model)
plotCV(mesa.data.res$pred.cv, 10, mesa.data.model)
plotCV(mesa.data.res$pred.cv, 17, mesa.data.model)
plotCV(mesa.data.res$pred.cv, 22, mesa.data.model)

#########################################
## For par.est.ST and par.est.ST.mean0 ##
#########################################
names(mesa.data.res$par.est.ST)
names(mesa.data.res$par.est.ST.mean0)

##Optimisation status message
mesa.data.res$par.est.ST$message
mesa.data.res$par.est.ST.mean0$message

##extract the estimated parameters
x.ST <- mesa.data.res$par.est.ST$res.best$par.all
x.ST0 <- mesa.data.res$par.est.ST.mean0$res.best$par.all

##plot the estimated parameters
par(mfrow=c(1,1),mar=c(13.5,2.5,.5,.5))
plot(c(1:5,7:19), x.ST, ylab="",xlab="",xaxt="n")
points(1:19, x.ST0, pch=3, col=2)
points(c(2:5,7:19), x, pch=4, col=3)
abline(h=0, col="grey")
axis(1,1:length(x.ST0),names(x.ST0),las=2)
legend("bottomleft", col = c(1,2,3), pch = 1:3, 
       legend=c("par.est.ST","par.est.ST.mean0","par.est.ST"))

##################
## For MCMC.res ##
##################
names(mesa.data.res$MCMC.res)

##The MCMC-estimated parameters
summary(mesa.data.res$MCMC.res$par)

##MCMC tracks for four of the parameters
par(mfrow=c(4,1),mar=c(2,2,2.5,.5))
for(i in c(4,9,13,15)){
  plot(mesa.data.res$MCMC.res$par[,i], ylab="", xlab="", type="l",
       main=colnames(mesa.data.res$MCMC.res$par)[i])
}

##And estimated densities for the log-covariance parameters.
##The red line is the approximate normal distribution given by
##the maximum-likelihood estimates, e.g. ML-estimate and standard 
##deviation from the observed information matrix.
par(mfrow=c(3,3),mar=c(4,4,2.5,.5))
for(i in 9:17){
  xd <- sort(unique(mesa.data.res$MCMC.res$par[,i]))
  yd <- dnorm(xd, mean=x[i],sd=x.sd[i])
  dens <- density(mesa.data.res$MCMC.res$par[,i])
  plot(dens, ylim=c(0,max(c(dens$y,yd))), main =
       colnames(mesa.data.res$MCMC.res$par)[i])
  lines(xd,yd,col=2)
}

Run the code above in your browser using DataLab