Description Usage Arguments Details Value References Examples
View source: R/krige.posterior.R
This function finds the posterior density of a geospatial linear regression model given a point-referenced geospatial dataset and a set of parameter values. The function is useful for finding the optimum of or for sampling from the posterior distribution.
1 2 3 4 |
tau2 |
Value of the nugget, or non-spatial error variance. |
phi |
Value of the decay term, driving the level of spatial correlation. |
sigma2 |
Value of the partial sill, or maximum spatial error variance. |
beta |
Coefficients from linear model. |
y |
The dependent variable that is used in the kriging model. |
X |
The matrix of independent variables used in the kriging model. |
east |
Vector of eastings for all observations. |
north |
Vector of northings for all observations. |
semivar.exp |
This exponent, which must be greater than 0 and less than or equal to 2, specifies a powered exponential correlation structure for the data. One widely used specification is setting this to 1, which yields an exponential correlation structure. Another common specification is setting this to 2 (the default), which yields a Gaussian correlation structure. |
p.spatial.share |
Prior for proportion of unexplained variance that is spatial in nature. Must be greater than 0 and less than 1. Defaults to an even split. |
p.range.share |
Prior for the effective range term, as a proportion of the maximum distance in the data. Users should choose the proportion of distance at which they think the spatial correlation will become negligible. Must be greater than 0. Values greater than 1 are permitted, but users should recognize that this implies that meaningful spatial correlation would persist outside of the convex hull of data. Defaults to half the maximum distance. |
p.range.tol |
Tolerance term for setting the effective range. At the distance where the spatial correlation drops below this term, it is judged that the effective range has been met. Users are typically advised to leave this at its default value of 0.05 unless they have strong reasons to choose another level. Must be greater than 0 and less than 1. |
p.beta.var |
Prior for the variance on zero-meaned normal priors on the regression coefficients. Defaults to 10. |
tot.var |
Combined variance between the nugget and partial sill. Defaults to the variance of y. The |
local.Sigma |
The user is advised to ignore this option, or leave it the value of |
distance |
Experimental feature: The user is advised to ignore this option, or leave it the value of |
max.distance |
The user is advised to ignore this option, or leave it the value of |
checks |
Experimental feature: A logical variable that defines whether to check NA and comformity of parameters. |
This function finds the posterior density for a kriging model. The function utilizes information provided about the parameters tau2
, phi
, sigma2
, and beta
. It also utilizes the observed data y
, X
, east
, and north
. Given a set of parameter values as well as the observed data, the function returns the posterior density for the specified model.
Returns a single number that is the posterior density of the function, which is stored in object of class matrix
.
Jeff Gill. 2020. Measuring Constituency Ideology Using Bayesian Universal Kriging. State Politics & Policy Quarterly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Examine Data
summary(ContrivedData)
#Initial OLS Model
contrived.ols<-lm(y~x.1+x.2,data=ContrivedData);summary(contrived.ols)
#Define Covariate Matrix
covariates<-cbind(1,ContrivedData$x.1,ContrivedData$x.2)
# Find the posterior density for the Contrived Data if all parameters were 1:
s.test <- krige.posterior(tau2=1,phi=1,sigma2=1,beta=rep(1,ncol(covariates)),
y=ContrivedData$y,X=covariates,east=ContrivedData$s.1,north=ContrivedData$s.2)
# Print posterior density
s.test
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.