Learn R Programming

krige (version 0.6.2)

as.matrix.semivariance: Convert semivariance to a matrix object

Description

Convert semivariance to a matrix object

Usage

# S3 method for semivariance
as.matrix(x, ...)

# S3 method for semivariance as.data.frame(x, ...)

Arguments

x

An semivariance object created by semivariance or exponential.semivariance.

Additional arguments passed to as.matrix and as.data.frame methods. Not supported for semivariance object.

Value

A matrix containing the computed distance and semivariance.

Details

The defaults of semivariance methods give a list or numeric vector. These methods can convert the semivariance output list and vector to matrix or data.frame.

Examples

Run this code
# NOT RUN {
# Summarize Data
summary(ContrivedData)

# Empirical semivariance for variable y
raw.var <- semivariance(x=ContrivedData$y,coords = cbind(ContrivedData$s.1, 
  ContrivedData$s.2))
as.matrix(raw.var)

# Estimation using metropolis.krige()
#' # Set seed
set.seed(1241060320)

M <- 100
#M<-10000

contrived.run <- metropolis.krige(y ~ x.1 + x.2, coords = c("s.1","s.2"), 
   data = ContrivedData, n.iter = M, range.tol = 0.05)

# Parametric semivariance
parametric.var <- semivariance(contrived.run)
as.matrix(parametric.var)
as.data.frame(parametric.var)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab