Description Usage Arguments Details Value Examples
Draw MCMC samples from the transformed Gaussian model with known link function
1 2 3 4 
formula 
A representation of the model in the form

data 
An optional data frame containing the variables in the model. 
weights 
An optional vector of weights. Number of replicated samples. 
subset 
An optional vector specifying a subset of observations to be used in the fitting process. 
atsample 
A formula in the form 
Nout 
Number of MCMC samples to return. 
Nthin 
The thinning of the MCMC algorithm. 
Nbi 
The burnin of the MCMC algorithm. 
betm0 
Prior mean for beta (a vector or scalar). 
betQ0 
Prior standardised precision (inverse variance) matrix. Can be a scalar, vector or matrix. The first two imply a diagonal with those elements. Set this to 0 to indicate a flat improper prior. 
ssqdf 
Degrees of freedom for the scaled inverse chisquare prior for the partial sill parameter. 
ssqsc 
Scale for the scaled inverse chisquare prior for the partial sill parameter. 
tsqdf 
Degrees of freedom for the scaled inverse chisquare prior for the measurement error parameter. 
tsqsc 
Scale for the scaled inverse chisquare prior for the measurement error parameter. 
phipars 
Parameters for the generalized inverse gamma prior
for the range parameter 
omgpars 
Parameters for the generalized inverse gamma prior
for the relative nugget parameter 
corrfcn 
Spatial correlation function. See

kappa 
Spatial correlation parameter. Smoothness parameter for Matern, exponent for the power family. 
linkp 
The exponent of the BoxCox transformation. 
phisc 
Random walk parameter for 
omgsc 
Random walk parameter for 
zstart 
Optional starting value for the MCMC for the GRF. This can be either a scalar, a vector of size n where n is the number of sampled locations. 
phistart 
Optional starting value for the MCMC for the
spatial range parameter 
omgstart 
Optional starting value for the MCMC for the relative
nugget parameter 
longlat 
How to compute the distance between locations. If

test 
Whether this is a trial run to monitor the acceptance
ratio of the random walk for 
Simulates from the posterior distribution of this model.
A list containing the MCMC samples and other variables as follows:
z
A matrix containing the MCMC samples for the
spatial random field. Each column is one sample.
mu
A matrix containing the MCMC samples for the
mean response (a transformation of z). Each column is one sample.
beta
A matrix containing the MCMC samples for the
regressor coefficients. Each column is one sample.
ssq
A vector with the MCMC samples for the partial
tsq
A vector with the MCMC samples for the
measurement error variance.
phi
A vector with the MCMC samples for the spatial
range parameter.
omg
A vector with the MCMC samples for the relative
nugget parameter.
nu
The link function parameter translated to
numeric code used internally.
logLik
A vector containing the value of the
loglikelihood evaluated at each sample.
acc_ratio
The acceptance ratio for the joint update
of the parameters phi
and omg
.
sys_time
The total computing time for the MCMC sampling.
Nout
, Nbi
, Nthin
As in input. Used
internally in other functions.
response
The average of the response variable at the
observed locations, i.e. its value divided by the corresponding
weight. Used internally in other functions.
weights
The response weights at the observed
locations. Used internally in other functions.
modelmatrix
The model matrix at the observed
locations. Used internally in other functions.
family
As in input. Used internally in other functions.
betm0
, betQ0
, ssqdf
, ssqsc
,
corrfcn
, kappa
, tsqdf
, tsqsc
As in
input. Used internally in other functions.
locations
Coordinates of the observed locations.
Used internally in other functions.
whichobs
A logical vector indicated which rows in
the data and in the MCMC samples for the spatial random field
correspond to the observed locations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47  ## Not run:
### Load the data
data(rhizoctonia)
rhiz < na.omit(rhizoctonia)
rhiz$IR < rhiz$Infected/rhiz$Total # Incidence rate of the
# rhizoctonia disease
### Define the model
corrf < "spherical"
ssqdf < 1
ssqsc < 1
tsqdf < 1
tsqsc < 1
betm0 < 0
betQ0 < diag(.01, 2, 2)
phiprior < c(200, 1, 1000, 100) # U(100, 300)
phisc < 1
omgprior < c(3, 1, 1000, 0) # U(0, 3)
omgsc < 1.3
linkp < 1
## MCMC parameters
Nout < 100
Nbi < 0
Nthin < 1
samplt < mcstrga(Yield ~ IR, data = rhiz,
atsample = ~ Xcoord + Ycoord, corrf = corrf,
Nout = Nout, Nthin = Nthin,
Nbi = Nbi, betm0 = betm0, betQ0 = betQ0,
ssqdf = ssqdf, ssqsc = ssqsc,
tsqdf = tsqdf, tsqsc = tsqsc,
phipars = phiprior, omgpars = omgprior,
linkp = linkp,
phisc = phisc, omgsc = omgsc, test=10)
sample < mcstrga(Yield ~ IR, data = rhiz,
atsample = ~ Xcoord + Ycoord, corrf = corrf,
Nout = Nout, Nthin = Nthin,
Nbi = Nbi, betm0 = betm0, betQ0 = betQ0,
ssqdf = ssqdf, ssqsc = ssqsc,
tsqdf = tsqdf, tsqsc = tsqsc,
phipars = phiprior, omgpars = omgprior,
linkp = linkp,
phisc = phisc, omgsc = omgsc, test=FALSE)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.