View source: R/prinfunctions.R
| tsroba | R Documentation |
This function performs Bayesian estimation of θ=(\bold{β},σ^2,φ) 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)
formula |
A valid formula for a linear regression model. |
method |
Method to estimate (\bold{beta},σ,φ,ν). The methods availables are |
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 a for vague prior. |
intphi |
An interval for φ used for the uniform proposal. See |
intnu |
An interval for ν used for the uniform proposal. See |
ini.pars |
Initial values for (σ^2,φ,ν) 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
|
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, ν|λ~ Texp(λ,A) with A the interval given by the argument intnu and λ~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.
dist |
Joint sample (matrix object) obtaining for (\bold{beta},σ^2,φ). |
betaF |
Sample obtained for \bold{beta}. |
sigmaF |
Sample obtained for σ^2. |
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 (\bold{beta},σ,φ). |
$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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.