View source: R/bootstrap_gof.R
Get reference distribution for goodness of fit statistics for the spatial residuals of a MRF model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
data |
A vector containing data values for each location in the lattice. |
conclique_cover |
A list of class "conclique_cover" encoding the locations in each conclique for the conclique cover |
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(). |
inits |
Initial values for the lattice, formatted as a grid. |
conditional_sampler |
The string name of a function that has two inputs:
There are three built in samplers:
If the user chooses to write their own sampler in R, they must pass the name of the sampler that is available in the gloabl environment as this parameter. The input "data" is a list containing 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. The input "params" is a list of parameter values. This function returns a value sampled from the specified conditional distribution given the data and parameters passed. |
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 |
fit_model |
A function that has three inputs:
The input "data" is a vector containing data values for each location in the lattice. The input "neighbors" is a matrix N*N by (max # neighbors) + 1, where the first column is the location id of each location in the lattice. The input "params0" is a list of parameter values. This function should return a list of fitted parameter values with the same name is params0. |
params0 |
A named list of parameter initialization points. |
B |
The number of bootstrap samples to take, defaults to 1000 |
statistic |
Which goodness of fit statistic to use, Kolmogorov-Smirnov ("ks") or Cramer von Mises ("cvm"). Kolmogorov-Smirnov is the default choice. |
aggregate |
How to aggregate GOF statistics across concliques, mean ("mean") or max ("max"). Mean is the default. Can also be a name of a user defined aggregation function |
quantiles |
(Optional) A vector of quantiles to return from the reference distribution. If NULL (default), no quantiles are returned |
plot.include |
TRUE/FALSE parameterizing if a plot of the distribution is returned. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.