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 |
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.
data("dataca20")
data("dataca20")
A data frame with 178 observations on the following 3 variables.
east
X Coordinate.
north
Y coordinate.
calcont
Calcium content measured in .
altitude
A vector with the elevation of each sampling location,in meters.
area
A factor indicating the sub area to which the locations belongs.
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 elevation data taken from Davis (1972). An onject of the class geodata with elevation values at 52 locations.
data("dataelev")
data("dataelev")
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).
Davis, J.C. (1973) Statistics and Data Analysis in Geology. Wiley.
It calculates the density function (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context
corresponds to the range parameter.
dnsrposoba(x,formula,prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi)
dnsrposoba(x,formula,prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi)
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 |
The posterior distribution is computed for this priors under the improper family . For the vague prior, it was considered the structure where a priori,
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.
Posterior density of x=.
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
dtsrposoba
,dtsrprioroba
,dnsrprioroba
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))
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))
It calculates the density function (up to a proportionality constant) for the NSR model using the based reference, Jeffreys' rule and Jeffreys' independent priors. In this context
corresponds to the range parameter.
dnsrprioroba(x,trend="cte",prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data)
dnsrprioroba(x,trend="cte",prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data)
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. |
Denote as 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 is constant over the region.
"1st"
, the design matrix is such that mean function becames a first order polynomial on the coordinates:
"2nd"
, the design matrix is such that mean function becames a second order polynomial on the coordinates:
~model
a model specification to include covariates (external trend) in the model.
Prior density of x=
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
dtsrposoba
,dtsrprioroba
,dnsrposoba
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)
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)
It calculates the density function (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context
corresponds to the range parameter and
to the degrees of freedom.
dtsrposoba(x,formula,prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi,intnu)
dtsrposoba(x,formula,prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data,asigma=2.1,intphi,intnu)
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 |
The posterior distribution is computed for this priors under the improper family . For the vague prior, it was considered the structure
where a priori,
follows an uniform distribution on the interval
intphi
, with A the interval given by the argument
intnu
and .
For the Jeffreys independent prior, this family of priors generates improper posterior distribution when intercept is considered for the mean function.
Posterior density of x=() for the reference based, Jeffreys' rule and Jeffreys' independent priors. For the vague the result is the posterior density of x=(
)
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).
dnsrposoba
,dtsrprioroba
,dnsrprioroba
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))
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))
It calculates the density function (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule and Jeffreys' independent priors. In this context
corresponds to the range parameter and
to the degrees of freedom.
dtsrprioroba(x,trend="cte",prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data)
dtsrprioroba(x,trend="cte",prior="reference",coords.col=1:2, kappa=0.5,cov.model="exponential",data)
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 |
Denote as 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 is constant over the region.
"1st"
, the design matrix is such that mean function becames a first order polynomial on the coordinates:
"2nd"
, the design matrix is such that mean function becames a second order polynomial on the coordinates:
~model
a model specification to include covariates (external trend) in the model.
Density of x=()
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).
dtsrposoba
,dnsrprioroba
,dnsrposoba
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)
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)
It calculates the marginal density density for a model (up to a proportionality constant) for the NSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context
corresponds to the range parameter.
intmnorm(formula,prior="reference",coords.col=1:2,kappa=0.5, cov.model="exponential",data,asigma=2.1,intphi,maxEval)
intmnorm(formula,prior="reference",coords.col=1:2,kappa=0.5, cov.model="exponential",data,asigma=2.1,intphi,maxEval)
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. |
Let a parametric model with parameter vector
. Under the TSR model and the prior density proposal:
we have that the marginal density is given by:
This quantity can be useful as a criteria for model selection. The computation of could be compute demanding depending on the number of iterations in
maxEval
.
Marginal density of the model for the reference based, Jeffreys' rule, Jeffreys' independent and vague priors.
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
dnsrposoba
,dtsrprioroba
,dnsrprioroba
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
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
It calculates the marginal density density for a model (up to a proportionality constant) for the TSR model using the based reference, Jeffreys' rule, Jeffreys' independent and vague priors. In this context
corresponds to the range parameter and
to the degrees of freedom.
intmT(formula,prior="reference",coords.col=1:2,kappa=0.5, cov.model="exponential",data,asigma,intphi="default",intnu=c(4.1,Inf),maxEval)
intmT(formula,prior="reference",coords.col=1:2,kappa=0.5, cov.model="exponential",data,asigma,intphi="default",intnu=c(4.1,Inf),maxEval)
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. |
Let a parametric model with parameter vector
. Under the TSR model and the prior density proposal:
we have that the marginal density is given by:
This quantity can be useful as a criteria for model selection. The computation of could be compute demanding depending on the number of iterations in
maxEval
.
Marginal density of the model for the reference based, Jeffreys' rule, Jeffreys' independent and vague priors.
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models (Submitted).
dnsrposoba
,dtsrprioroba
,dnsrprioroba
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
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
This function performs Bayesian estimation of for the NSR model using the based reference, Jeffreys' rule ,Jeffreys' independent and vague priors.
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)
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)
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
|
For the "unif"
proposal, it was considered the structure where a priori, 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.
$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. |
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
dnsrposoba
,dtsrprioroba
,dnsrprioroba,tsroba
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)
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)
This function uses the sampling distribution of parameters obtained from the function tsroba
to predict values at unknown locations.
nsrobapred1(xpred, coordspred, obj)
nsrobapred1(xpred, coordspred, obj)
xpred |
Values of the X design matrix for prediction coordinates. |
coordspred |
Points coordinates to be predicted. |
obj |
object of the class "nsroba" (see |
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.
This function returns a vector with the predicted values at the specified locations.
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
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))
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
method for class "nsroba".
## S3 method for class 'nsroba' summary(object,...)
## S3 method for class 'nsroba' summary(object,...)
object |
object of the class "nsroba" (see |
... |
Additional arguments. |
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 |
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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.
dnsrposoba
,dtsrprioroba
,dnsrprioroba,tsroba
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)
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
method for class "tsroba".
## S3 method for class 'tsroba' summary(object, ...)
## S3 method for class 'tsroba' summary(object, ...)
object |
object of the class "tsroba" (see |
... |
Additional arguments. |
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 |
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models. (Submitted)
dnsrposoba
,dtsrprioroba
,dnsrprioroba
,tsroba
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)
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)
This function performs Bayesian estimation of for the TSR model using the based reference, Jeffreys' rule ,Jeffreys' independent and vague priors.
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)
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)
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
|
For the prior proposal, it was considered the structure . For the vague prior,
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, with A the interval given by the argument
intnu
and
For the Jeffreys independent prior, the sampling procedure generates improper posterior distribution when intercept is considered for the mean function.
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. |
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
Ordonez, J.A, M.O. Prattes, L.A. Matos, and V.H. Lachos (2020+). Objective Bayesian analysis for spatial Student-t regression models. (Submitted)
dnsrposoba
,dtsrprioroba
,dnsrprioroba
,tsroba
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)
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)
This function uses the sampling distribution of parameters obtained from the function tsroba
to predict values at unknown locations.
tsrobapred(obj,xpred,coordspred)
tsrobapred(obj,xpred,coordspred)
obj |
object of the class "tsroba" (see |
xpred |
Values of the X design matrix for prediction coordinates. |
coordspred |
Points coordinates to be predicted. |
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.
This function returns a vector with the predicted values at the specified locations.
Jose A. Ordonez, Marcos O. Prates, Larissa A. Matos, Victor H. Lachos.
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)
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])
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])