Type: | Package |
Title: | Objective Bayesian Analysis for Spatial Regression Models |
Version: | 1.9 |
Depends: | R (≥ 3.6.0) |
Date: | 2022-09-11 |
Author: | Alejandro Ordonez, Marcos O. Prates , Larissa A. Matos, Victor H. Lachos. |
Maintainer: | Alejandro Ordonez <ordonezjosealejandro@gmail.com> |
Imports: | stats,modeest,cubature,truncdist,invgamma,LaplacesDemon,HDInterval,mvtnorm |
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) <doi:10.48550/arXiv.2004.04341>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | no |
Packaged: | 2022-09-11 03:49:13 UTC; ALEJANDRO |
Repository: | CRAN |
Date/Publication: | 2022-09-11 04:12:54 UTC |
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
mmol_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 |
formula |
A valid formula for a linear regression model. |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
Details
The posterior distribution is computed for this priors under the improper family \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 |
trend |
Builds the trend matrix in accordance to a specification of the mean provided by the user. See |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
Details
Denote as \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\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:\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2
-
"2nd"
, the design matrix is such that mean function\mu(\bold{c})=\mu
becames a second order polynomial on the coordinates:\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 |
formula |
A valid formula for a linear regression model. |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
intnu |
An interval for |
Details
The posterior distribution is computed for this priors under the improper family \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
, \nu|\lambda~ Texp(\lambda,A)
with A the interval given by the argument intnu
and \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 |
trend |
Builds the trend matrix in accordance to a specification of the mean provided by the user. See |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates |
Details
Denote as \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\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:\mu(\bold(c))=\beta_0+ \beta_1c_1+\beta_2c_2
-
"2nd"
, the design matrix is such that mean function\mu(\bold{c})=\mu
becames a second order polynomial on the coordinates:\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 M
(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: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
intnu |
An interval for |
maxEval |
Maximum number of iterations for the integral computation. |
Details
Let m_k
a parametric model with parameter vector \theta_k
. Under the TSR model and the prior density proposal:
\frac{\pi(\phi,\nu)}{(\sigma^2)^a}
we have that the marginal density is given by:
\int L(\theta_{m_k})\pi(m_k)dm_k
This quantity can be useful as a criteria for model selection. The computation of m_k
could be compute demanding depending on the number of iterations in maxEval
.
Value
Marginal density of the model m_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
Marginal posterior density for a model.
Description
It calculates the marginal density density for a model M
(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: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
maxEval |
Maximum number of iterations for the integral computation. |
Details
Let m_k
a parametric model with parameter vector \theta_k
. Under the TSR model and the prior density proposal:
\frac{\pi(\phi)}{(\sigma^2)^a}
we have that the marginal density is given by:
\int L(\theta_{m_k})\pi(m_k)dm_k
This quantity can be useful as a criteria for model selection. The computation of m_k
could be compute demanding depending on the number of iterations in maxEval
.
Value
Marginal density of the model m_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
Bayesian estimation for the NSR model.
Description
This function performs Bayesian estimation of \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 ( |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
ini.pars |
Initial values for |
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
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 ( |
$betaF |
Sample obtained for |
$sigmaF |
Sample obtained for |
$phiF |
Sample obtained for |
$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 ( |
$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 |
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
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 |
... |
Additional arguments. |
Value
mean.str |
Estimates for the mean structure parameters |
var.str |
Estimates for the variance structure parameters |
betaF |
Sample obtained for |
sigmaF |
Sample obtained for |
phiF |
Sample obtained for |
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 |
... |
Additional arguments. |
Value
mean.str |
Estimates for the mean structure parameters |
var.str |
Estimates for the variance structure parameters |
betaF |
Sample obtained for |
sigmaF |
Sample obtained for |
phiF |
Sample obtained for |
nuF |
Sample obtained for |
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 \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 ( |
sdnu |
Standard deviation logarithm for the lognormal proposal for |
prior |
Objective prior densities avaiable for the TSR model: ( |
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. |
data |
Data set with 2D spatial coordinates, the response and optional covariates. |
asigma |
Value of |
intphi |
An interval for |
intnu |
An interval for |
ini.pars |
Initial values for |
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
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, \nu|\lambda~ Texp(\lambda,A)
with A the interval given by the argument intnu
and \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 ( |
betaF |
Sample obtained for |
sigmaF |
Sample obtained for |
phiF |
Sample obtained for |
nuF |
Sample obtained for |
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 ( |
$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 |
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
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])