Learn R Programming

krige (version 0.5.7)

krige.update: Update Kriging Models

Description

This function updates the MCMC iterations associated with the kriging models.

Usage

krige.update(krige.mat,mcmc.samples=100,accepted.beta,accepted.nugget,
        accepted.decay,accepted.psill, y, X, east, north, powered.exp=2,
        spatial.share=0.5,range.share=0.5,beta.var=10,range.tol=0.05,b.tune=1.0,
        nugget.tune=10.0,psill.tune=1.0)

Arguments

krige.mat

The output MCMC matrix from metropolis.krige()

mcmc.samples

Number of MCMC iterations to be run for updating

accepted.beta

The accepted.beta from the previous run

accepted.nugget

The accepted.nugget from the previous run

accepted.decay

The accepted.decay from the previous run

accepted.psill

The accepted.psill from the previous run

y

The dependent variable that was used in the previous model. The same as in metropolis.krige()

X

The matrix of independent variables used in the previous model. The same as in metropolis.krige()

east

Vector of eastings for all observations. The same as in metropolis.krige()

north

Vector of northings for all observations. The same as in metropolis.krige()

powered.exp

A powered exponential correlation structure for the data. The same as in metropolis.krige()

spatial.share

Prior for proportion of unexplained variance that is spatial in nature. The same as in metropolis.krige()

range.share

Prior for the effective range term, as a proportion of the maximum distance in the data. The same as in metropolis.krige()

beta.var

Prior for the variance on zero-meaned normal priors on the regression coefficients. The same as in metropolis.krige()

range.tol

Tolerance term for setting the effective range. The same as in metropolis.krige()

b.tune

Tuning parameter for candidate generation of regression coefficients. The same as in metropolis.krige()

nugget.tune

Tuning parameter for candidate generation of the nugget term (tau2). The same as in metropolis.krige()

psill.tune

Tuning parameter for candidate generation of the partial sill term (sigma2). The same as in metropolis.krige()

Value

Returns an object of class matrix that includes all iterations of the Metropolis-Hastings sampler. Each column of the matrix represents a different parameter--starting with tau2, phi, and sigma2 before listing regression coefficients. Each row represents another iteration of the MCMC sampler. Summarizing the matrix by column offers summaries of the marginal posterior distribution by parameter.

Details

This function updates the previous run by metropolis.krige since MCMC iterations need to run typically long to gurantee convergence.

krige.mat is the output MCMC matrix of metropolis.krige() from the previous run. Analysts can specify the number of interations for update run by mcmc.samples. The acceptance rates for beta, nugget, decay, and psill from the previous model also need to be specified to make sure consistency. Other arguments should also be specified as the same as in the metropolis.krige(), including y, X, east, north, powered.exp, spatial.share, range.share, beta.var, range.tol, b.tune, nugget.tune, psill.tune.

The returned object is the same as metropolis.krige(), a matrix of sampled values from the posterior distribution. Rows represent the iteration number, and ideally the user will discard the first several rows as burn-in. Columns represent the parameter, so summarizing the matrix by column offers summaries of the model's results.

Examples

Run this code
# NOT RUN {
#Set seed
set.seed(1241060320)

#For simple illustration, we set to few iterations.
#But much more are needed for the realistic estimation.
#In this case, a 10,000-iteration run converges to the true parameters.
M1<-5

contrived.run<-metropolis.krige(y=ContrivedData$y,X=covariates,range.tol=0.05,
        east=ContrivedData$s.1,north=ContrivedData$s.2,mcmc.samples=M1)

#Acceptance rates for the first 5 iterations.
#"Acceptance percentages: Coefficients=50%. Nugget=75%. Decay=75%. 
#Partial sill=75%."

#Update for another 5 iterations.
M2<-5

contrived.run.update<-update.krige(krige.mat=contrived,mcmc.samples=M2,
        accepted.beta=0.5,accepted.nugget=0.75,accepted.decay=0.75,
        accepted.psill=0.75,y=ContrivedData$y,X=covariates,range.tol=0.05,
        east=ContrivedData$s.1,north=ContrivedData$s.2)
# }

Run the code above in your browser using DataLab