warwickR - Fuentes LAB NOTES:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fuentes LAB NOTES: www4.stat.ncsu.edu/~fuentes/barcelonalab.doc DATASETS NEEDED: coalash.dt (Coal Ash dataset) www4.stat.ncsu.edu/~fuentes/coalash.txt davis.txt (topographic heights) www4.stat.ncsu.edu/~fuentes/davis.txt ozone.txt (ozone values) www4.stat.ncsu.edu/~fuentes/ozone.txt Named the 3 files coalash.txt, davis.txt and ozone.txt in your directory. software R with library geoR, fields and akima These packages are not compatible with each other Use command detach(package:fields) to detach packages. This lab has 2 parts: Part I: spatial estimation, and Part II: Bayesian spatial estimation and prediction PART I Estimating the spatial structure ##EXERCISE 1: How to plot the data and get empirical semivariograms ##EXERCESE 2: WNLS VARIOGRAM ESTIMATOR ##EXERCISE 3: REML ##EXERCISE 4: Profile likelihood ######################################################################## #Using geoR library # download your data using read.table # to learn more about read.table type # > ? read.table coal.ash<-read.table('coalash.txt') coal.m<-as.matrix(coal.ash) davis.txt<-read.table('davis.txt') davis.m<-as.matrix(davis.txt)[,1:3] ##EXERCISE 1: How to plot the data and get binned semivariograms #TO PLOT THE DATA X11() plot.geodata(coords=coal.m[,2:3],data=coal.m[,4]) # The plots returned are: ## - A plot with data locations. Symbols, theirs sizes (and colors) sepatates data from diferent quartiles as follows ### (circles) : 1st quantile ### (triangles) : 2nd ### (plus) : 3rd ### (crosses) : 4th ## - A plot with data-values agains coordinate X ## - A plot with data-values agains coordinate Y #TO PRODUCE A VARIOGRAM CLOUD cloud1<-variog(coords=coal.m[,2:3],data=coal.m[,4] ,option='cloud') cloud2<-variog(coords=coal.m[,2:3],data=coal.m[,4] ,option='cloud', estimator.type='modulus') par(mfrow=c(1,2)) plot(cloud1) plot(cloud2) bin1<-variog(coords=coal.m[,2:3],data=coal.m[,4], bin.cloud=T,uvec=seq(0,10,l=11)) ## uvec : n-element vector of values to define the binning; ## the values of uvec defines the center of the bins bin2<-variog(coords=coal.m[,2:3],data=coal.m[,4], bin.cloud=T,estimator.type='modulus',uvec=seq(0,10,l=11)) par(mfrow=c(1,3)) plot(bin1) plot(bin1,bin.cloud=T) plot(bin2) #with Davis data: bin.davis<-variog(coords=davis.m[,1:2],data=davis.m[,3], bin.cloud=T,uvec=seq(0,4,l=11)) plot(bin.davis) ############################################################################# ##EXERCESE 2: WNLS ESTIMATOR bin3<-variog(coords=coal.m[,2:3],data=coal.m[,4]) wls<-variofit(bin3, ini.cov.pars=c(.5,3), fix.nugget=F, nugget=0,cov.model="exponential") summary(wls) #output of wls # THE WEIGHTS ARE OBTAINED FROM AN ITERATIVE, NONLINEAR ESTIMATION # ROUTIME, using 'nlminb', # nlminb is based on the Fortran functions dmnfb, dmngb, and # dmnhb (Gay (1983; 1984), A T & T (1984)) from NETLIB # (Dongarra and Grosse (1987))....
View Full Document

Page1 / 11

warwickR - Fuentes LAB NOTES:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online