mcmc.samples: Extract MCMC Samples

View source: R/mcmc.samples.R

mcmc.samplesR Documentation

Extract MCMC Samples

Description

Extract MCMC samples estimated by metropolis.krige()

Usage

mcmc.samples(object, as.matrix, as.data.frame, ...)

## S3 method for class 'krige'
mcmc.samples(object, as.matrix = !as.data.frame, as.data.frame = FALSE, ...)

## S3 method for class 'summary.krige'
mcmc.samples(object, as.matrix = !as.data.frame, as.data.frame = FALSE, ...)

## S3 method for class 'krige'
as.matrix(x, ...)

## S3 method for class 'summary.krige'
as.matrix(x, ...)

## S3 method for class 'krige'
as.data.frame(x, ...)

## S3 method for class 'summary.krige'
as.data.frame(x, ...)

Arguments

object

A krigeor summary.krige object from the metropolis.krige function.

as.matrix

Logical values indicating if the output format should be a matrix. Defaults to TRUE.

as.data.frame

Logical values indicating if the output format should be a data.frame. Defaults to FALSE.

...

Additional arguments passed to as.matrix or as.data.frame methods.

x

A krige or summary.krige object for as.matrix and as.data.frame methods.

Details

The function extracts the MCMC samples from the a krigeor summary.krige object from the metropolis.krige function. Users can define the output by using as.matrix or as.data.frame.

Value

A summary.krige list object.

See Also

as.mcmc.krige

Examples

## Not run: 
# Summarize Data
summary(ContrivedData)

# Initial OLS model
contrived.ols<-lm(y~x.1+x.2,data=ContrivedData)
# summary(contrived.ols)

# 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, n.burnin = 20, range.tol = 0.05)
   
contrived.run.mat <- mcmc.samples(contrived.run)

### Alternatively, use generic methods
contrived.run.mat <- as.matrix(contrived.run)
contrived.run.df <- as.data.frame(contrived.run)

## End(Not run)


krige documentation built on May 1, 2022, 5:06 p.m.

Related to mcmc.samples in krige...