PSTestRun | R Documentation |
PSTestRun
returns the empirical pointwise p-values of the test. Additionally,
it may also return simultaneous empirical p-values from a rank envelope test with
plots if asked.
This function is called after initialising the data with the function PSTestInit
.
PSTestRun( proc_dat, formula, interaction = NULL, M = 1000, covariates = NULL, latent_effect, PS = "either", no_nn = 1, residual_tests = F, sigma = NULL, leaveoneout = T, fix_n = F, parallel = F, ncores = 1, simultaneous = F, global_alpha = 0.05, return_rho_vals = F, return_plots = T, return_model = F )
proc_dat |
is the processed data from PSTestInit. |
formula |
is a formula in the R language describing the model to be fitted by spatstat. For spacetime data, this can be a named list of formulas. The name of each element of the list matches a name of one of the observed time steps. Each element gives the formula for the time step. |
interaction |
is an object of spatstat class "interact" describing the point
process interaction structure, can also be a function that makes such an object,
or NULL indicating that a Poisson process (stationary or nonstationary) should
be fitted. See the help file for |
M |
specifies the number of Monte Carlo samples to take |
covariates |
is a list when discrete==F, whose entries are images, functions,
windows, tessellations or single numbers when spatial. When spacetime, covariates
is either a named list of lists (one per timestep), or a list of entries of covariates
constant through time. When covariates change over time, name the lists with the
number that points the list of covariates to the correct time. See the help file for
|
latent_effect |
is the latent effect of interest. When discrete==F, it needs to be predicted over a high resolution grid. For discrete==T, the latent effect needs to be predicted at each areal unit. For discrete==T, this is a vector of class numeric. For discrete==T, the length must equal the number of areal units in the population multiplied by the number of unique time steps. For discrete==F, latent effect is of class im, or a SpatialPixels style format. For spacetime data when discrete==F, latent_effect is either a named list of im or SpatialPixels style objects (one per time period), or as before for spatial. The naming convention for the named list is the same as before. |
PS |
is a string specifying the direction of PS in the alternative. One of 'positive', 'negative' or 'either'. |
no_nn |
specifies the maximum number of nearest neighbours to average the distance over. Results of the tests of all values K=1:no_nn are returned. |
residual_tests |
is a logical argument specifying if the rank correlation of the smoothed raw HPP and model residuals should be computed. |
sigma, leaveoneout |
are additional arguments for the |
fix_n |
is a logical stating if the sample size should be fixed in the Monte Carlo samples to value observed in the data. |
parallel |
is a logical specifying if the code should be run in parallel. |
ncores |
specifies the number of cores to parallelize over if parallel=T. |
simultaneous |
is a logical specifying if the simultaneous test should be computed that corrects for multiple testing. This performs a rank envelope test. |
global_alpha |
is a number between 0 and 1 specifying the significance level of the simultaneous test. |
return_rho_vals |
is a logical stating if the raw rank correlations should be returned. |
return_plots |
is a logical stating if the ggplot object should be printed (if simultaneous = T). |
return_model |
is a logical stating if the fitted model object from spatstat, or mgcv should be returned. |
A named list containing a minimum of the empirical pointwise p values. Depending on the arguments specified above, simultaneous p values, rank correlations and plot objects may also be returned.
For detailed examples, see the vignette (i.e. run vignette('PSTestR')), or visit https://github.com/joenomiddlename/PStestR for more details.
PSTestInit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.