Package 'OBASpatial'

Title: Objective Bayesian Analysis for Spatial Regression Models
Description: It makes an objective Bayesian analysis of the spatial regression model using both the normal (NSR) and student-T (TSR) distributions. The functions provided give prior and posterior objective densities and allow default Bayesian estimation of the model regression parameters. Details can be found in Ordonez et al. (2020) <arXiv:2004.04341>.
Authors: Alejandro Ordonez, Marcos O. Prates , Larissa A. Matos, Victor H. Lachos.
Maintainer: Alejandro Ordonez <[email protected]>
License: GPL (>= 2)
Version: 1.9
Built: 2025-02-06 03:24:59 UTC
Source: https://github.com/cran/OBASpatial

Help Index


Calcium Content In Soil Samples.

Description

This data set contains the calcium content measured in soil samples taken from the 0-20cm layer at 178 locations within a certain study area divided in three sub-areas. The elevation at each location was also recorded.See geoR package for details.

Usage

data("dataca20")

Format

A data frame with 178 observations on the following 3 variables.

east

X Coordinate.

north

Y coordinate.

calcont

Calcium content measured in mmolc/dm3mmol_c/dm^3.

altitude

A vector with the elevation of each sampling location,in meters.

area

A factor indicating the sub area to which the locations belongs.

References

Oliveira, M. C. N. (2003). Metodos de estimacao de parametros em modelos geoestatisticos com diferentes estruturas de covariancias: uma aplicacao ao teor de calcio no solo. Ph.D. thesis, ESALQ/USP/Brasil.


Surface elevations

Description

Surface elevation data taken from Davis (1972). An onject of the class geodata with elevation values at 52 locations.

Usage

data("dataelev")

Format

A data frame with 52 observations on the following 3 variables.

x

X coordinate (multiple of 50 feet).

y

Y coordinate (multiple of 50 feet).

elevation

elevations (multiples of 10 feet).

References

Davis, J.C. (1973) Statistics and Data Analysis in Geology. Wiley.


Objective posterior density for the NSR model

Description

It calculates the density function π(ϕ)\pi(\phi) (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context ϕ\phi corresponds to the range parameter.

Usage

dnsrposoba(x,formula,prior="reference",coords.col=1:2,
kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi)

Arguments

x

The ϕ\phi quantil value.

formula

A valid formula for a linear regression model.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for vague prior.

intphi

An interval for ϕ\phi used for vague prior.

Details

The posterior distribution is computed for this priors under the improper family π(ϕ)(σ2)a\frac{\pi(\phi)}{(\sigma^2)^a}. For the vague prior, it was considered the structure where a priori, ϕ\phi folows an uniform distribution on the interval intphi.

For the Jeffreys independent prior, this family of priors generates improper posterior distribution when intercept is considered for the mean function.

Value

Posterior density of x=ϕ\phi.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

See Also

dtsrposoba,dtsrprioroba,dnsrprioroba

Examples

data(dataelev)

######### Using reference prior ###########
dnsrposoba(x=5,prior="reference",formula=elevation~1,
kappa=1,cov.model="matern",data=dataelev)

######### Using Jeffreys' rule prior ###########
dnsrposoba(x=5,prior="jef.rul",formula=elevation~1,
kappa=1,cov.model="matern",data=dataelev)

######### Using vague independent prior ###########
dnsrposoba(x=5,prior="vague",formula=elevation~1,
kappa=0.3,cov.model="matern",data=dataelev,intphi=c(0.1,10))

Objective prior density for the NSR model

Description

It calculates the density function π(ϕ)\pi(\phi) (up to a proportionality constant) for the NSR model using the based reference, Jeffreys' rule and Jeffreys' independent priors. In this context ϕ\phi corresponds to the range parameter.

Usage

dnsrprioroba(x,trend="cte",prior="reference",coords.col=1:2,
kappa=0.5,cov.model="exponential",data)

Arguments

x

The ϕ\phi quantil value.

trend

Builds the trend matrix in accordance to a specification of the mean provided by the user. See DETAILS below.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

Details

Denote as c=(c1,c2)\bold{c}=(c_{1},c_{2}) the coordinates of a spatial location. trend defines the design matrix as:

  • 0 (zero,without design matrix) Only valid for the Independent Jeffreys' prior

  • "cte", the design matrix is such that mean function μ(c)=μ\mu(\bold{c})=\mu is constant over the region.

  • "1st", the design matrix is such that mean function becames a first order polynomial on the coordinates:

    μ((c))=β0+β1c1+β2c2\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2

  • "2nd", the design matrix is such that mean function μ(c)=μ\mu(\bold{c})=\mu becames a second order polynomial on the coordinates:

    μ((c))=β0+β1c1+β2c2+β3c12+β4c22+β5c1c2\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2 + \beta_3c_{1}^2+ \beta_4c_{2}^2+ \beta_5c_1c_2

  • ~model a model specification to include covariates (external trend) in the model.

Value

Prior density of x=ϕ\phi

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

See Also

dtsrposoba,dtsrprioroba,dnsrposoba

Examples

data(dataelev)## data using by Berger et. al (2001)

######### Using reference prior ###########
dnsrprioroba(x=20,kappa=0.3,cov.model="matern",data=dataelev)


######### Using jef.rule prior###########
dnsrprioroba(x=20,prior="jef.rul",kappa=0.3,cov.model="matern",
data=dataelev)

######### Using  jef.ind prior ###########
dnsrprioroba(x=20,prior="jef.ind",trend=0,
kappa=0.3,cov.model="matern",data=dataelev)

Objective posterior density for the TSR model

Description

It calculates the density function π(ϕ,ν)\pi(\phi,\nu) (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context ϕ\phi corresponds to the range parameter and ν\nu to the degrees of freedom.

Usage

dtsrposoba(x,formula,prior="reference",coords.col=1:2,
kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi,intnu)

Arguments

x

A vector with the quanties (ϕ,ν)(\phi,\nu). For the vague prior x must be a three dimension vector (ϕ,ν,λ)(\phi,\nu,\lambda) with λ\lambda a number in the interval (0.02,0.5)(0.02,0.5). See DETAILS below.

formula

A valid formula for a linear regression model.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for vague prior.

intphi

An interval for ϕ\phi used for vague prior.

intnu

An interval for ν\nu used for vague prior.

Details

The posterior distribution is computed for this priors under the improper family π(ϕ,ν)(σ2)a\frac{\pi(\phi,\nu)}{(\sigma^2)^a}. For the vague prior, it was considered the structure π(ϕ,ν,λ)=ϕ(ϕ)π(νλ)π(λ)\pi(\phi,\nu,\lambda)=\phi(\phi)\pi(\nu|\lambda)\pi(\lambda) where a priori, ϕ\phi follows an uniform distribution on the interval intphi, νλ Texp(λ,A)\nu|\lambda~ Texp(\lambda,A) with A the interval given by the argument intnu and λ unif(0.02,0.5)\lambda~unif(0.02,0.5).

For the Jeffreys independent prior, this family of priors generates improper posterior distribution when intercept is considered for the mean function.

Value

Posterior density of x=(ϕ,ν\phi,\nu) for the reference based, Jeffreys' rule and Jeffreys' independent priors. For the vague the result is the posterior density of x=(ϕ,ν,λ\phi,\nu,\lambda)

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba

Examples

data(dataca20)

######### Using reference prior ###########
dtsrposoba(x=c(5,11),prior="reference",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20)

######### Using Jeffreys' rule prior ###########
dtsrposoba(x=c(5,11),prior="jef.rul",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20)


######### Using Jeffreys' independent prior ###########
dtsrposoba(x=c(5,11),prior="jef.ind",formula=calcont~altitude+area
,kappa=0.3,cov.model="matern",data=dataca20)

######### Using vague independent prior ###########
dtsrposoba(x=c(5,11,.3),prior="vague",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20,intphi=c(0.1,10),
intnu=c(4.1,30))

Objective prior density for the TSR model

Description

It calculates the density function π(ϕ,ν)\pi(\phi,\nu) (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule and Jeffreys' independent priors. In this context ϕ\phi corresponds to the range parameter and ν\nu to the degrees of freedom.

Usage

dtsrprioroba(x,trend="cte",prior="reference",coords.col=1:2,
kappa=0.5,cov.model="exponential",data)

Arguments

x

A vector with the quanties (ϕ,ν)(\phi,\nu)

trend

Builds the trend matrix in accordance to a specification of the mean provided by the user. See DETAILS below.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent)

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed)

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical

data

Data set with 2D spatial coordinates, the response and optional covariates

Details

Denote as c=(c1,c2)\bold{c}=(c_{1},c_{2}) the coordinates of a spatial location. trend defines the design matrix as:

  • 0 (zero,without design matrix) Only valid for the Independent Jeffreys' prior

  • "cte", the design matrix is such that mean function μ(c)=μ\mu(\bold{c})=\mu is constant over the region.

  • "1st", the design matrix is such that mean function becames a first order polynomial on the coordinates:

    μ((c))=β0+β1c1+β2c2\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2

  • "2nd", the design matrix is such that mean function μ(c)=μ\mu(\bold{c})=\mu becames a second order polynomial on the coordinates:

    μ((c))=β0+β1c1+β2c2+β3c12+β4c22+β5c1c2\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2 + \beta_3c_{1}^2+ \beta_4c_{2}^2+ \beta_5c_1c_2

  • ~model a model specification to include covariates (external trend) in the model.

Value

Density of x=(ϕ,ν\phi,\nu)

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).

See Also

dtsrposoba,dnsrprioroba,dnsrposoba

Examples

data(dataca20)

######### Using reference prior and a constant trend###########
dtsrprioroba(x=c(6,100),kappa=0.3,cov.model="matern",data=dataca20)


######### Using jef.rule prior and 1st trend###########
dtsrprioroba(x=c(6,100),prior="jef.rul",trend=~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20)

######### Using  jef.ind prior ###########
dtsrprioroba(x=c(6,100),prior="jef.ind",trend=0,
kappa=0.3,cov.model="matern",data=dataca20)

Marginal posterior density for a model.

Description

It calculates the marginal density density for a model MM (up to a proportionality constant) for the NSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context ϕ\phi corresponds to the range parameter.

Usage

intmnorm(formula,prior="reference",coords.col=1:2,kappa=0.5,
cov.model="exponential",data,asigma=2.1,intphi,maxEval)

Arguments

formula

A valid formula for a linear regression model.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for vague prior.

intphi

An interval for ϕ\phi used for vague prior.

maxEval

Maximum number of iterations for the integral computation.

Details

Let mkm_k a parametric model with parameter vector θk\theta_k. Under the TSR model and the prior density proposal:

π(ϕ)(σ2)a\frac{\pi(\phi)}{(\sigma^2)^a}

we have that the marginal density is given by:

L(θmk)π(mk)dmk\int L(\theta_{m_k})\pi(m_k)dm_k

This quantity can be useful as a criteria for model selection. The computation of mkm_k could be compute demanding depending on the number of iterations in maxEval.

Value

Marginal density of the model mkm_k for the reference based, Jeffreys' rule, Jeffreys' independent and vague priors.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba

Examples

data(dataca20)

set.seed(25)
data(dataelev)## data using by Berger et. al (2001)

######### Using reference prior ###########
m1=intmnorm(prior="reference",formula=elevation~1,
kappa=0.5,cov.model="matern",data=dataelev,maxEval=1000)

log(m1)


######### Using reference prior kappa=1 ###########
m2=intmnorm(prior="reference",formula=elevation~1,
kappa=1,cov.model="matern",data=dataelev,maxEval=1000)
log(m2)

######### Using reference prior kappa=1.5 ###########
m3=intmnorm(prior="reference",formula=elevation~1
,kappa=1.5,cov.model="matern",data=dataelev,maxEval=1000)
log(m3)

tot=m1+m2+m3

########posterior probabilities: higher probability:
#########prior="reference", kappa=1
p1=m1/tot
p2=m2/tot
p3=m3/tot

Marginal posterior density for a model.

Description

It calculates the marginal density density for a model MM (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context ϕ\phi corresponds to the range parameter and ν\nu to the degrees of freedom.

Usage

intmT(formula,prior="reference",coords.col=1:2,kappa=0.5,
cov.model="exponential",data,asigma,intphi="default",intnu=c(4.1,Inf),maxEval)

Arguments

formula

A valid formula for a linear regression model.

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for vague prior.

intphi

An interval for ϕ\phi used for vague prior.

intnu

An interval for ν\nu used for vague prior.

maxEval

Maximum number of iterations for the integral computation.

Details

Let mkm_k a parametric model with parameter vector θk\theta_k. Under the TSR model and the prior density proposal:

π(ϕ,ν)(σ2)a\frac{\pi(\phi,\nu)}{(\sigma^2)^a}

we have that the marginal density is given by:

L(θmk)π(mk)dmk\int L(\theta_{m_k})\pi(m_k)dm_k

This quantity can be useful as a criteria for model selection. The computation of mkm_k could be compute demanding depending on the number of iterations in maxEval.

Value

Marginal density of the model mkm_k for the reference based, Jeffreys' rule, Jeffreys' independent and vague priors.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba

Examples

set.seed(25)
data(dataca20)



######### Using reference prior ###########
m1=intmT(prior="reference",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)

######### Using Jeffreys' rule prior ###########
m1j=intmT(prior="jef.rul",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)


######### Using Jeffreys' independent prior ###########
m1ji=intmT(prior="jef.ind",formula=calcont~altitude+area
,kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)

m1v=intmT(prior="vague",formula=calcont~altitude+area
,kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000,intphi="default")




tot=m1+m1j+m1ji+m1v

########posterior probabilities: higher probability:
#########prior="reference", kappa=0.3


p1=m1/tot
pj=m1j/tot
pji=m1ji/tot
pv=m1v/tot

Bayesian estimation for the NSR model.

Description

This function performs Bayesian estimation of θ=(β,σ2,ϕ)\theta=(\bold{\beta},\sigma^2,\phi) for the NSR model using the based reference, Jeffreys' rule ,Jeffreys' independent and vague priors.

Usage

nsroba(formula, method="median",
prior = "reference",coords.col = 1:2,kappa = 0.5,
cov.model = "matern", data,asigma=2.1, intphi = "default",
ini.pars, burn=500, iter=5000, thin=10,
cprop = NULL)

Arguments

formula

A valid formula for a linear regression model.

method

Method to estimate (beta,σ,ϕ\bold{beta},\sigma,\phi). The methods availables are "mean","median" and "mode".

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent, vague, Vague).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for the vague prior.

intphi

An interval for ϕ\phi used for the uniform proposal. See DETAILS below.

ini.pars

Initial values for (σ2,ϕ)(\sigma^2,\phi) in that order.

burn

Number of observations considered in the burning process.

iter

Number of iterations for the sampling procedure.

thin

Number of observations considered in the thin process.

cprop

A constant related to the acceptance probability (Default = NULL indicates that cprop is computed as the interval length of intphi). See DETAILS below.

Details

For the "unif" proposal, it was considered the structure where a priori, ϕ\phi follows an uniform distribution on the interval intphi. By default, this interval is computed using the empirical range of data as well as the constant cprop.

For the Jeffreys independent prior, the sampling procedure generates improper posterior distribution when intercept is considered for the mean function.

Value

$dist

Joint sample (matrix object) obtaining for (beta,σ2,ϕ\bold{beta},\sigma^2,\phi).

$betaF

Sample obtained for beta\bold{beta}.

$sigmaF

Sample obtained for σ2\sigma^2.

$phiF

Sample obtained for ϕ\phi.

$coords

Spatial data coordinates.

$kappa

Shape parameter of the covariance function.

$X

Design matrix of the model.

$type

Covariance function of the model.

$theta

Bayesian estimator of (beta,σ,ϕ\bold{beta},\sigma,\phi).

$y

Response variable.

$prior

Prior density considered.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba,tsroba

Examples

set.seed(25)
data(dataelev)


######covariance matern: kappa=0.5
res=nsroba(elevation~1, kappa = 0.5, cov.model = "matern", data=dataelev,
ini.pars=c(10,390))

summary(res)

######covariance matern: kappa=1
res1=nsroba(elevation~1, kappa = 1, cov.model = "matern", data=dataelev,
ini.pars=c(10,390))

summary(res1)

######covariance matern: kappa=1.5
res2=nsroba(elevation~1, kappa = 1.5, cov.model = "matern", data=dataelev,
ini.pars=c(10,390))

summary(res2)

Prediction under Normal Objective Bayesian Analysis (OBA).

Description

This function uses the sampling distribution of parameters obtained from the function tsroba to predict values at unknown locations.

Usage

nsrobapred1(xpred, coordspred, obj)

Arguments

xpred

Values of the X design matrix for prediction coordinates.

coordspred

Points coordinates to be predicted.

obj

object of the class "nsroba" (see nsroba function).

Details

This function predicts using the sampling distribution of parameters obtained from the function nsroba and the conditional normal distribution of the predicted values given the data.

Value

This function returns a vector with the predicted values at the specified locations.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

Diggle, P. and P. Ribeiro (2007).Model-Based Geostatistics. Springer Series in Statistics.

See Also

nsroba,tsrobapred

Examples

set.seed(25)
data(dataelev)
d1=dataelev[1:42,]

reselev=nsroba(elevation~1, kappa = 0.5, cov.model = "matern", data=d1,
ini.pars=c(10,3),intphi=c(0.8,10))

datapred1=dataelev[43:52,]
coordspred1=datapred1[,1:2]
nsrobapred1(obj=reselev,coordspred=coordspred1,xpred=rep(1,10))

Summary of a nsroba object

Description

summary method for class "nsroba".

Usage

## S3 method for class 'nsroba'
summary(object,...)

Arguments

object

object of the class "nsroba" (see nsroba function).

...

Additional arguments.

Value

mean.str

Estimates for the mean structure parameters beta\bold{beta}.

var.str

Estimates for the variance structure parameters σ2,ϕ\sigma^2, \phi.

betaF

Sample obtained for beta\bold{beta}.

sigmaF

Sample obtained for σ2\sigma^2.

phiF

Sample obtained for ϕ\phi.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Berger, J.O, De Oliveira, V. and Sanso, B. (2001). Objective Bayesian Analysis of Spatially Correlated Data. Journal of the American Statistical Association., 96, 1361 – 1374.

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba,tsroba

Examples

set.seed(25)
data(dataelev)


######covariance matern: kappa=0.5
res=nsroba(elevation~1, kappa = 0.5, cov.model = "matern", data=dataelev,
ini.pars=c(10,3))

summary(res)

Summary of a nsroba object

Description

summary method for class "tsroba".

Usage

## S3 method for class 'tsroba'
summary(object, ...)

Arguments

object

object of the class "tsroba" (see tsroba function).

...

Additional arguments.

Value

mean.str

Estimates for the mean structure parameters beta\bold{beta}.

var.str

Estimates for the variance structure parameters σ2,ϕ,ν\sigma^2, \phi, \nu.

betaF

Sample obtained for beta\bold{beta}.

sigmaF

Sample obtained for σ2\sigma^2.

phiF

Sample obtained for ϕ\phi.

nuF

Sample obtained for ν\nu.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models. (Submitted)

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba,tsroba

Examples

set.seed(25)
data(dataca20)
d1=dataca20[1:158,]

xpred=model.matrix(calcont~altitude+area,data=dataca20[159:178,])
xobs=model.matrix(calcont~altitude+area,data=dataca20[1:158,])
coordspred=dataca20[159:178,1:2]

######covariance matern: kappa=0.3 prior:reference
res=tsroba(calcont~altitude+area, kappa = 0.3, data=d1,
           ini.pars=c(10,3,10))

summary(res)

Bayesian estimation for the TSR model.

Description

This function performs Bayesian estimation of θ=(β,σ2,ϕ)\theta=(\bold{\beta},\sigma^2,\phi) for the TSR model using the based reference, Jeffreys' rule ,Jeffreys' independent and vague priors.

Usage

tsroba(formula, method="median",sdnu=1,
prior = "reference",coords.col = 1:2,kappa = 0.5,
cov.model = "matern", data,asigma=2.1, intphi = "default",
intnu="default",ini.pars,burn=500, iter=5000,thin=10,cprop = NULL)

Arguments

formula

A valid formula for a linear regression model.

method

Method to estimate (beta,σ,ϕ,ν\bold{beta},\sigma,\phi,\nu). The methods availables are "mean","median" and "mode".

sdnu

Standard deviation logarithm for the lognormal proposal for ν\nu

prior

Objective prior densities avaiable for the TSR model: ( reference: Reference based, jef.rul: Jeffreys' rule, jef.ind: Jeffreys' independent,vague: Vague).

coords.col

A vector with the column numbers corresponding to the spatial coordinates.

kappa

Shape parameter of the covariance function (fixed).

cov.model

Covariance functions available for the TSR model. matern: Matern, pow.exp: power exponential, exponential:exponential, cauchy: Cauchy, spherical: Spherical.

data

Data set with 2D spatial coordinates, the response and optional covariates.

asigma

Value of aa for vague prior.

intphi

An interval for ϕ\phi used for the uniform proposal. See DETAILS below.

intnu

An interval for ν\nu used for the uniform proposal. See DETAILS below.

ini.pars

Initial values for (σ2,ϕ,ν)(\sigma^2,\phi,\nu) in that order.

burn

Number of observations considered in burning process.

iter

Number of iterations for the sampling procedure.

thin

Number of observations considered in thin process.

cprop

A constant related to the acceptance probability (Default = NULL indicates that cprop is computed as the interval length of intphi). See DETAILS below.

Details

For the prior proposal, it was considered the structure π(ϕ,ν,λ)=ϕ(ϕ)π(νλ)π(λ)\pi(\phi,\nu,\lambda)=\phi(\phi)\pi(\nu|\lambda)\pi(\lambda). For the vague prior, ϕ\phi follows an uniform distribution on the interval intphi, by default, this interval is computed using the empirical range of data as well as the constant cprop. On the other hand, νλ Texp(λ,A)\nu|\lambda~ Texp(\lambda,A) with A the interval given by the argument intnu and λ unif(0.02,0.5)\lambda~unif(0.02,0.5)

For the Jeffreys independent prior, the sampling procedure generates improper posterior distribution when intercept is considered for the mean function.

Value

dist

Joint sample (matrix object) obtaining for (beta,σ2,ϕ\bold{beta},\sigma^2,\phi).

betaF

Sample obtained for beta\bold{beta}.

sigmaF

Sample obtained for σ2\sigma^2.

phiF

Sample obtained for ϕ\phi.

nuF

Sample obtained for ϕ\phi.

coords

Spatial data coordinates.

kappa

Shape parameter of the covariance function.

$X

Design matrix of the model.

$type

Covariance function of the model.

$theta

Bayesian estimator of (beta,σ,ϕ\bold{beta},\sigma,\phi).

$y

Response variable.

$prior

Prior density considered.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models. (Submitted)

See Also

dnsrposoba,dtsrprioroba,dnsrprioroba,tsroba

Examples

set.seed(25)
data(dataca20)
d1=dataca20[1:158,]

xpred=model.matrix(calcont~altitude+area,data=dataca20[159:178,])
xobs=model.matrix(calcont~altitude+area,data=dataca20[1:158,])
coordspred=dataca20[159:178,1:2]

######covariance matern: kappa=0.3 prior:reference
res=tsroba(calcont~altitude+area, kappa = 0.3, data=d1,
           ini.pars=c(10,390,10),iter=11000,burn=1000,thin=10)

summary(res)

######covariance matern: kappa=0.3 prior:jef.rul
res1=tsroba(calcont~altitude+area, kappa = 0.3,
            data=d1,prior="jef.rul",ini.pars=c(10,390,10),
            iter=11000,burn=1000,thin=10)

summary(res1)

######covariance matern: kappa=0.3 prior:jef.ind
res2=tsroba(calcont~altitude+area, kappa = 0.3, data=d1,
            prior="jef.ind",ini.pars=c(10,390,10),iter=11000,
            burn=1000,thin=10)

summary(res2)

######covariance matern: kappa=0.3 prior:vague
res3=tsroba(calcont~altitude+area, kappa = 0.3,
     data=d1,prior="vague",ini.pars=c(10,390,10),,iter=11000,
     burn=1000,thin=10)

summary(res3)

####obtaining posterior probabilities
###(just comparing priors with kappa=0.3).
###the real aplication (see Ordonez et.al) consider kappa=0.3,0.5,0.7.

######### Using reference prior ###########
m1=intmT(prior="reference",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)

######### Using Jeffreys' rule prior ###########
m1j=intmT(prior="jef.rul",formula=calcont~altitude+area,
kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)


######### Using Jeffreys' independent prior ###########
m1ji=intmT(prior="jef.ind",formula=calcont~altitude+area
,kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000)

m1v=intmT(prior="vague",formula=calcont~altitude+area
,kappa=0.3,cov.model="matern",data=dataca20,maxEval=1000,intphi="default")


tot=m1+m1j+m1ji+m1v

####posterior probabilities#####
p1=m1/tot
pj=m1j/tot
pji=m1ji/tot
pv=m1v/tot


##########MSPE#######################################

pme=tsrobapred(res,xpred=xpred,coordspred=coordspred)
pme1=tsrobapred(res1,xpred=xpred,coordspred=coordspred)
pme2=tsrobapred(res2,xpred=xpred,coordspred=coordspred)
pme3=tsrobapred(res3,xpred=xpred,coordspred=coordspred)

mse=mean((pme-dataca20$calcont[159:178])^2)
mse1=mean((pme1-dataca20$calcont[159:178])^2)
mse2=mean((pme2-dataca20$calcont[159:178])^2)
mse3=mean((pme3-dataca20$calcont[159:178])^2)

Prediction under Student-t Objective Bayesian Analysis (OBA).

Description

This function uses the sampling distribution of parameters obtained from the function tsroba to predict values at unknown locations.

Usage

tsrobapred(obj,xpred,coordspred)

Arguments

obj

object of the class "tsroba" (see tsroba function).

xpred

Values of the X design matrix for prediction coordinates.

coordspred

Points coordinates to be predicted.

Details

This function predicts using the sampling distribution of parameters obtained from the function tsroba and the conditional Student-t distribution of the predicted values given the data.

Value

This function returns a vector with the predicted values at the specified locations.

Author(s)

Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.

References

Diggle, P. and P. Ribeiro (2007).Model-Based Geostatistics. Springer Series in Statistics.

Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models. (Submitted)

See Also

tsroba,nsrobapred1

Examples

set.seed(25)
data(dataca20)
d1=dataca20[1:158,]

######covariance matern: kappa=0.3 prior:reference
res=tsroba(calcont~altitude+area, kappa = 0.3, data=d1,
ini.pars=c(10,3,10),iter=50,thin=1,burn=5)

datapred=dataca20[159:178,]
formula=calcont~altitude+area
xpred=model.matrix(formula,data=datapred)

tsrobapred(res,xpred=xpred,coordspred=dataca20[159:178,1:2])