Get spatial residuals from data given a neighborhood structure and MRF model.
1 2 3 4 5 6 7 8 | spatial_residuals(
data,
neighbors,
conditional_cdf,
params,
discrete = "",
ncols = 0L
)
|
data |
A vector containing data values for each location in the lattice. |
neighbors |
A matrix N*N by (max # neighbors) + 1, where the first column is the location id of each location in the lattice. This could be the result from get_neighbors(). |
conditional_cdf |
A function that has two inputs:
There are three built in cdfs:
If the user chooses to write their own cdf in R, they must pass the name of the cdf function that is available in the global environment as this parameter. The input "data" is a list containing at least two elements, sums and nums which contain the sum of the data in each neighborhood as well as the number of locations in the neighborhood for each point in the conclique. In addition, the data can contain two additional elements, u and v, which are vectors that contain the horizontal and vertical location of each point in space. The input "params" is a list of parameter values. This function returns the inverse cdf at a value between 0 and 1 from the conditional distribution |
params |
A list of parameters to be passed to the conditional_density function |
discrete |
If you are dealing with a discrete distribution, the string name of the pmf function. Otherwise, leave as an empty string. |
ncols |
A integer of the number of columns in the original grid. Only necessary if dealing with "u" and "v" in cdf function. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.